From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 2/2] af_unix: split 'u->readlock' into two: 'iolock' and 'bindlock' Date: Fri, 2 Sep 2016 11:17:18 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Hannes Frederic Sowa , Rainer Weikusat , Eric Dumazet , willy tarreau , Network Development To: "David S. Miller" Return-path: Received: from mail-oi0-f67.google.com ([209.85.218.67]:35458 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754676AbcIBSRU (ORCPT ); Fri, 2 Sep 2016 14:17:20 -0400 Received: by mail-oi0-f67.google.com with SMTP id 2so4996732oif.2 for ; Fri, 02 Sep 2016 11:17:19 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Sep 2, 2016 at 11:13 AM, Linus Torvalds wrote: > > From: Linus Torvalds > Date: Thu, 1 Sep 2016 14:43:53 -0700 > Subject: [PATCH 2/2] af_unix: split 'u->readlock' into two: 'iolock' and 'bindlock' > > Right now we use the 'readlock' both for protecting some of the af_unix > IO path and for making the bind be single-threaded. > > The two are independent, but using the same lock makes for a nasty > deadlock due to ordering with regards to filesystem locking. The bind > locking would want to nest outside the VSF pathname locking, but the IO > locking wants to nest inside some of those same locks. > > We tried to fix this earlier with commit c845acb324aa ("af_unix: Fix > splice-bind deadlock") which moved the readlock inside the vfs locks, > but that caused problems with overlayfs that will then call back into > filesystem routines that take the lock in the wrong order anyway. > > Splitting the locks means that we can go back to having the bind lock be > the outermost lock, and we don't have any deadlocks with lock ordering. > > Acked-by: Rainer Weikusat > Acked-by: Al Viro > Signed-off-by: Linus Torvalds Oh, this was missing a Reported-and-tested-by: CAI Qian who found the new deadlock. There's now *another* lockdep deadlock report by him, but that one has nothing to do with networking. (And neither of these deadlocks will actually deadlock the machine in practice, but you can trigger the lockdep reports with some odd splice patterns and overlayfs use) Linus