when mkfs.btrfs on a thin provision device which has 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 xfstests generic/405. So, let mkfs returns nonzero value if previous steps succeeded but close_ctree() failed. Then xfstests generic/405 passes now. Signed-off-by: Su Yue <suy.fnst@xxxxxxxxxxxxxx> --- mkfs/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mkfs/main.c b/mkfs/main.c index 5a717f701cd5..9f7f2396df8f 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1285,6 +1285,12 @@ out: } } + if (!ret && close_ret) { + ret = close_ret; + error("failed to close ctree, the filesystem may be inconsistent: %d", + ret); + } + btrfs_close_all_devices(); free(label); -- 2.16.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html