From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752141AbbCTNmj (ORCPT ); Fri, 20 Mar 2015 09:42:39 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:59090 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750870AbbCTNmh (ORCPT ); Fri, 20 Mar 2015 09:42:37 -0400 Date: Fri, 20 Mar 2015 13:42:32 +0000 From: Al Viro To: Vitaly Chernooky 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 Subject: Re: [PATCH] [RFC] Fix deadlock on regular nonseekable files Message-ID: <20150320134232.GX29656@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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?