btrfs: return EAGAIN if defrag is canceled
authorTian Tao <tiantao6@hisilicon.com>
Wed, 5 May 2021 01:26:28 +0000 (09:26 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jun 2021 13:19:05 +0000 (15:19 +0200)
commit50535db8fbf67d44522de5b79ddf66fb6d0c14a8
treeddc5e055445ad57ec2da3f1216ee2b4ef8ded4e7
parent1245835d24f1ea989a0cbcdf93ddea3dcbc3814f
btrfs: return EAGAIN if defrag is canceled

When inode defrag is canceled, the error is set to EAGAIN but then
overwritten by number of defragmented bytes. As this would hide the
error, rather return EAGAIN. This does not harm 'btrfs fi defrag', it
will print the error and continue to next file (as it does in for any
other error).

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c