From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: xfstests 073 regression Date: Sun, 31 Jul 2011 14:25:27 -1000 Message-ID: References: <20110728164105.GA18258@infradead.org> <20110729142121.GA21149@localhost> <20110730134422.GA1884@infradead.org> <20110731151014.GA23106@localhost> <20110731234749.GQ5404@dastard> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: Wu Fengguang , Christoph Hellwig , Jan Kara , Andrew Morton , "linux-fsdevel@vger.kernel.org" , LKML To: Dave Chinner Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:55393 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752756Ab1HAA0c (ORCPT ); Sun, 31 Jul 2011 20:26:32 -0400 In-Reply-To: <20110731234749.GQ5404@dastard> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, Jul 31, 2011 at 1:47 PM, Dave Chinner wrote: > > Yes, I already have, a couple of hours before you sent this: > > http://www.spinics.net/lists/linux-fsdevel/msg47357.html > > We haven't found the root cause of the problem, and writeback cannot > hold off grab_super_passive() because writeback only holds read > locks on s_umount, just like grab_super_passive. With read-write semaphores, even read-vs-read recursion is a deadlock possibility. Why? Because if a writer comes in on another thread, while the read lock is initially held, then the writer will now block. And due to fairness, now a subsequent reader will *also* block. So no, nesting readers is *not* allowed for rw_semaphores even if naively you'd think it should work. So if xfstests 073 does mount/umount testing, then it is entirely possible that a reader blocks another reader due to a pending writer. NOTE! The rwlock *spinlocks* are designed to be unfair to writers, and by design allow recursive readers. That's important and very much by design: it is ok to take a rwlock for reading without disabling interrupts even if there may be *interrupts* that also need it for reading. With the spinning rwlock, there is also much less chance of starvation due to this unfairness. In contrast, the rw_semaphores really can be starved pretty easily if you are excessively unfair to writers. Linus