linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails
@ 2019-04-23 11:48 Nikolay Borisov
  2019-04-23 13:59 ` Nikolay Borisov
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2019-04-23 11:48 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

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 <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 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;
 
 	lockstart = round_down(pos, fs_info->sectorsize);
 	lockend = round_up(pos + *write_bytes,
-- 
2.17.1


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

* Re: [PATCH] btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails
  2019-04-23 11:48 [PATCH] btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails Nikolay Borisov
@ 2019-04-23 13:59 ` Nikolay Borisov
  2019-05-02 15:29   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2019-04-23 13:59 UTC (permalink / raw)
  To: linux-btrfs



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 <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 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,
> 

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

* Re: [PATCH] btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails
  2019-04-23 13:59 ` Nikolay Borisov
@ 2019-05-02 15:29   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-05-02 15:29 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Tue, Apr 23, 2019 at 04:59:36PM +0300, Nikolay Borisov wrote:
> 
> 
> 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 <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 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?

Yeah, EAGAIN sounds better.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 11:48 [PATCH] btrfs: Return EBUSY in case btrfs_start_write_no_snapshotting fails Nikolay Borisov
2019-04-23 13:59 ` Nikolay Borisov
2019-05-02 15:29   ` 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).