diff options
author | Vasily Averin <vvs@sw.ru> | 2006-10-28 13:38:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-28 14:30:53 -0400 |
commit | 6eac3f93f5e6b7256fb20b7608d62ec192da12be (patch) | |
tree | a829571b473072fb764e179499a8610789ba284e | |
parent | ebed4bfc8da8df5b6b0bc4a5064a949f04683509 (diff) |
[PATCH] missing unused dentry in prune_dcache()?
On the the following patch:
http://linux.bkbits.net:8080/linux-2.6/gnupatch@449b144ecSF1rYskg3q-SeR2vf88zg
# ChangeSet
# 2006/06/22 15:05:57-07:00 neilb@suse.de
# [PATCH] Fix dcache race during umount
# If prune_dcache finds a dentry that it cannot free, it leaves it where it
# is (at the tail of the list) and exits, on the assumption that some other
# thread will be removing that dentry soon.
However as far as I see this comment is not correct: when we cannot take
s_umount rw_semaphore (for example because it was taken in do_remount) this
dentry is already extracted from dentry_unused list and we do not add it
into the list again. Therefore dentry will not be found by prune_dcache()
and shrink_dcache_sb() and will leave in memory very long time until the
partition will be unmounted.
The patch adds this dentry into tail of the dentry_unused list.
Signed-off-by: Vasily Averin <vvs@sw.ru>
Cc: Neil Brown <neilb@suse.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/dcache.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index a1ff91eef108..a5b76b647c6d 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -478,11 +478,12 @@ static void prune_dcache(int count, struct super_block *sb) | |||
478 | up_read(s_umount); | 478 | up_read(s_umount); |
479 | } | 479 | } |
480 | spin_unlock(&dentry->d_lock); | 480 | spin_unlock(&dentry->d_lock); |
481 | /* Cannot remove the first dentry, and it isn't appropriate | 481 | /* |
482 | * to move it to the head of the list, so give up, and try | 482 | * Insert dentry at the head of the list as inserting at the |
483 | * later | 483 | * tail leads to a cycle. |
484 | */ | 484 | */ |
485 | break; | 485 | list_add(&dentry->d_lru, &dentry_unused); |
486 | dentry_stat.nr_unused++; | ||
486 | } | 487 | } |
487 | spin_unlock(&dcache_lock); | 488 | spin_unlock(&dcache_lock); |
488 | } | 489 | } |