mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, reiserfs-devel@vger.kernel.org,
	Jeff Mahoney <jeffm@suse.com>, Jan Kara <jack@suse.cz>
Subject: [08/20] reiserfs: Force inode evictions before umount to avoid crash
Date: Tue, 10 Jan 2012 12:06:59 -0800	[thread overview]
Message-ID: <20120110200850.467676402@clark.kroah.org> (raw)
In-Reply-To: <20120110200902.GA5674@kroah.com>

2.6.32-longterm review patch.  If anyone has any objections, please let me know.

------------------

From: Jeff Mahoney <jeffm@suse.com>

commit a9e36da655e54545c3289b2a0700b5c443de0edd upstream.

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
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 fs/reiserfs/super.c |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -445,16 +445,20 @@ int remove_save_link(struct inode *inode
 static void reiserfs_kill_sb(struct super_block *s)
 {
 	if (REISERFS_SB(s)) {
-		if (REISERFS_SB(s)->xattr_root) {
-			d_invalidate(REISERFS_SB(s)->xattr_root);
-			dput(REISERFS_SB(s)->xattr_root);
-			REISERFS_SB(s)->xattr_root = NULL;
-		}
-		if (REISERFS_SB(s)->priv_root) {
-			d_invalidate(REISERFS_SB(s)->priv_root);
-			dput(REISERFS_SB(s)->priv_root);
-			REISERFS_SB(s)->priv_root = NULL;
-		}
+		/*
+		 * Force any pending inode evictions to occur now. Any
+		 * inodes to be removed that have extended attributes
+		 * associated with them need to clean them up before
+		 * we can release the extended attribute root dentries.
+		 * shrink_dcache_for_umount will BUG if we don't release
+		 * those before it's called so ->put_super is too late.
+		 */
+		shrink_dcache_sb(s);
+
+		dput(REISERFS_SB(s)->xattr_root);
+		REISERFS_SB(s)->xattr_root = NULL;
+		dput(REISERFS_SB(s)->priv_root);
+		REISERFS_SB(s)->priv_root = NULL;
 	}
 
 	kill_block_super(s);



  parent reply	other threads:[~2012-01-10 20:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-10 20:09 [00/20] 2.6.32.54-longterm review Greg KH
2012-01-10 20:06 ` [01/20] MAINTAINERS: stable: Update address Greg KH
2012-01-10 20:06 ` [02/20] Documentation: Update stable address Greg KH
2012-01-10 20:06 ` [03/20] firmware: Fix an oops on reading fw_priv->fw in sysfs loading file Greg KH
2012-01-10 20:06 ` [04/20] offb: Fix setting of the pseudo-palette for >8bpp Greg KH
2012-01-10 20:06 ` [05/20] offb: Fix bug in calculating requested vram size Greg KH
2012-01-10 20:06 ` [06/20] asix: new device id Greg KH
2012-01-10 20:06 ` [07/20] reiserfs: Fix quota mount option parsing Greg KH
2012-01-10 20:06 ` Greg KH [this message]
2012-01-10 20:07 ` [09/20] USB: update documentation for usbmon Greg KH
2012-01-10 20:07 ` [10/20] drivers/usb/class/cdc-acm.c: clear dangling pointer Greg KH
2012-01-10 20:07 ` [11/20] USB: isight: fix kernel bug when loading firmware Greg KH
2012-01-10 20:07 ` [12/20] usb: usb-storage doesnt support dynamic id currently, the patch disables the feature to fix an oops Greg KH
2012-01-10 20:07 ` [13/20] USB: add quirk for another camera Greg KH
2012-01-10 20:07 ` [14/20] USB: omninet: fix write_room Greg KH
2012-01-10 20:07 ` [15/20] USB: Add USB-ID for Multiplex RC serial adapter to cp210x.c Greg KH
2012-01-10 20:07 ` [16/20] asix: fix infinite loop in rx_fixup() Greg KH
2012-01-10 20:07 ` [17/20] PM / Sleep: Fix race between CPU hotplug and freezer Greg KH
2012-01-10 20:07 ` [18/20] SCSI: scsi_dh: check queuedata pointer before proceeding further Greg KH
2012-01-10 20:07 ` [19/20] xfs: validate acl count Greg KH
2012-01-10 20:07 ` [20/20] xfs: fix acl count validation in xfs_acl_from_disk() Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120110200850.467676402@clark.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jack@suse.cz \
    --cc=jeffm@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®