diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-25 20:49:35 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-25 21:27:18 -0400 |
commit | 63997e98a3be68d7cec806d22bf9b02b2e1daabb (patch) | |
tree | acd366273dc459d6b34e7f67216c06eb56117a4a /fs/inode.c | |
parent | 9843b76aae80293f5b5a0e275360627508595ce5 (diff) |
split invalidate_inodes()
Pull removal of fsnotify marks into generic_shutdown_super().
Split umount-time work into a new function - evict_inodes().
Make sure that invalidate_inodes() will be able to cope with
I_FREEING once we change locking in iput().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/fs/inode.c b/fs/inode.c index f6b3b52f1278..a6d60682f0fd 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -478,6 +478,49 @@ static void dispose_list(struct list_head *head) | |||
478 | } | 478 | } |
479 | 479 | ||
480 | /** | 480 | /** |
481 | * evict_inodes - evict all evictable inodes for a superblock | ||
482 | * @sb: superblock to operate on | ||
483 | * | ||
484 | * Make sure that no inodes with zero refcount are retained. This is | ||
485 | * called by superblock shutdown after having MS_ACTIVE flag removed, | ||
486 | * so any inode reaching zero refcount during or after that call will | ||
487 | * be immediately evicted. | ||
488 | */ | ||
489 | void evict_inodes(struct super_block *sb) | ||
490 | { | ||
491 | struct inode *inode, *next; | ||
492 | LIST_HEAD(dispose); | ||
493 | |||
494 | down_write(&iprune_sem); | ||
495 | |||
496 | spin_lock(&inode_lock); | ||
497 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { | ||
498 | if (atomic_read(&inode->i_count)) | ||
499 | continue; | ||
500 | |||
501 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) { | ||
502 | WARN_ON(1); | ||
503 | continue; | ||
504 | } | ||
505 | |||
506 | inode->i_state |= I_FREEING; | ||
507 | |||
508 | /* | ||
509 | * Move the inode off the IO lists and LRU once I_FREEING is | ||
510 | * set so that it won't get moved back on there if it is dirty. | ||
511 | */ | ||
512 | list_move(&inode->i_lru, &dispose); | ||
513 | list_del_init(&inode->i_wb_list); | ||
514 | if (!(inode->i_state & (I_DIRTY | I_SYNC))) | ||
515 | percpu_counter_dec(&nr_inodes_unused); | ||
516 | } | ||
517 | spin_unlock(&inode_lock); | ||
518 | |||
519 | dispose_list(&dispose); | ||
520 | up_write(&iprune_sem); | ||
521 | } | ||
522 | |||
523 | /** | ||
481 | * invalidate_inodes - attempt to free all inodes on a superblock | 524 | * invalidate_inodes - attempt to free all inodes on a superblock |
482 | * @sb: superblock to operate on | 525 | * @sb: superblock to operate on |
483 | * | 526 | * |
@@ -493,9 +536,8 @@ int invalidate_inodes(struct super_block *sb) | |||
493 | down_write(&iprune_sem); | 536 | down_write(&iprune_sem); |
494 | 537 | ||
495 | spin_lock(&inode_lock); | 538 | spin_lock(&inode_lock); |
496 | fsnotify_unmount_inodes(&sb->s_inodes); | ||
497 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { | 539 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { |
498 | if (inode->i_state & I_NEW) | 540 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) |
499 | continue; | 541 | continue; |
500 | if (atomic_read(&inode->i_count)) { | 542 | if (atomic_read(&inode->i_count)) { |
501 | busy = 1; | 543 | busy = 1; |