public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: Alexander Beregalov <a.beregalov@gmail.com>, xfs@oss.sgi.com
Subject: Re: [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents
Date: Thu, 07 May 2009 19:45:36 -0500	[thread overview]
Message-ID: <4A0380B0.1050101@sandeen.net> (raw)
In-Reply-To: <20090126073200.459094000@bombadil.infradead.org>

Christoph Hellwig wrote:

> Use multiple lables for proper error unwinding and get rid of some now
> superflous variables.
>
>
> Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Problem in this patch, I think, getting hangs on x86 fsr...

> Index: xfs/fs/xfs/xfs_dfrag.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_dfrag.c	2008-12-19 15:02:54.003908425 +0100
> +++ xfs/fs/xfs/xfs_dfrag.c	2008-12-22 15:59:55.013247371 +0100
<snip>
> @@ -352,19 +344,19 @@ xfs_swap_extents(
>  	 * If this is a synchronous mount, make sure that the
>  	 * transaction goes to disk before returning to the user.
>  	 */
> -	if (mp->m_flags & XFS_MOUNT_WSYNC) {
> +	if (mp->m_flags & XFS_MOUNT_WSYNC)
>  		xfs_trans_set_sync(tp);
> -	}
>  
>  	error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
> -	locked = 0;

old code said "unlocked" here thanks to the trans commit ...

> - error0:
> -	if (locked) {
> -		xfs_iunlock(ip,  lock_flags);
> -		xfs_iunlock(tip, lock_flags);
> -	}
and so we wouldn't unlock again ...
> -	if (tempifp != NULL)
> -		kmem_free(tempifp);
> +out_unlock:
> +	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
> +	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);

But now we do it unconditionally, and ruh-roh.

> +out:
> +	kmem_free(tempifp);
>  	return error;
> +
> +out_trans_cancel:
> +	xfs_trans_cancel(tp, 0);
> +	goto out_unlock;
>  }

Is this too ugly a fix?

XFS: Fix double unlock of inodes in xfs_swap_extents()

commit ef8f7fc549bf345d92f396f5aa7b152b4969cbf7 had an error
where we would try to re-unlock the inodes after they had been
committed in the transaction; this double unlock caused a

=====================================
[ BUG: bad unlock balance detected! ]
-------------------------------------
xfs_fsr/1459 is trying to release lock (&(&ip->i_iolock)->mr_lock) at:
[<e248dedb>] xfs_iunlock+0x2c/0x92 [xfs]
but there are no more locks to release!

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

Index: linux-2.6/fs/xfs/xfs_dfrag.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_dfrag.c
+++ linux-2.6/fs/xfs/xfs_dfrag.c
@@ -347,13 +347,15 @@ xfs_swap_extents(
 
 	error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
 
-out_unlock:
-	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
-	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 out:
 	kmem_free(tempifp);
 	return error;
 
+out_unlock:
+	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+	goto out;
+
 out_trans_cancel:
 	xfs_trans_cancel(tp, 0);
 	goto out_unlock;


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

  parent reply	other threads:[~2009-05-08  0:45 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
2009-01-26  7:31 ` [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs: Christoph Hellwig
2009-01-26 21:39   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path Christoph Hellwig
2009-01-26 22:02   ` Felix Blyakher
2009-01-28 20:24   ` Martin Steigerwald
2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
2009-01-26  7:55   ` Christoph Hellwig
2009-01-27  0:27     ` [PATCH] xfs: cleanup error " Josef 'Jeff' Sipek
2009-01-28 20:25       ` Martin Steigerwald
2009-01-26 22:13   ` [PATCH 03/17] xfs: cleanup " Felix Blyakher
2009-05-08  0:45   ` Eric Sandeen [this message]
2009-01-26  7:31 ` [PATCH 04/17] xfs: tiny cleanup for xfs_link Christoph Hellwig
2009-01-26 22:23   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK Christoph Hellwig
2009-01-26 23:43   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 06/17] xfs: remove iclog calculation special cases Christoph Hellwig
2009-02-09  2:15   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 07/17] xfs: remove superflous inobt macros Christoph Hellwig
2009-02-09  2:16   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types Christoph Hellwig
2009-02-09  2:18   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 09/17] xfs: cleanup xfs_find_handle Christoph Hellwig
2009-02-06  5:20   ` Felix Blyakher
2009-02-06  7:17     ` Christoph Hellwig
2009-02-06 20:31       ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 10/17] xfs: factor out attr fork reset handling Christoph Hellwig
2009-01-27 16:53   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
2009-01-27 17:37   ` Felix Blyakher
2009-02-01  0:54   ` Dave Chinner
2009-02-15  6:42   ` Dave Chinner
2009-02-15 20:13     ` Christoph Hellwig
2009-02-16  3:06       ` Dave Chinner
2009-01-26  7:31 ` [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create Christoph Hellwig
2009-02-09  2:28   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation Christoph Hellwig
2009-02-09  2:41   ` Dave Chinner
2009-02-09  7:46     ` Christoph Hellwig
2009-05-13  8:11   ` Christoph Hellwig
2009-01-26  7:31 ` [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag Christoph Hellwig
2009-02-08  0:35   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE Christoph Hellwig
2009-02-09  2:42   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED Christoph Hellwig
2009-02-09  2:42   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 17/17] xfs: sanitize qh_lock wrappers Christoph Hellwig
2009-02-09  2:45   ` Dave Chinner
2009-02-04 19:37 ` [PATCH 00/17] 2.6.30 queue Christoph Hellwig
2009-02-08 21:12   ` 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=4A0380B0.1050101@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=a.beregalov@gmail.com \
    --cc=hch@infradead.org \
    --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