aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2019-05-07 10:23:46 +0300
committerDavid Sterba <dsterba@suse.com>2019-07-01 13:34:59 +0200
commit5f791ec31f535f62a2dc06b37c3a69e5e268b5db (patch)
treea740d0b6d57d28ad971f59baf93cc8827f8640ec /fs/btrfs/file.c
parentbtrfs: Add comments on locking of several device-related fields (diff)
downloadlinux-dev-5f791ec31f535f62a2dc06b37c3a69e5e268b5db.tar.xz
linux-dev-5f791ec31f535f62a2dc06b37c3a69e5e268b5db.zip
btrfs: Return EAGAIN if we can't start no snpashot write in check_can_nocow
The first thing code does in check_can_nocow is trying to block concurrent snapshots. If this fails (due to snpashot already being in progress) the function returns ENOSPC which makes no sense. Instead return EAGAIN. Despite this return value not being propagated to callers it's good practice to return the closest in terms of semantics error code. No functional changes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 007652ff5cb6..5370152ea7e3 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1556,7 +1556,7 @@ static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos,
ret = btrfs_start_write_no_snapshotting(root);
if (!ret)
- return -ENOSPC;
+ return -EAGAIN;
lockstart = round_down(pos, fs_info->sectorsize);
lockend = round_up(pos + *write_bytes,