diff options
author | David Woodhouse <dwmw2@infradead.org> | 2005-02-27 18:01:36 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-05-23 06:46:14 -0400 |
commit | 67e345d17ff8c2085a54c293001ae548f7be7b21 (patch) | |
tree | 07f2829e98c22c5d1edd8832a06a11cbdde85f24 /fs/jffs2/nodelist.c | |
parent | 002fa30170f9500ac31fa22931c689029af7f27b (diff) |
[JFFS2] Prevent ino cache removal for inodes in use
Don't remove inocache for inodes which are in read_inode() or
clear_inode() until they're done.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/nodelist.c')
-rw-r--r-- | fs/jffs2/nodelist.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index 3c6d93c8ea0a..b835a8652623 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: nodelist.c,v 1.92 2005/01/19 19:22:00 tpoynor Exp $ | 10 | * $Id: nodelist.c,v 1.93 2005/02/27 23:01:32 dwmw2 Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -506,7 +506,7 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new | |||
506 | void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) | 506 | void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) |
507 | { | 507 | { |
508 | struct jffs2_inode_cache **prev; | 508 | struct jffs2_inode_cache **prev; |
509 | D2(printk(KERN_DEBUG "jffs2_del_ino_cache: Del %p (ino #%u)\n", old, old->ino)); | 509 | D1(printk(KERN_DEBUG "jffs2_del_ino_cache: Del %p (ino #%u)\n", old, old->ino)); |
510 | spin_lock(&c->inocache_lock); | 510 | spin_lock(&c->inocache_lock); |
511 | 511 | ||
512 | prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; | 512 | prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; |
@@ -518,6 +518,14 @@ void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) | |||
518 | *prev = old->next; | 518 | *prev = old->next; |
519 | } | 519 | } |
520 | 520 | ||
521 | /* Free it now unless it's in READING or CLEARING state, which | ||
522 | are the transitions upon read_inode() and clear_inode(). The | ||
523 | rest of the time we know nobody else is looking at it, and | ||
524 | if it's held by read_inode() or clear_inode() they'll free it | ||
525 | for themselves. */ | ||
526 | if (old->state != INO_STATE_READING && old->state != INO_STATE_CLEARING) | ||
527 | jffs2_free_inode_cache(old); | ||
528 | |||
521 | spin_unlock(&c->inocache_lock); | 529 | spin_unlock(&c->inocache_lock); |
522 | } | 530 | } |
523 | 531 | ||
@@ -530,7 +538,6 @@ void jffs2_free_ino_caches(struct jffs2_sb_info *c) | |||
530 | this = c->inocache_list[i]; | 538 | this = c->inocache_list[i]; |
531 | while (this) { | 539 | while (this) { |
532 | next = this->next; | 540 | next = this->next; |
533 | D2(printk(KERN_DEBUG "jffs2_free_ino_caches: Freeing ino #%u at %p\n", this->ino, this)); | ||
534 | jffs2_free_inode_cache(this); | 541 | jffs2_free_inode_cache(this); |
535 | this = next; | 542 | this = next; |
536 | } | 543 | } |