From: Theodore Ts'o <tytso@mit.edu>
To: Jiang Biao <jiang.biao2@zte.com.cn>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
ebiggers@google.com, akpm@linux-foundation.org, jack@suse.cz,
zhong.weidong@zte.com.cn
Subject: Re: [PATCH v2] fs/mbcache: make sure mb_cache_count() not return negative value.
Date: Tue, 9 Jan 2018 23:58:12 -0500 [thread overview]
Message-ID: <20180110045812.GD5809@thunk.org> (raw)
In-Reply-To: <1515454691-69220-1-git-send-email-jiang.biao2@zte.com.cn>
I think I've found the cause of it, but having a sanity check is a
good idea. I've simplified the patch and its description, though.
This is what I have in my tree.
- Ted
commit 252194e48f00d146de303822bba8c3568ca127cd
Author: Jiang Biao <jiang.biao2@zte.com.cn>
Date: Tue Jan 9 23:57:52 2018 -0500
mbcache: make sure c_entry_count is not decremented past zero
Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
CC: Eric Biggers <ebiggers@google.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Jan Kara <jack@suse.cz>
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 0851af5c1c3d..f2f15b747bed 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -239,7 +239,9 @@ void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value)
spin_lock(&cache->c_list_lock);
if (!list_empty(&entry->e_list)) {
list_del_init(&entry->e_list);
- cache->c_entry_count--;
+ if (!WARN_ONCE(cache->c_entry_count == 0,
+ "mbcache: attempt to decrement c_entry_count past zero"))
+ cache->c_entry_count--;
atomic_dec(&entry->e_refcnt);
}
spin_unlock(&cache->c_list_lock);
prev parent reply other threads:[~2018-01-10 4:58 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
2018-01-11 9:04 ` Jan Kara
2018-01-10 4:58 ` Theodore Ts'o [this message]
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=20180110045812.GD5809@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 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.