diff options
author | Jeff Mahoney <jeffm@suse.com> | 2011-12-21 15:18:43 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-01-09 07:52:09 -0500 |
commit | a9e36da655e54545c3289b2a0700b5c443de0edd (patch) | |
tree | 14143a3c873177b70b8b66d6f8085378a2c92908 /fs/reiserfs | |
parent | a06d789b424190e9f59da391681f908486db2554 (diff) |
reiserfs: Force inode evictions before umount to avoid crash
This patch fixes a crash in reiserfs_delete_xattrs during umount.
When shrink_dcache_for_umount clears the dcache from
generic_shutdown_super, delayed evictions are forced to disk. If an
evicted inode has extended attributes associated with it, it will
need to walk the xattr tree to locate and remove them.
But since shrink_dcache_for_umount will BUG if it encounters active
dentries, the xattr tree must be released before it's called or it will
crash during every umount.
This patch forces the evictions to occur before generic_shutdown_super
by calling shrink_dcache_sb first. The additional evictions caused
by the removal of each associated xattr file and dir will be automatically
handled as they're added to the LRU list.
CC: reiserfs-devel@vger.kernel.org
CC: stable@kernel.org
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/super.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index f9eaa4a4f5f3..5e3527be1146 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -453,16 +453,20 @@ int remove_save_link(struct inode *inode, int truncate) | |||
453 | static void reiserfs_kill_sb(struct super_block *s) | 453 | static void reiserfs_kill_sb(struct super_block *s) |
454 | { | 454 | { |
455 | if (REISERFS_SB(s)) { | 455 | if (REISERFS_SB(s)) { |
456 | if (REISERFS_SB(s)->xattr_root) { | 456 | /* |
457 | d_invalidate(REISERFS_SB(s)->xattr_root); | 457 | * Force any pending inode evictions to occur now. Any |
458 | dput(REISERFS_SB(s)->xattr_root); | 458 | * inodes to be removed that have extended attributes |
459 | REISERFS_SB(s)->xattr_root = NULL; | 459 | * associated with them need to clean them up before |
460 | } | 460 | * we can release the extended attribute root dentries. |
461 | if (REISERFS_SB(s)->priv_root) { | 461 | * shrink_dcache_for_umount will BUG if we don't release |
462 | d_invalidate(REISERFS_SB(s)->priv_root); | 462 | * those before it's called so ->put_super is too late. |
463 | dput(REISERFS_SB(s)->priv_root); | 463 | */ |
464 | REISERFS_SB(s)->priv_root = NULL; | 464 | shrink_dcache_sb(s); |
465 | } | 465 | |
466 | dput(REISERFS_SB(s)->xattr_root); | ||
467 | REISERFS_SB(s)->xattr_root = NULL; | ||
468 | dput(REISERFS_SB(s)->priv_root); | ||
469 | REISERFS_SB(s)->priv_root = NULL; | ||
466 | } | 470 | } |
467 | 471 | ||
468 | kill_block_super(s); | 472 | kill_block_super(s); |