linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jiang Biao <jiang.biao2@zte.com.cn>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	ebiggers@google.com, zhong.weidong@zte.com.cn
Subject: Re: [PATCH v2] fs/mbcache: make sure mb_cache_count() not return negative value.
Date: Wed, 10 Jan 2018 15:11:37 -0500	[thread overview]
Message-ID: <20180110201137.GB6499@thunk.org> (raw)
In-Reply-To: <20180110150223.axkqucrhzef2n64u@quack2.suse.cz>

On Wed, Jan 10, 2018 at 04:02:23PM +0100, Jan Kara wrote:
> So I don't think this can be a problem. Look, mb_cache_shrink() holds
> c_list_lock. It will take first entry from cache->c_list - this list is
> using list_head entry->e_list and so we are guaranteed entry->e_list is
> non-empty.
> 
> The other place deleting entry - mb_cache_entry_delete() - which is using
> different list to grab the entry is properly checking for
> !list_empty(entry->e_list) after acquiring c_list_lock.

Hmm... you're right.  How we handle the hlist_bl_lock and c_list_lock
still creeps me out a bit, but it's not going to cause the potential
problem.  I think there is a problem if mb_cache_entry_create() races
with mb_cache_delete(), but that will result in an entry being on the
c_list while not being on the hash list, and it doesn't cause the
c_entry_count to get out of sync with reality.

Drat....

						- Ted

  reply	other threads:[~2018-01-10 20:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 23:38 [PATCH v2] fs/mbcache: make sure mb_cache_count() not return negative value Jiang Biao
2018-01-09  0:13 ` Andrew Morton
2018-01-10  4:26   ` Theodore Ts'o
2018-01-10 15:02     ` Jan Kara
2018-01-10 20:11       ` Theodore Ts'o [this message]
2018-01-11  9:04         ` Jan Kara
2018-01-10  4:58 ` Theodore Ts'o

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=20180110201137.GB6499@thunk.org \
    --to=tytso@mit.edu \
    --cc=akpm@linux-foundation.org \
    --cc=ebiggers@google.com \
    --cc=jack@suse.cz \
    --cc=jiang.biao2@zte.com.cn \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=zhong.weidong@zte.com.cn \
    /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).