From 4286eb552ed388ba06b02982d3e5bbea98448b1d Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 9 Nov 2022 18:59:12 +0100 Subject: [PATCH] Revert "btrfs-progs: resize: return error value from check_resize_args()" This reverts commit 55438f3930b23fdebeeda7b93ec00414c64a1361. The patch breaks resize cancel. Reproducer: #!/bin/bash fallocate -l 7g /var/tmp/7g1 && fallocate -l 7g /var/tmp/7g2 thing1=$(sudo losetup --show -f /var/tmp/7g1) thing2=$(sudo losetup --show -f /var/tmp/7g2) echo Make the fs mkfs.btrfs -L test539 $thing1 mkdir test539 mount -L test539 test539 echo Get rid of devid:1 by adding a new device and removing the original btrfs dev add $thing2 test539 btrfs dev del $thing1 test539 echo Creating wiggleroom fallocate -l 3g test539/3g1 && fallocate -l 3g test539/3g2 rm test539/3g1 echo Start a resize operation and wait 3s to run a cancel echo Under 6.0 cancel, under 6.0.1 no cancel and runs out of space btrfs fi re 2:-4g test539 & sleep 3s && btrfs fi re cancel test539 wait echo Cleanup umount test539 losetup -d $thing1 && losetup -d $thing2 rm /var/tmp/7g{1,2} rmdir test539 Issue: #539 Signed-off-by: David Sterba --- cmds/filesystem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmds/filesystem.c b/cmds/filesystem.c index d7c3c092..c2bb6bed 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -1124,7 +1124,6 @@ static int check_resize_args(const char *amount, const char *path) { ret = 1; goto out; } - ret = 0; sizestr = amount_dup; devstr = strchr(sizestr, ':'); @@ -1211,7 +1210,7 @@ static int check_resize_args(const char *amount, const char *path) { out: free(di_args); - return ret; + return 0; } static int cmd_filesystem_resize(const struct cmd_struct *cmd,