xfs
[Top] [All Lists]

Re: Rambling noise #1: generic/230 can trigger kernel debug lock detecto

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: Rambling noise #1: generic/230 can trigger kernel debug lock detector
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Thu, 09 May 2013 10:57:21 -0500
Cc: "Michael L. Semon" <mlsemon35@xxxxxxxxx>, "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130509031646.GN24635@dastard>
References: <518B08D9.1060906@xxxxxxxxx> <20130509031646.GN24635@dastard>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 05/08/13 22:16, Dave Chinner wrote:
xfs: avoid nesting transactions in xfs_qm_scall_setqlim()

From: Dave Chinner<dchinner@xxxxxxxxxx>

Lockdep reports:

=============================================
[ INFO: possible recursive locking detected ]
3.9.0+ #3 Not tainted
---------------------------------------------
setquota/28368 is trying to acquire lock:
  (sb_internal){++++.?}, at: [<c11e8846>] xfs_trans_alloc+0x26/0x50

but task is already holding lock:
  (sb_internal){++++.?}, at: [<c11e8846>] xfs_trans_alloc+0x26/0x50

from xfs_qm_scall_setqlim()->xfs_dqread() when a dquot needs to be
allocated.

xfs_qm_scall_setqlim() is starting a transaction and then not
passing it into xfs_qm_dqet() and so it starts it's own transaction
when allocating the dquot.  Splat!

Fix this by not allocating the dquot in xfs_qm_scall_setqlim()
inside the setqlim transaction. This requires getting the dquot
first (and allocating it if necessary) then dropping and relocking
the dquot before joining it to the setqlim transaction.

Reported-by: Michael L. Semon<mlsemon35@xxxxxxxxx>
Signed-off-by: Dave Chinner<dchinner@xxxxxxxxxx>
---
  fs/xfs/xfs_qm_syscalls.c |   35 ++++++++++++++++++++---------------
  1 file changed, 20 insertions(+), 15 deletions(-)

Looks good.

Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>