All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lachlan McIlroy <lachlan@sgi.com>
To: xfs-dev <xfs-dev@sgi.com>, xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH V2] Unlock inode before calling xfs_idestroy()
Date: Mon, 22 Sep 2008 15:08:52 +1000	[thread overview]
Message-ID: <48D72864.2020604@sgi.com> (raw)

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;

             reply	other threads:[~2008-09-22  4:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22  5:08 Lachlan McIlroy [this message]
2008-09-22  7:51 ` [PATCH V2] Unlock inode before calling xfs_idestroy() Christoph Hellwig

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=48D72864.2020604@sgi.com \
    --to=lachlan@sgi.com \
    --cc=xfs-dev@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.