From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Dennis Zhou <dennis@kernel.org>, David Sterba <dsterba@suse.com>,
Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
Omar Sandoval <osandov@osandov.com>,
kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 12/12] btrfs: add correction to handle -1 edge case in async discard
Date: Mon, 6 Jan 2020 14:44:33 +0100 [thread overview]
Message-ID: <20200106134433.GD3929@suse.cz> (raw)
In-Reply-To: <d4597613-c6e7-4ae3-e6bc-889d74c5db78@suse.com>
On Sun, Jan 05, 2020 at 10:35:56PM +0200, Nikolay Borisov wrote:
> > + /*
> > + * The following is to fix a potential -1 discrepenancy that I'm not
> > + * sure how to reproduce. But given that this is the only place that
> > + * utilizes these numbers and this is only called by from
> > + * btrfs_finish_extent_commit() which is synchronized, we can correct
> > + * here.
> > + */
> > + if (discardable_extents < 0)
> > + atomic_add(-discardable_extents,
> > + &discard_ctl->discardable_extents);
> > +
> > + if (discardable_bytes < 0)
> > + atomic64_add(-discardable_bytes,
> > + &discard_ctl->discardable_bytes);
> > +
> > + if (discardable_extents <= 0) {
> > + spin_unlock(&discard_ctl->lock);
> > + return;
> > + }
>
> Perhaps a WARN_ON for each of those conditions? AFAIU this is papering
> over a real issue which is still not fully diagnosed, no? In this case
> if someone hits it in the wild they could come back with some stack traces?
I don't think the stacktrace itself would help us, the call chain will
be always the same. We need a reproducer for it and random user reports
would likely not help either, besides that the issue happens. Some sort
of developer-only warning would be desirable though.
next prev parent reply other threads:[~2020-01-06 13:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-02 21:26 [PATCH 00/12] btrfs: async discard follow up Dennis Zhou
2020-01-02 21:26 ` [PATCH 01/12] btrfs: calculate discard delay based on number of extents Dennis Zhou
2020-01-03 14:38 ` David Sterba
2020-01-02 21:26 ` [PATCH 02/12] btrfs: add bps discard rate limit for async discard Dennis Zhou
2020-01-03 14:40 ` David Sterba
2020-01-02 21:26 ` [PATCH 03/12] btrfs: limit max discard size " Dennis Zhou
2020-01-03 14:41 ` David Sterba
2020-01-02 21:26 ` [PATCH 04/12] btrfs: make max async discard size tunable Dennis Zhou
2020-01-03 14:44 ` David Sterba
2020-01-02 21:26 ` [PATCH 05/12] btrfs: have multiple discard lists Dennis Zhou
2020-01-02 21:26 ` [PATCH 06/12] btrfs: only keep track of data extents for async discard Dennis Zhou
2020-01-02 21:26 ` [PATCH 07/12] btrfs: keep track of discard reuse stats Dennis Zhou
2020-01-02 21:26 ` [PATCH 08/12] btrfs: add async discard header Dennis Zhou
2020-01-02 21:26 ` [PATCH 09/12] btrfs: increase the metadata allowance for the free_space_cache Dennis Zhou
2020-01-02 21:26 ` [PATCH 10/12] btrfs: make smaller extents more likely to go into bitmaps Dennis Zhou
2020-01-02 21:26 ` [PATCH 11/12] btrfs: ensure removal of discardable_* in free_bitmap() Dennis Zhou
2020-01-02 21:26 ` [PATCH 12/12] btrfs: add correction to handle -1 edge case in async discard Dennis Zhou
2020-01-03 14:42 ` David Sterba
2020-01-05 20:35 ` Nikolay Borisov
2020-01-06 13:44 ` David Sterba [this message]
2020-01-03 14:51 ` [PATCH 00/12] btrfs: async discard follow up David Sterba
2020-01-03 17:43 ` Dennis Zhou
2020-01-06 15:25 ` David Sterba
2020-01-06 17:14 ` Dennis Zhou
2020-01-06 17:37 ` David Sterba
2020-01-06 16:30 ` David Sterba
2020-01-06 17:28 ` Dennis Zhou
2020-01-06 17:49 ` David Sterba
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=20200106134433.GD3929@suse.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dennis@kernel.org \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=osandov@osandov.com \
/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