public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 3/5] xfs: asserting lock not held during freeing not valid
Date: Tue, 24 Sep 2013 16:01:14 +1000	[thread overview]
Message-ID: <1380002476-18839-4-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1380002476-18839-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

When we free an inode, we do so via RCU. As an RCU lookup can occur
at any time before we free an inode, and that lookup takes the inode
flags lock, we cannot safely assert that the flags lock is not held
just before marking it dead and running call_rcu() to free the
inode.

We check on allocation of a new inode structre that the lock is not
held, so we still have protection against locks being leaked and
hence not correctly initialised when allocated out of the slab.
Hence just remove the assert...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_icache.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 193206b..474807a 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -119,11 +119,6 @@ xfs_inode_free(
 		ip->i_itemp = NULL;
 	}
 
-	/* asserts to verify all state is correct here */
-	ASSERT(atomic_read(&ip->i_pincount) == 0);
-	ASSERT(!spin_is_locked(&ip->i_flags_lock));
-	ASSERT(!xfs_isiflocked(ip));
-
 	/*
 	 * Because we use RCU freeing we need to ensure the inode always
 	 * appears to be reclaimed with an invalid inode number when in the
@@ -135,6 +130,10 @@ xfs_inode_free(
 	ip->i_ino = 0;
 	spin_unlock(&ip->i_flags_lock);
 
+	/* asserts to verify all state is correct here */
+	ASSERT(atomic_read(&ip->i_pincount) == 0);
+	ASSERT(!xfs_isiflocked(ip));
+
 	call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback);
 }
 
-- 
1.8.3.2

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-09-24  6:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24  6:01 [PATCH 0/5] xfs: fixes for 3.12-rc3 Dave Chinner
2013-09-24  6:01 ` [PATCH 1/5] xfs: don't try to mark uncached buffers stale on error Dave Chinner
2013-09-24 15:31   ` Mark Tinguely
2013-09-24 15:33   ` Ben Myers
2013-09-24 20:32     ` Dave Chinner
2013-09-24 20:59       ` Ben Myers
2013-09-25  0:31         ` Dave Chinner
2013-09-24  6:01 ` [PATCH 2/5] xfs: lock the AIL before removing the buffer item Dave Chinner
2013-09-24 16:12   ` Mark Tinguely
2013-09-24  6:01 ` Dave Chinner [this message]
2013-09-24 17:17   ` [PATCH 3/5] xfs: asserting lock not held during freeing not valid Mark Tinguely
2013-09-24  6:01 ` [PATCH 4/5] xfs: fix XFS_IOC_FREE_EOFBLOCKS definition Dave Chinner
2013-09-24 16:13   ` Mark Tinguely
2013-09-24  6:01 ` [PATCH 5/5] xfs: log recovery lsn ordering needs uuid check Dave Chinner
2013-09-24 17:14   ` Ben Myers
2013-09-24 17:46 ` [PATCH 0/5] xfs: fixes for 3.12-rc3 Ben Myers

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=1380002476-18839-4-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /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