public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Lachlan McIlroy <lachlan@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs-oss <xfs@oss.sgi.com>, xfs-dev <xfs-dev@sgi.com>
Subject: Re: [PATCH] Unlock inode before calling xfs_idestroy()
Date: Mon, 22 Sep 2008 13:57:11 +1000	[thread overview]
Message-ID: <48D71797.6090407@sgi.com> (raw)
In-Reply-To: <20080919072603.GA26903@infradead.org>

Christoph Hellwig wrote:
> On Fri, Sep 19, 2008 at 01:15:08PM +1000, Lachlan McIlroy wrote:
>> Lock debugging reported the ilock was being destroyed
>> without being unlocked.
>>
>> --- a/fs/xfs/xfs_iget.c	2008-09-19 13:03:57.000000000 +1000
>> +++ b/fs/xfs/xfs_iget.c	2008-09-19 13:12:38.000000000 +1000
>> @@ -214,6 +214,7 @@ finish_inode:
>> 		xfs_ilock(ip, lock_flags);
>>
>> 	if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) {
>> +		xfs_iunlock(ip, lock_flags);
>> 		xfs_idestroy(ip);
>> 		xfs_put_perag(mp, pag);
>> 		return ENOENT;
>> @@ -224,6 +225,7 @@ finish_inode:
>> 	 * write spinlock.
>> 	 */
>> 	if (radix_tree_preload(GFP_KERNEL)) {
>> +		xfs_iunlock(ip, lock_flags);
>> 		xfs_idestroy(ip);
>> 		delay(1);
>> 		goto again;
> 
> Just move the xfs_ilock call after these two statements, there is no
> need to have it locked before inserting it into the radix tree.
Okay, thanks.  I thought we may need it locked while doing the mode
check so I left it as is.

> 
>> @@ -239,6 +241,7 @@ finish_inode:
>> 		BUG_ON(error != -EEXIST);
>> 		write_unlock(&pag->pag_ici_lock);
>> 		radix_tree_preload_end();
>> +		xfs_iunlock(ip, lock_flags);
>> 		xfs_idestroy(ip);
>> 		XFS_STATS_INC(xs_ig_dup);
>> 		goto again;
> 
> But here we still need the fix.  But as Tim mention we need to check
> for lock_flags != 0 first.  Long-term it might make sense to just make
> xfs_iunlock a no-op if lock_flags == 0, but let's do that separately.
> 

  reply	other threads:[~2008-09-22  3:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19  3:15 [PATCH] Unlock inode before calling xfs_idestroy() Lachlan McIlroy
2008-09-19  4:12 ` Timothy Shimmin
2008-09-22  3:52   ` Lachlan McIlroy
2008-09-19  7:26 ` Christoph Hellwig
2008-09-22  3:57   ` Lachlan McIlroy [this message]
2008-09-20  7:01 ` Dave Chinner
2008-09-22  3:59   ` Lachlan McIlroy

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=48D71797.6090407@sgi.com \
    --to=lachlan@sgi.com \
    --cc=hch@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox