path: root/mkfs
diff options
authorSu Yue <>2018-04-03 16:39:45 +0800
committerDavid Sterba <>2018-04-11 15:37:36 +0200
commit0d4adfd33687619b524f30414eda18cd63bb0ec1 (patch)
tree2b1a46b5692ebb0bbb824cc50522d95952f6283f /mkfs
parente3ada5752c1d50ddcb8a0ee096382db155973dda (diff)
btrfs-progs: mkfs: return nozero value on thin provisioned device
With mkfs.btrfs on a thin provisioned device with very small backing size and big virtual size, all code works well in mkfs.btrfs until close_ctree() is called. close_ctree() fails to sync device due to small backing size while closing devices. However, mkfs returns 0 in such situation which causes failure of fstests generic/405. So, let mkfs returns nonzero value if previous steps succeeded but close_ctree() failed. Then fstests generic/405 passes now. Signed-off-by: Su Yue <> Reviewed-by: Qu Wenruo <> Signed-off-by: David Sterba <>
Diffstat (limited to 'mkfs')
1 files changed, 6 insertions, 0 deletions
diff --git a/mkfs/main.c b/mkfs/main.c
index b65b18dd..0337993c 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1295,6 +1295,12 @@ out:
+ if (!ret && close_ret) {
+ ret = close_ret;
+ error("failed to close ctree, the filesystem may be inconsistent: %d",
+ ret);
+ }