Re: [PATCH] [RFC] Fix deadlock on regular nonseekable files

From: Al Viro
Date: Fri Mar 20 2015 - 09:42:42 EST


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 <vitaly.chernooky@xxxxxxxxxxxxxxx>
> 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 <this> and is blocked trying to get <that>, etc.

AFAICS, any threads blocked on f_pos_lock are not holding anything else and
cannot impede the rest. What am I missing here?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/