Message ID | 75136f5acd2273246f1f240505a62de222372084.1440597812.git.zhaolei@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Wed, Aug 26, 2015 at 10:03:38PM +0800, Zhao Lei wrote: > Reproduce: > # btrfs subvolume sync /mnt/btrfs > Subvolume id 323 is gone > # echo $? > 1 > # > > Reason: > wait_for_subvolume_cleaning() return !0 in right case, because > value of ret is set to "is subvolume clean" state before return. > > Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 0d83bd5..0b398f0 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -66,7 +66,7 @@ static int is_subvolume_cleaned(int fd, u64 subvolid) static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids, int sleep_interval) { - int ret = 0; + int ret; int remaining; int i; @@ -92,6 +92,8 @@ static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids, break; sleep(sleep_interval); } + + ret = 0; out: return ret; }
Reproduce: # btrfs subvolume sync /mnt/btrfs Subvolume id 323 is gone # echo $? 1 # Reason: wait_for_subvolume_cleaning() return !0 in right case, because value of ret is set to "is subvolume clean" state before return. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> --- cmds-subvolume.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)