On 23.04.19 г. 14:48 ч., Nikolay Borisov wrote:
> If btrfs_start_write_no_snapshotting fails (returns 0) it means there
> is snapshot in progress hence resource is busy and not that we are
> out of space. Change the return value to correctly reflect this.
>
> Signed-off-by: Nikolay Borisov <nbori...@suse.com>
> ---
> fs/btrfs/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index 2030b9bcb977..ce1dec51ff92 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1547,7 +1547,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 -EBUSY;
This error is not returned to userspace, nevertheless write won't expect
EBUSY in case it ever is. Perhaps EAGAIN makes more sense?
>
> lockstart = round_down(pos, fs_info->sectorsize);
> lockend = round_up(pos + *write_bytes,
>