Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbaJPNnz (ORCPT ); Thu, 16 Oct 2014 09:43:55 -0400 Received: from mail-qg0-f44.google.com ([209.85.192.44]:36118 "EHLO mail-qg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448AbaJPNnx (ORCPT ); Thu, 16 Oct 2014 09:43:53 -0400 MIME-Version: 1.0 X-Originating-IP: [46.139.80.5] In-Reply-To: <543F9E75.2090509@parallels.com> References: <20140925120244.540.31506.stgit@dhcp-10-30-22-200.sw.ru> <20140930191933.GC5011@tucsk.piliscsaba.szeredi.hu> <542BE551.1010705@parallels.com> <543F9E75.2090509@parallels.com> Date: Thu, 16 Oct 2014 15:43:52 +0200 Message-ID: Subject: Re: [PATCH 0/5] fuse: handle release synchronously (v4) From: Miklos Szeredi To: Maxim Patlasov Cc: Linus Torvalds , Anand Avati , Linux Kernel Mailing List , Michael j Theall , fuse-devel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 16, 2014 at 12:31 PM, Maxim Patlasov wrote: > Something as simple as: > > int main(int argc, char *argv[]) > { > int fd = open(argv[1], O_RDWR); > fork(); > } > > may easily dive into fuse_try_sync_release() concurrently and both observe > file->f_count == 2. Then both return falling back to sending the release > asynchronously. This makes sync/async behaviour unpredictable even for > well-behaved applications which don't do any esoteric things like racing i/o > with close or exiting while a descriptor is in-flight in a unix domain > socket. > > I cannot see any way to recognise last flush without help of VFS layer, can > you? No. One idea is to change ->flush() so it's responsible for fput()-ing the file. That way we could take control of the actual refcount decrement. There are only 20 flush instances in the tree, so it wouldn't be a huge change. Thanks, Miklos -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/