From: Brian Foster <bfoster@redhat.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: spruce-project@linuxtesting.org, linux-kernel@vger.kernel.org,
xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: fix deadlock on failure path in xfs_setattr_nonsize()
Date: Thu, 16 Oct 2014 08:40:48 -0400 [thread overview]
Message-ID: <20141016124047.GA42623@bfoster.bfoster> (raw)
In-Reply-To: <1413408168-3086-1-git-send-email-khoroshilov@ispras.ru>
On Wed, Oct 15, 2014 at 11:22:48PM +0200, Alexey Khoroshilov wrote:
> If xfs_trans_reserve() fails, xfs_setattr_nonsize() does not deallocate
> the transaction and does not release "freeze" lock. That leads to the
> following warning from lockdep:
> [ BUG: lock held when returning to user space! ]
> ------------------------------------------------
> fs-driver-tests/7127 is leaving the kernel with locks still held!
> 1 lock held by fs-driver-tests/7127:
> #0: (sb_internal){.+.+.+}, at: [<ffffffffa0389a44>] xfs_trans_alloc+0x24/0x40 [xfs]
>
> The patch adds xfs_trans_cancel() on the failure path.
>
> Found by Linux File System Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
Looks good, thanks for the patch.
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/xfs_iops.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 72129493e9d3..e2e785eec831 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -599,8 +599,10 @@ xfs_setattr_nonsize(
>
> tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
> error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
> - if (error)
> + if (error) {
> + xfs_trans_cancel(tp, 0);
> goto out_dqrele;
> + }
>
> xfs_ilock(ip, XFS_ILOCK_EXCL);
>
> --
> 1.9.1
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
WARNING: multiple messages have this Message-ID (diff)
From: Brian Foster <bfoster@redhat.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Dave Chinner <david@fromorbit.com>,
xfs@oss.sgi.com, linux-kernel@vger.kernel.org,
spruce-project@linuxtesting.org
Subject: Re: [PATCH] xfs: fix deadlock on failure path in xfs_setattr_nonsize()
Date: Thu, 16 Oct 2014 08:40:48 -0400 [thread overview]
Message-ID: <20141016124047.GA42623@bfoster.bfoster> (raw)
In-Reply-To: <1413408168-3086-1-git-send-email-khoroshilov@ispras.ru>
On Wed, Oct 15, 2014 at 11:22:48PM +0200, Alexey Khoroshilov wrote:
> If xfs_trans_reserve() fails, xfs_setattr_nonsize() does not deallocate
> the transaction and does not release "freeze" lock. That leads to the
> following warning from lockdep:
> [ BUG: lock held when returning to user space! ]
> ------------------------------------------------
> fs-driver-tests/7127 is leaving the kernel with locks still held!
> 1 lock held by fs-driver-tests/7127:
> #0: (sb_internal){.+.+.+}, at: [<ffffffffa0389a44>] xfs_trans_alloc+0x24/0x40 [xfs]
>
> The patch adds xfs_trans_cancel() on the failure path.
>
> Found by Linux File System Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
Looks good, thanks for the patch.
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/xfs_iops.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 72129493e9d3..e2e785eec831 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -599,8 +599,10 @@ xfs_setattr_nonsize(
>
> tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
> error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
> - if (error)
> + if (error) {
> + xfs_trans_cancel(tp, 0);
> goto out_dqrele;
> + }
>
> xfs_ilock(ip, XFS_ILOCK_EXCL);
>
> --
> 1.9.1
>
next prev parent reply other threads:[~2014-10-16 12:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 21:22 [PATCH] xfs: fix deadlock on failure path in xfs_setattr_nonsize() Alexey Khoroshilov
2014-10-16 12:40 ` Brian Foster [this message]
2014-10-16 12:40 ` Brian Foster
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=20141016124047.GA42623@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=khoroshilov@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=spruce-project@linuxtesting.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 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.