lkml.org 
[lkml]   [2006]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] shrink_dcache_parent() races against shrink_dcache_memory()
On Mon, Jan 23, Kirill Korotaev wrote:

>
> 1. this patch doesn't fix the whole problem. iput() after sb free is
> still possible. So busy inodes after umount too.
> 2. it has big problems with locking...
>

Yes, you're right. I'll fix that and send an updated version.

> >+ goto repeat;
> <<<< I would prefer to have "goto repeat" as it was before...
> >+ /* out */
> >+ }

Fair.

> >+ if (atomic_add_unless(&dentry->d_count, -1, 1))
> >+ return;
> <<<< I would better introduce __dput_locked() w/o atomic_dec_and_test()
> instead of using this atomic_add_unless()...
> <<<< For me it looks like an obfuscation of a code, which must be clean
> and tidy.

Then it isn't dput_locked() anymore and you have to manually dereference
before you use __dput_locked(). Doesn't sound better. I'll give it a try ...

> >+
> >+ spin_lock(&dcache_lock);
> >+ dput_locked(dentry, &free_list);
> >+ spin_unlock(&dcache_lock);
> >+
> <<<< 1. locking here is totally broken... spin_unlock() in dentry_iput()

Yes, I totally missed the locking issue here. I'll rework that one.

> <<<< 2. it doesn't help the situation I wrote to you,
> <<<< since iput() can be done on inode _after_ sb freeing...

Hmm, will think about that one again. shrink_dcache_parent() and
shrink_dcache_memory()/dput() are not racing against each other now since the
reference counting is done before giving up dcache_lock and the select_parent
could start.

Regards,
Jan

--
Jan Blunck jblunck@suse.de
SuSE LINUX AG - A Novell company
Maxfeldstr. 5 +49-911-74053-608
D-90409 Nürnberg http://www.suse.de
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-23 17:00    [W:0.111 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site