All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH RFC] btrfs: no need to transition to rdonly for ENOSPC error
Date: Tue, 12 Jan 2021 09:41:27 -0500	[thread overview]
Message-ID: <c5ccc5d5-c9e4-16ff-0b57-3b7dd2f3dfca@toxicpanda.com> (raw)
In-Reply-To: <169ba15cd316c181042bbe25e7d10c7963e3b7e8.1610444879.git.anand.jain@oracle.com>

On 1/12/21 5:34 AM, Anand Jain wrote:
> In the current kernel both scrub and balance fails due to ENOSPC,
> however there is no reason that it should be transitioned to the
> RDONLY and making free spaces difficult.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>   fs/btrfs/super.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 12d7d3be7cd4..8c1b858f55c4 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -172,6 +172,9 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
>   	if (sb_rdonly(sb))
>   		return;
>   
> +	if (errno == -ENOSPC)
> +		return;
> +
>   	btrfs_discard_stop(fs_info);
>   
>   	/* btrfs handle error by forcing the filesystem readonly */
> 

Filipe and Qu are right, but there are cases where we probably shouldn't flip 
read only on ENOSPC, and we should address those at the specific spots where 
this happens.  Do you have an example?  If it's happening at btrfs_search_slot() 
time then we're not reserving enough space in whatever reserve we use, but if 
it's happening somewhere else, for example trying to mark a block group as read 
only and getting an ENOSPC there, we could probably skip flipping read only for 
that sort of case.  We need to address the specific scenarios you're hitting 
rather than blanket skipping the abort for ENOSPC, otherwise we'll get corrupt 
file systems.  Thanks,

Josef

  parent reply	other threads:[~2021-01-12 14:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 10:34 [PATCH RFC] btrfs: no need to transition to rdonly for ENOSPC error Anand Jain
2021-01-12 13:09 ` Filipe Manana
2021-01-12 13:39 ` Qu Wenruo
2021-01-12 14:41 ` Josef Bacik [this message]
2021-01-13 11:22   ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5ccc5d5-c9e4-16ff-0b57-3b7dd2f3dfca@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.