From: Balbir Singh <balbir@in.ibm.com>
To: Jan Blunck <jblunck@suse.de>
Cc: Neil Brown <neilb@suse.de>, Kirill Korotaev <dev@openvz.org>,
akpm@osdl.org, viro@zeniv.linux.org.uk, olh@suse.de,
bsingharora@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix shrink_dcache_parent() against shrink_dcache_memory() race (3rd updated patch)]
Date: Fri, 10 Mar 2006 22:47:38 +0530 [thread overview]
Message-ID: <20060310171738.GA18687@in.ibm.com> (raw)
In-Reply-To: <20060310123153.GN4243@hasse.suse.de>
On Fri, Mar 10, 2006 at 01:31:53PM +0100, Jan Blunck wrote:
> On Fri, Mar 10, Neil Brown wrote:
>
> > -static void prune_dcache(int count)
> > +static void prune_dcache(int count, struct super_block *sb)
> > {
> > spin_lock(&dcache_lock);
> > for (; count ; count--) {
> > @@ -417,8 +425,10 @@ static void prune_dcache(int count)
> > spin_unlock(&dentry->d_lock);
> > continue;
> > }
> > - /* If the dentry was recently referenced, don't free it. */
> > - if (dentry->d_flags & DCACHE_REFERENCED) {
> > + /* If the dentry was recently referenced, or is for
> > + * a unmounting filesystem, don't free it. */
> > + if ((dentry->d_flags & DCACHE_REFERENCED) ||
> > + (dentry->d_sb != sb && dentry->d_sb->s_root == NULL)) {
> > dentry->d_flags &= ~DCACHE_REFERENCED;
> > list_add(&dentry->d_lru, &dentry_unused);
> > dentry_stat.nr_unused++;
>
> You have to down_read the rw-semaphore sb->s_umount since sb->s_root is
> protected by it :(
<snip>
Please do not beat me up for suggesting this. I was wondering if it
makes sense to add a PF_SHRINKER flag and set it in shrink_slab().
Use my solution, instead of PF_MEMALLOC check against PF_SHRINKER.
I think PF_SHRINKER might be a good idea, it might help us detect
races between the shrinker and other subsystems too - not only dcache.
It might be well worth adding in. If there is sufficient interest I can
send create and send out a patch.
Balbir
next prev parent reply other threads:[~2006-03-10 17:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-09 16:58 [PATCH] Fix shrink_dcache_parent() against shrink_dcache_memory() race (3rd updated patch)] Jan Blunck
2006-03-09 17:07 ` Kirill Korotaev
2006-03-10 5:09 ` Neil Brown
2006-03-10 8:28 ` Kirill Korotaev
2006-03-10 10:59 ` Jan Blunck
2006-03-10 11:23 ` Kirill Korotaev
2006-03-10 11:56 ` Neil Brown
2006-03-10 12:02 ` Jan Blunck
2006-03-10 12:19 ` Kirill Korotaev
2006-03-10 11:51 ` Neil Brown
2006-03-10 12:31 ` Jan Blunck
2006-03-10 17:17 ` Balbir Singh [this message]
2006-03-12 21:57 ` Neil Brown
2006-03-12 23:03 ` Jan Blunck
2006-03-13 5:45 ` Neil Brown
2006-03-13 15:52 ` Balbir Singh
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=20060310171738.GA18687@in.ibm.com \
--to=balbir@in.ibm.com \
--cc=akpm@osdl.org \
--cc=bsingharora@gmail.com \
--cc=dev@openvz.org \
--cc=jblunck@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=olh@suse.de \
--cc=viro@zeniv.linux.org.uk \
/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