* [PATCH] xfs_repair: join realtime inodes to transaction only once
@ 2020-02-27 20:50 Eric Sandeen
2020-02-27 21:00 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2020-02-27 20:50 UTC (permalink / raw)
To: linux-xfs
fill_rbmino() and fill_rsumino() can join the inode to the transactions
multiple times before committing, which is not permitted.
This leads to cache purge errors when running repair:
"cache_purge: shake on cache 0x92f5c0 left 129 nodes!?"
Move the libxfs_trans_ijoin out of the while loop to avoid this.
Fixes: e2dd0e1cc ("libxfs: remove libxfs_trans_iget")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/repair/phase6.c b/repair/phase6.c
index 70135694..7bbc6da2 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -645,7 +645,6 @@ fill_rbmino(xfs_mount_t *mp)
/*
* fill the file one block at a time
*/
- libxfs_trans_ijoin(tp, ip, 0);
nmap = 1;
error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap);
if (error || nmap != 1) {
@@ -676,6 +675,7 @@ _("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime bitmap inode %
bno++;
}
+ libxfs_trans_ijoin(tp, ip, 0);
error = -libxfs_trans_commit(tp);
if (error)
do_error(_("%s: commit failed, error %d\n"), __func__, error);
@@ -716,7 +716,6 @@ fill_rsumino(xfs_mount_t *mp)
/*
* fill the file one block at a time
*/
- libxfs_trans_ijoin(tp, ip, 0);
nmap = 1;
error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap);
if (error || nmap != 1) {
@@ -748,6 +747,7 @@ _("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime summary inode
bno++;
}
+ libxfs_trans_ijoin(tp, ip, 0);
error = -libxfs_trans_commit(tp);
if (error)
do_error(_("%s: commit failed, error %d\n"), __func__, error);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs_repair: join realtime inodes to transaction only once
2020-02-27 20:50 [PATCH] xfs_repair: join realtime inodes to transaction only once Eric Sandeen
@ 2020-02-27 21:00 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-02-27 21:00 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-xfs
On Thu, Feb 27, 2020 at 12:50:54PM -0800, Eric Sandeen wrote:
> fill_rbmino() and fill_rsumino() can join the inode to the transactions
> multiple times before committing, which is not permitted.
>
> This leads to cache purge errors when running repair:
>
> "cache_purge: shake on cache 0x92f5c0 left 129 nodes!?"
>
> Move the libxfs_trans_ijoin out of the while loop to avoid this.
>
> Fixes: e2dd0e1cc ("libxfs: remove libxfs_trans_iget")
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks reasonable, insofar as I have a patchset to port a few more kernel
APIs to xfsprogs so thta we can replace all the opencoded file setting
code in mkfs/repair to use that.
OH, heh, I never sent that. Sigh....
This code takes advantage of behavioral differences between xfsprogs
transactions and kernel transactions to wrap up all the bmapi_write
calls in a single transaction. This whole loop thing looks *weird* but
this does fix the ijoin usage to be correct WRT userspace transactions,
so...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
>
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index 70135694..7bbc6da2 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -645,7 +645,6 @@ fill_rbmino(xfs_mount_t *mp)
> /*
> * fill the file one block at a time
> */
> - libxfs_trans_ijoin(tp, ip, 0);
> nmap = 1;
> error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap);
> if (error || nmap != 1) {
> @@ -676,6 +675,7 @@ _("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime bitmap inode %
> bno++;
> }
>
> + libxfs_trans_ijoin(tp, ip, 0);
> error = -libxfs_trans_commit(tp);
> if (error)
> do_error(_("%s: commit failed, error %d\n"), __func__, error);
> @@ -716,7 +716,6 @@ fill_rsumino(xfs_mount_t *mp)
> /*
> * fill the file one block at a time
> */
> - libxfs_trans_ijoin(tp, ip, 0);
> nmap = 1;
> error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap);
> if (error || nmap != 1) {
> @@ -748,6 +747,7 @@ _("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime summary inode
> bno++;
> }
>
> + libxfs_trans_ijoin(tp, ip, 0);
> error = -libxfs_trans_commit(tp);
> if (error)
> do_error(_("%s: commit failed, error %d\n"), __func__, error);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-27 21:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 20:50 [PATCH] xfs_repair: join realtime inodes to transaction only once Eric Sandeen
2020-02-27 21:00 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).