mkfs,xfs_repair: don't pass a daddr as the flags argument
PATCH 1/2 mkfs,xfs_repair: don't pass a daddr as the flags argument
From: Darrick J. Wong <[email protected]>
libxfs_buf_get_uncached doesn't take a daddr argument, so don't pass one as the flags argument. Also take the opportunity to use xfs_buf_set_daddr to set the actual disk address.
--- mkfs/xfs_mkfs.c | 5 ++--- repair/rt.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-)
mkfs/xfs_mkfs.c +2 -3
@@ -4989,15 +4989,14 @@ write_rtsb( } error = -libxfs_buf_get_uncached (mp->m_rtdev_targp, -XFS_FSB_TO_BB (mp,1 ),XFS_RTSB_DADDR , - &rtsb_bp); +XFS_FSB_TO_BB (mp,1 ),0 , &rtsb_bp);if (error) {fprintf (stderr,_ ("%s: couldn't grab realtime superblock buffer\n" ), progname);exit (1 ); } - rtsb_bp->b_maps[0 ].bm_bn =XFS_RTSB_DADDR ; +xfs_buf_set_daddr (rtsb_bp,XFS_RTSB_DADDR ); rtsb_bp->b_ops = &xfs_rtsb_buf_ops;libxfs_update_rtsb (rtsb_bp, sb_bp);
repair/rt.c +2 -2
@@ -616,12 +616,12 @@ rewrite_rtsb( _("couldn't grab primary sb to update realtime sb\n")); error = -libxfs_buf_get_uncached (mp->m_rtdev_targp, -XFS_FSB_TO_BB (mp,1 ),XFS_RTSB_DADDR , &rtsb_bp); +XFS_FSB_TO_BB (mp,1 ),0 , &rtsb_bp);if (error)do_error (_ ("couldn't grab realtime superblock\n" )); - rtsb_bp->b_maps[0 ].bm_bn =XFS_RTSB_DADDR ; +xfs_buf_set_daddr (rtsb_bp,XFS_RTSB_DADDR ); rtsb_bp->b_ops = &xfs_rtsb_buf_ops;libxfs_update_rtsb (rtsb_bp, sb_bp);
PATCH 2/2 xfs_db: obfuscate rt superblock label when metadumping
From: Darrick J. Wong <[email protected]>
Metadump can obfuscate the filesystem label on all the superblocks on the data device, so it must perform the same transformation on the realtime device superblock to avoid leaking information and so that the mdrestored filesystem is consistent.
Found by running xfs/503 with realtime turned on and a patch to set labels on common/populated filesystem images.
--- db/metadump.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
db/metadump.c +11 -0
@@ -3073,6 +3073,17 @@ copy_rtsb(void)print_warning ("cannot read realtime superblock" );return !metadump.stop_on_read_error; } + +/* Replace any filesystem label with "L's" */ +if (metadump.obfuscate) { +struct xfs_rtsb *rtsb = iocur_top->data; + +memset (rtsb->rsb_fname,'L' , +min (strlen ((char *)rtsb->rsb_fname), +sizeof (rtsb->rsb_fname))); + iocur_top->need_crc =1 ; + } + error =write_buf (iocur_top);pop_cur ();
Quoted 5 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
libxfs_buf_get_uncacheddoesn't take a daddr argument, so don't pass one as the flags argument. Also take the opportunity to usexfs_buf_set_daddrto set the actual disk address.
Should it take a daddr argument? I've been wondering that a bit as the interface that doesn't pass one seems a bit odd.
The patch itself looks fine, although I don't really see the point in the xfsprogs-only xfs_buf_set_daddr (including the current two callers).
Re: [PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping
In reply to Darrick J. WongLooks good:
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
libxfs_buf_get_uncacheddoesn't take a daddr argument, so don't pass one as the flags argument. Also take the opportunity to usexfs_buf_set_daddrto set the actual disk address.Should it take a daddr argument? I've been wondering that a bit as the interface that doesn't pass one seems a bit odd.
We'd have to change the kernel first, there are libxfs callers with that signature.
Quoted 2 lines
The patch itself looks fine, although I don't really see the point in the xfsprogs-only
xfs_buf_set_daddr(including the current two callers).
Eh, yeah. Want me to resend with those bits cut out?
--D
PATCH 1/2 mkfs,xfs_repair: don't pass a daddr as the flags argument
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
libxfs_buf_get_uncached doesn't take a daddr argument, so don't pass one as the flags argument.
---
v1.1: drop the xfs_buf_set_addr change
--- mkfs/xfs_mkfs.c | 3 +-- repair/rt.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
mkfs/xfs_mkfs.c +1 -2
@@ -4989,8 +4989,7 @@ write_rtsb( } error = -libxfs_buf_get_uncached (mp->m_rtdev_targp, -XFS_FSB_TO_BB (mp,1 ),XFS_RTSB_DADDR , - &rtsb_bp); +XFS_FSB_TO_BB (mp,1 ),0 , &rtsb_bp);if (error) {fprintf (stderr,_ ("%s: couldn't grab realtime superblock buffer\n" ), progname);
repair/rt.c +1 -1
@@ -616,7 +616,7 @@ rewrite_rtsb( _("couldn't grab primary sb to update realtime sb\n")); error = -libxfs_buf_get_uncached (mp->m_rtdev_targp, -XFS_FSB_TO_BB (mp,1 ),XFS_RTSB_DADDR , &rtsb_bp); +XFS_FSB_TO_BB (mp,1 ),0 , &rtsb_bp);if (error)do_error (_ ("couldn't grab realtime superblock\n" ));
Quoted 4 lines · Darrick J. Wong
Quoted 2 lines
The patch itself looks fine, although I don't really see the point in the xfsprogs-only
xfs_buf_set_daddr(including the current two callers).Eh, yeah. Want me to resend with those bits cut out?
As long as the helper is around there's probably no reason not to use it. Removing it would probably pair pretty well with passing a daddr to xfs_get_buf_uncached. Or maybe killing xfs_{get,read}_buf_uncached entirely in favor of just using xfs_buf_oneshot more..
Looks good:
Quoted 10 lines · Christoph Hellwig
Quoted 4 lines · Darrick J. Wong
Quoted 2 lines
The patch itself looks fine, although I don't really see the point in the xfsprogs-only
xfs_buf_set_daddr(including the current two callers).Eh, yeah. Want me to resend with those bits cut out?
As long as the helper is around there's probably no reason not to use it. Removing it would probably pair pretty well with passing a daddr to
xfs_get_buf_uncached. Or maybe killing xfs_{get,read}_buf_uncached entirely in favor of just usingxfs_buf_oneshotmore..
<nod> I think I'd rather rid of it entirely and fix the _uncached API to take a daddr. It's not like we can't pass in DADDR_NULL if we *really* don't know where it's going.
--D