xfs
[Top] [All Lists]

Re: xfs_file_splice_read: possible circular locking dependency detected

To: CAI Qian <caiqian@xxxxxxxxxx>
Subject: Re: xfs_file_splice_read: possible circular locking dependency detected
From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Sep 2016 11:01:23 -0700
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, Al Viro <viro@xxxxxxxxxxxxxxxxxx>, linux-xfs <linux-xfs@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=VLgthme37PHvZ7cUtGl+DGfNWhnLpw+tNvswynAXw7I=; b=ulmrqInLJ8DXXriL9BMGFVH5n2HI94ZljYApHF5yqYF/jhn41FSvgGAA2uOua5jQMP VX9lqiqeZRnXk+V4+YNLSfvH+kw0kxoZFuYZLh7uuMhZIKJgg11vDei/JW3W4At+hMMY hla/o1N0UJzUQB6CNe2vLdlER0mw1iEsdtfXhLhbHZrdHlOfJYxgGUFEgqFNEX8k/O/x dEKNQJaoU2vY0SNJT6Svz5K0Cssm0Ff4/Cv/CLFtPVU6jZcfjrRANuPo2zkRxozBj4uT 0NJW/8jvlbu9xj2eUjgDwoq7PamnVtVAYrjyLprRF5S+eDN6SBGFBaJkQzM1hwuaiLsZ gq5A==
In-reply-to: <1450936953.949798.1473348551588.JavaMail.zimbra@xxxxxxxxxx>
References: <723420070.1340881.1472835555274.JavaMail.zimbra@xxxxxxxxxx> <1832555471.1341372.1472835736236.JavaMail.zimbra@xxxxxxxxxx> <20160903003919.GI30056@dastard> <1450936953.949798.1473348551588.JavaMail.zimbra@xxxxxxxxxx>
Sender: linus971@xxxxxxxxx
On Thu, Sep 8, 2016 at 8:29 AM, CAI Qian <caiqian@xxxxxxxxxx> wrote:
> Right. FYI, revert the commit below fixes the regression,
>
> 8d02076 : ->splice_write() via ->write_iter()

I guess you didn't actually revert that, because so much else has
changed. So you just tested the pre- and post- state of that commit?

It does look like that commit is just buggy, exactly because XSF was
the only user of -generic_file_splice_write() in order to be able to
do the filesystem locks *before* taking the pipe lock.

Al? I wonder if we could just re-introduce xfs_file_splice_write()
(except with the modern iter-based interface)?

Looking at not holding the pipe lock, that really does seem very bad,
because it would require us to:

 (a) play the ref-count games with each page

 (b) make concurrent splice writers have very subtle semantics

I'm not sure (b) is a big issue, because concurrent splice writers
already have random ordering, but at least right now they'd have
non-overlapping data accesses rather than possibly splicing the same
data twice (and some data not at all).

The basic issue with splice and xfs is that right now our splice
interface *forces*:

 - generic_file_splice_read() when called by a filesystem will take
the filesystem locks *first*, and the pipe lock second (ie
xfs_file_splice_read)

 - iter_file_splice_write() forces the reverse ordering.

So it really is our splice helpers that do things in fundamentally the
wrong order.

Other filesystems don't seem to have that extra filesystem lock that shows this.

Ideas?

             Linus

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