linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Return EAGAIN if we can't start no snpashot write in check_can_nocow
@ 2019-05-07  7:23 Nikolay Borisov
  2019-05-10 12:03 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Borisov @ 2019-05-07  7:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

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>
---
 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 d8abce428176..ae1fadae3d47 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,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: Return EAGAIN if we can't start no snpashot write in check_can_nocow
  2019-05-07  7:23 [PATCH] btrfs: Return EAGAIN if we can't start no snpashot write in check_can_nocow Nikolay Borisov
@ 2019-05-10 12:03 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2019-05-10 12:03 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Tue, May 07, 2019 at 10:23:46AM +0300, Nikolay Borisov wrote:
> 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>

Added to 5.3 queue, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-10 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07  7:23 [PATCH] btrfs: Return EAGAIN if we can't start no snpashot write in check_can_nocow Nikolay Borisov
2019-05-10 12:03 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).