btrfs: use -f by default for mkfs as xfs/extN do
PATCH 1/1 btrfs: use -f by default for mkfs as xfs/extN do
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
This seems well-enough fixed by only making the change to _scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.
---
TBH I'm a little baffled, has nobody really run into this before, or am I missing something?
common/rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
common/rc +5 -5
@@ -871,7 +871,7 @@ _test_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* $TEST_DEV
@@ -920,7 +920,7 @@ _try_mkfs_dev() $MKFS_UDF_PROG $MKFS_OPTIONS $* ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*
@@ -1010,7 +1010,7 @@ _scratch_mkfs() mkfs_filter="cat" ;; btrfs) - mkfs_cmd="$MKFS_BTRFS_PROG" + mkfs_cmd="$MKFS_BTRFS_PROG -f" mkfs_filter="cat" ;; ext3)
@@ -1176,7 +1176,7 @@ _scratch_pool_mkfs() { case $FSTYP in btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null ;; *) echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
@@ -1369,7 +1369,7 @@ _try_scratch_mkfs_sized() # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size() (( fssize < $((256 * 1024 * 1024)) )) && ! _scratch_btrfs_is_zoned && mixed_opt='--mixed' - $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV ;; jfs) ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocks
Signature · 1 line
2.54.0
Quoted 8 lines · Eric Sandeen
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
This seems well-enough fixed by only making the change to
_scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.
Quoted 5 lines
Signed-off-by Eric Sandeen <[email protected]>---
TBH I'm a little baffled, has nobody really run into this before, or am I missing something?
I found myself wondering btrfs folk test with MKFS_OPTS set, i.e.
MKFS_OPTS="-f" ./check -g quick
common/rc _test_mkfs()
Quoted 9 lines
common/rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)common/rc +0
-0@@ -871,7 +871,7 @@ _test_mkfs()
Not part of your change, but it feels like _test_mkfs() could simplify to
_test_mkfs()
{
try_mkfs_dev $TEST_DEV > /dev/null
}
But simple is good, so
-- Don
Quoted 44 lines
common/rc +5
-5$MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* $TEST_DEV@@ -920,7 +920,7 @@ _try_mkfs_dev() $MKFS_UDF_PROG $MKFS_OPTIONS $* ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*@@ -1010,7 +1010,7 @@ _scratch_mkfs() mkfs_filter="cat" ;; btrfs) - mkfs_cmd="$MKFS_BTRFS_PROG" + mkfs_cmd="$MKFS_BTRFS_PROG -f" mkfs_filter="cat" ;; ext3)@@ -1176,7 +1176,7 @@ _scratch_pool_mkfs() { case $FSTYP in btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null ;; *) echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2@@ -1369,7 +1369,7 @@ _try_scratch_mkfs_sized() # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size() (( fssize < $((256 * 1024 * 1024)) )) && ! _scratch_btrfs_is_zoned && mixed_opt='--mixed' - $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV ;; jfs) ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocks
Quoted 7 lines · Eric Sandeen
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
This seems well-enough fixed by only making the change to
_scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.
I haven't run into this yet, but it seem like btrfs needs this. But maybe you should also Cc the btrfs list?
Quoted 63 lines
Signed-off-by Eric Sandeen <[email protected]>---
TBH I'm a little baffled, has nobody really run into this before, or am I missing something?
common/rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)common/rc +5
-5@@ -871,7 +871,7 @@ _test_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* $TEST_DEV@@ -920,7 +920,7 @@ _try_mkfs_dev() $MKFS_UDF_PROG $MKFS_OPTIONS $* ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*@@ -1010,7 +1010,7 @@ _scratch_mkfs() mkfs_filter="cat" ;; btrfs) - mkfs_cmd="$MKFS_BTRFS_PROG" + mkfs_cmd="$MKFS_BTRFS_PROG -f" mkfs_filter="cat" ;; ext3)@@ -1176,7 +1176,7 @@ _scratch_pool_mkfs() { case $FSTYP in btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null ;; *) echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2@@ -1369,7 +1369,7 @@ _try_scratch_mkfs_sized() # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size() (( fssize < $((256 * 1024 * 1024)) )) && ! _scratch_btrfs_is_zoned && mixed_opt='--mixed' - $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV ;; jfs) ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocksSignature · 1 line
2.54.0
---end quoted text---
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Eric Sandeen
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
This seems well-enough fixed by only making the change to
_scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.I haven't run into this yet, but it seem like btrfs needs this. But maybe you should also Cc the btrfs list?
This is the wrong fix.
It's caused by a mkfs.btrfs help string output change, and it's properly fixed by this patch which is already merged for a while:
https://lore.kernel.org/linux-btrfs/[email protected]/
Thanks,
Qu
Quoted 66 lines
Quoted 64 lines
Signed-off-by Eric Sandeen <[email protected]>---
TBH I'm a little baffled, has nobody really run into this before, or am I missing something?
common/rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)common/rc +5
-5@@ -871,7 +871,7 @@ _test_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $TEST_DEV > /dev/null ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* $TEST_DEV@@ -920,7 +920,7 @@ _try_mkfs_dev() $MKFS_UDF_PROG $MKFS_OPTIONS $* ;; btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* ;; ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*@@ -1010,7 +1010,7 @@ _scratch_mkfs() mkfs_filter="cat" ;; btrfs) - mkfs_cmd="$MKFS_BTRFS_PROG" + mkfs_cmd="$MKFS_BTRFS_PROG -f" mkfs_filter="cat" ;; ext3)@@ -1176,7 +1176,7 @@ _scratch_pool_mkfs() { case $FSTYP in btrfs) - $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null ;; *) echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2@@ -1369,7 +1369,7 @@ _try_scratch_mkfs_sized() # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size() (( fssize < $((256 * 1024 * 1024)) )) && ! _scratch_btrfs_is_zoned && mixed_opt='--mixed' - $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV + $MKFS_BTRFS_PROG -f $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV ;; jfs) ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocksSignature · 1 line
2.54.0---end quoted text---
Quoted 15 lines · Qu Wenruo
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Eric Sandeen
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
This seems well-enough fixed by only making the change to
_scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.I haven't run into this yet, but it seem like btrfs needs this. But maybe you should also Cc the btrfs list?
Quoted 6 lines
This is the wrong fix.
It's caused by a mkfs.btrfs help string output change, and it's properly fixed by this patch which is already merged for a while:
In other words: we already get -f, but it got broken recently. That explains why things always worked for me.
I took me a bit to reverse-engineers this from your answer :)
Quoted 18 lines · Christoph Hellwig
Quoted 17 lines · Qu Wenruo
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Eric Sandeen
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
This seems well-enough fixed by only making the change to
_scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.I haven't run into this yet, but it seem like btrfs needs this. But maybe you should also Cc the btrfs list?
This is the wrong fix.
Quoted 7 lines
Quoted 4 lines
It's caused by a mkfs.btrfs help string output change, and it's properly fixed by this patch which is already merged for a while:
In other words: we already get -f, but it got broken recently. That explains why things always worked for me.
Hey, this shows you're running on a proper server distro, not some rolling bleeding edge one :)
And thanks for CCing the btrfs list.
Quoted 4 lines
I took me a bit to reverse-engineers this from your answer :)
Quoted 5 lines · Qu Wenruo
Quoted 2 lines
In other words: we already get -f, but it got broken recently. That explains why things always worked for me.
Hey, this shows you're running on a proper server distro, not some rolling bleeding edge one :)
Actually I run self-built btrfsprogs in my test VMs. I just didn't have a need to update it recently.
Quoted 8 lines · Qu Wenruo
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Eric Sandeen
Recently saw a case where testing ext4, xfs, then btrfs failed all btrfs tests because mkfs.btrfs refused to overwrite the left-over xfs filesystem on $SCRATCH_DEV.
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
This seems well-enough fixed by only making the change to
_scratch_mkfs, but several other helper functions explicitly use -f / -F for xfs and extN, so I've updated them for btrfs as well.I haven't run into this yet, but it seem like btrfs needs this. But maybe you should also Cc the btrfs list?
Yeah, sorry.
Quoted 5 lines
This is the wrong fix.
It's caused by a mkfs.btrfs help string output change, and it's properly fixed by this patch which is already merged for a while:
Oh, ugh. I did not know (ok: remember, because I wrote it in 2013) that we had a special helper function used only for a subset of filesystems, while hardcoding -f / -F on other filesystems. :(
Anyway, this fix is still on for-next and I missed it, sorry about that.
Thanks for the heads up.
-Eric
Quoted 2 lines
Thanks,
Qu