public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] Unlock inode before calling xfs_idestroy()
@ 2008-09-22  5:08 Lachlan McIlroy
  2008-09-22  7:51 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Lachlan McIlroy @ 2008-09-22  5:08 UTC (permalink / raw)
  To: xfs-dev, xfs-oss

Lock debugging reported the ilock was being destroyed without being
unlocked.  We don't need to lock the inode until we are going to
insert it into the radix tree.

--- a/fs/xfs/xfs_iget.c	2008-09-22 14:55:20.000000000 +1000
+++ b/fs/xfs/xfs_iget.c	2008-09-22 13:56:33.000000000 +1000
@@ -210,9 +210,6 @@ finish_inode:
 
 	xfs_itrace_exit_tag(ip, "xfs_iget.alloc");
 
-	if (lock_flags)
-		xfs_ilock(ip, lock_flags);
-
 	if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) {
 		xfs_idestroy(ip);
 		xfs_put_perag(mp, pag);
@@ -228,6 +225,10 @@ finish_inode:
 		delay(1);
 		goto again;
 	}
+
+	if (lock_flags)
+		xfs_ilock(ip, lock_flags);
+
 	mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1);
 	first_index = agino & mask;
 	write_lock(&pag->pag_ici_lock);
@@ -239,6 +240,8 @@ finish_inode:
 		BUG_ON(error != -EEXIST);
 		write_unlock(&pag->pag_ici_lock);
 		radix_tree_preload_end();
+		if (lock_flags)
+			xfs_iunlock(ip, lock_flags);
 		xfs_idestroy(ip);
 		XFS_STATS_INC(xs_ig_dup);
 		goto again;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-22  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22  5:08 [PATCH V2] Unlock inode before calling xfs_idestroy() Lachlan McIlroy
2008-09-22  7:51 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox