btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails
PATCH 1/1 btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails
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.
--- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/file.c +1 -1
@@ -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 ; lockstart =round_down (pos, fs_info->sectorsize); lockend = round_up(pos + *write_bytes,
Signature · 1 line
2.17.1
Quoted 14 lines · Nikolay Borisov
If
btrfs_start_write_no_snapshottingfails (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 <[email protected]>--- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/file.c +0
-0
fs/btrfs/file.c static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos, · line 1550
Quoted 5 lines
fs/btrfs/file.c +1
-1@@ -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?
Quoted 4 lines
fs/btrfs/file.c +0
-0lockstart =round_down (pos, fs_info->sectorsize); lockend = round_up(pos + *write_bytes,
Quoted 18 lines · Nikolay Borisov
Quoted 15 lines · Nikolay Borisov
If
btrfs_start_write_no_snapshottingfails (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 <[email protected]>--- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/file.c +0
-0@@ -1547,7 +1547,7 @@ static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos,
Quoted 7 lines
fs/btrfs/file.c static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos, · line 1550
Quoted 4 lines
fs/btrfs/file.c +1
-1ret =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?
Yeah, EAGAIN sounds better.