From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH] [RFC] Fix deadlock on regular nonseekable files Date: Fri, 20 Mar 2015 13:42:32 +0000 Message-ID: <20150320134232.GX29656@ZenIV.linux.org.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , David Vrabel , Marek =?iso-8859-1?Q?Marczykowski-G=F3recki?= , Iurii Konovalenko , Ian Campbell , Boris Ostrovsky , Andrii Anisov , Artem Mygaiev To: Vitaly Chernooky Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Mar 20, 2015 at 03:17:54PM +0200, Vitaly Chernooky wrote: > >From 8ef72cde695d1b1a3e9f6165477c9e7415fca2b1 Mon Sep 17 00:00:00 2001 > From: Vitaly Chernooky > Date: Fri, 20 Mar 2015 12:26:37 +0200 > Subject: [PATCH] Fix deadlock on regular nonseekable files > > 'Commit 9c225f2655e36a470c4f58dbbc99244c5fc7f2d4 ("vfs: atomic f_pos > accesses as per POSIX")' introduce following regression. If some program > does multithreaded IO on file in pseudo-filesystem, like procfs, with > nonseekable files marked as regular, we get deadlock on f_pos_lock > mutex, if there are simultaneous reading and writing by different > threads. Details of deadlock, please. How do we manage that when it's always the outermost lock to be taken? Describe the minimal deadlocked set of threads - thread 1 holds and is blocked trying to get , etc. AFAICS, any threads blocked on f_pos_lock are not holding anything else and cannot impede the rest. What am I missing here?