From: Li Dongyang <lidongyang@novell.com>
To: David Sterba <dsterba@suse.cz>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org, stable@kernel.org
Subject: Re: [PATCH] btrfs: fix crash when no drive supports DISCARD
Date: Wed, 18 May 2011 11:29:14 +0800 [thread overview]
Message-ID: <201105181129.14201.lidongyang@novell.com> (raw)
In-Reply-To: <1305648031-26379-1-git-send-email-dsterba@suse.cz>
On Wednesday, May 18, 2011 12:00:31 AM David Sterba wrote:
> xfstests/013 crashes when the test partition is mounted with -o discard:
>
> walk_up_log_tree
> btrfs_free_reserved_extent
> btrfs_discard_extent
> return -EOPNOTSUPP
> BUG_ON ret
>
> btrfs_discard_extent() should be fine when drive does not support the
> DISCARD operation and filter the EOPNOTSUPP retcode, but currently it
> does this only when some bytes were succesfully discarded.
>
> Signed-off-by: David Sterba <dsterba@suse.cz>
> CC: stable@kernel.org
> ---
> fs/btrfs/extent-tree.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 9ee6bd5..feab2ab 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -1790,7 +1790,7 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
> }
> kfree(multi);
> }
> - if (discarded_bytes && ret == -EOPNOTSUPP)
> + if (ret == -EOPNOTSUPP)
> ret = 0;
>
> if (actual_bytes)
>
Thanks for the fix, I thought EOPNOTSUPP could be useful by the caller that time, and maybe we could do somthing
like remove the discard mount_opt in the fs_info so we can avoid calling it again.
next prev parent reply other threads:[~2011-05-18 3:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 15:27 Drive without DISCARD support crashes btrfs David Sterba
2011-05-17 16:00 ` [PATCH] btrfs: fix crash when no drive supports DISCARD David Sterba
2011-05-17 18:49 ` Chris Mason
2011-05-18 3:29 ` Li Dongyang [this message]
2011-05-20 11:52 ` David Sterba
2011-05-20 14:15 ` Josef Bacik
2011-05-21 8:26 ` Li Dongyang
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=201105181129.14201.lidongyang@novell.com \
--to=lidongyang@novell.com \
--cc=chris.mason@oracle.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=stable@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 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).