From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Rainer Weikusat <rweikusat@mobileactivedefense.com>,
David Miller <davem@davemloft.net>,
dvyukov@google.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk
Subject: Re: [PATCH] af_unix: Fix splice-bind deadlock
Date: Wed, 06 Jan 2016 14:45:55 +0000 [thread overview]
Message-ID: <87ziwizrz0.fsf@doppelsaurus.mobileactivedefense.com> (raw)
In-Reply-To: <1451949906.2606240.482870994.43973946@webmail.messagingengine.com> (Hannes Frederic Sowa's message of "Tue, 05 Jan 2016 00:25:06 +0100")
Hannes Frederic Sowa <hannes@stressinduktion.org> writes:
> On Sun, Jan 3, 2016, at 19:03, Rainer Weikusat wrote:
[reorder i_mutex and readlock locking]
> I was concerned because of the comment in skb_socket_splice:
>
> /* Drop the socket lock, otherwise we have reverse
> * locking dependencies between sk_lock and i_mutex
> * here as compared to sendfile(). We enter here
> * with the socket lock held, and splice_to_pipe() will
> * grab the pipe inode lock. For sendfile() emulation,
> * we call into ->sendpage() with the i_mutex lock held
> * and networking will grab the socket lock.
> */
AFAICT, this comment is "a bit misleading": sendfile (from file to
socket) is internally implemented as 'splice from file to pipe' +
'splice from pipe to socket'. The later acquires the pipe lock of the
pipe and then invokes the sendpage method of the socket which acquires
the appropiate socket lock (for an AF_UNIX socket, it's
u->readlock). But 'pipe lock' and 'i_mutex' are two completely
different things: The former is the mutex in a struct pipe_inode_info
(pipe_fs_u.h), the latter is the i_mutex in a struct inode (fs.h).
"Code explains comment" :-)
next prev parent reply other threads:[~2016-01-06 14:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-27 20:13 [PATCH] af_unix: Fix splice-bind deadlock Rainer Weikusat
2015-12-29 10:58 ` Hannes Frederic Sowa
2015-12-31 19:36 ` Rainer Weikusat
2016-01-03 18:03 ` Rainer Weikusat
2016-01-04 23:25 ` Hannes Frederic Sowa
2016-01-06 14:45 ` Rainer Weikusat [this message]
2016-01-03 18:04 ` Rainer Weikusat
2016-01-03 18:56 ` Rainer Weikusat
2016-01-05 4:23 ` David Miller
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=87ziwizrz0.fsf@doppelsaurus.mobileactivedefense.com \
--to=rweikusat@mobileactivedefense.com \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=hannes@stressinduktion.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).