Skip to content

Commit

Permalink
btrfs: Return EAGAIN if we can't start no snpashot write in check_can…
Browse files Browse the repository at this point in the history
…_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>
  • Loading branch information
Nikolay Borisov authored and David Sterba committed Jul 1, 2019
1 parent 0b6f5d4 commit 5f791ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5f791ec

Please sign in to comment.