Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1455409iog; Thu, 16 Jun 2022 06:46:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ut0yalfRUdRVqSzyAvbf4pW24JAlrrn3/H9WpWBHe3f4JlZFQ3mTklGE8wN3HxrvLgCzEF X-Received: by 2002:a63:5c56:0:b0:3fc:824d:fc57 with SMTP id n22-20020a635c56000000b003fc824dfc57mr4592802pgm.561.1655387190585; Thu, 16 Jun 2022 06:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655387190; cv=none; d=google.com; s=arc-20160816; b=Y4Maikl91TuFIf5a4WWLaIiBVxH2Ryjtlzc63FNv3DZudojfKyrDwlyd0b9NQGOd4Y dcQRsw40xlzCPvhf30wP3t8aMJGmGl6k9a1O2fCPl66E5zahTylkPjgSfRxlDPwCOaf1 6xdnrK2Es9eS34aFn96SYxFP8t08q3cx+tJ0rQ1c5WwI3tIKyUQuX4KrySWvv4cP3elH 6SkJ/OTFi4rb6+fDh24Q8/jmugdR7CXWA2o8xb2l10v6Ga+n8ukDiTHPRcsCKaLLuHE6 Shg8vMyQE+H6sq0FljBgNiMJUeu22X1VlfYm/UUBFopan8zuFDXoW6uyOwb2c/AsqQr/ xiaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i5RADxigDcqh0YvPeRXWIXmEeyc1rLKtSi/HgTqXy+8=; b=fxiHlx+e4dLv/wn0DHiv+im/u7N1pGlKcwrGJq/A9KZ/HNsiA0JU5jwc2nDqX7/OJl BfB2S5PjSrTUsyLb+etGCYxGwzhl0H8YkfGnxpUxj4PszUd0srB7SeUWF6N2mtZ7fm1M WwFe/P3I+aguxiDSzc2OfxyVOTqacXAKueb96XJVMPiUd5IbJFiHvHfiCFD1CHs/t+yv 32nQsIK/UO4Yu5QWratb5Fm1SqbZ/KXCJ8ZHwoTvHlL5wpUa7nvER2BNWUbGPCYIpx2B k1alt/ykxNRrSV9uJyoBtloQCbDfYRhG0ymxS8LUziIV7ndc3DUask8sCxQ13ORajuaC tAlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HTpGPOWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a635242000000b003fe0ab0238esi2557994pgl.310.2022.06.16.06.46.18; Thu, 16 Jun 2022 06:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HTpGPOWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376921AbiFPNRy (ORCPT + 99 others); Thu, 16 Jun 2022 09:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376829AbiFPNRs (ORCPT ); Thu, 16 Jun 2022 09:17:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C80172528B for ; Thu, 16 Jun 2022 06:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655385465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=i5RADxigDcqh0YvPeRXWIXmEeyc1rLKtSi/HgTqXy+8=; b=HTpGPOWcZ/9DHqVnpfmZNEHrZLQ2U+9MOnR0H7cp0E2Efsf1KpT+M+R+MPk/08i6LCoh5F q/YMq6vHOeXzjsCMie3e1ZMAA9p4PZYPENrLwDdJ4fVvG0iBcspVa5fxat4ao+UPpFTF2o xRewhXhrLiyrSIcCR8qRDs5PonlNYLA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-Vaa9Q1p_O2qKExQL9JnB_Q-1; Thu, 16 Jun 2022 09:17:40 -0400 X-MC-Unique: Vaa9Q1p_O2qKExQL9JnB_Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06ABA811E76; Thu, 16 Jun 2022 13:17:40 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED6B02026985; Thu, 16 Jun 2022 13:17:39 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id A8F0E2209F9; Thu, 16 Jun 2022 09:17:39 -0400 (EDT) Date: Thu, 16 Jun 2022 09:17:39 -0400 From: Vivek Goyal To: Miklos Szeredi Cc: Bernd Schubert , Dharmendra Singh , linux-fsdevel@vger.kernel.org, fuse-devel , linux-kernel@vger.kernel.org, Dharmendra Singh Subject: Re: [PATCH v4 1/1] Allow non-extending parallel direct writes on the same file. Message-ID: References: <20220605072201.9237-1-dharamhans87@gmail.com> <20220605072201.9237-2-dharamhans87@gmail.com> <34dd96b3-e253-de4e-d5d3-a49bc1990e6f@ddn.com> <3d189ccc-437e-d9c0-e9f1-b4e0d2012e3c@ddn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 16, 2022 at 11:01:59AM +0200, Miklos Szeredi wrote: > On Thu, 9 Jun 2022 at 15:53, Vivek Goyal wrote: > > > Right. If user space is relying on kernel lock for thread synchronization, > > it can not enable parallel writes. > > > > But if it is not relying on this, it should be able to enable parallel > > writes. Just keep in mind that ->i_size check is not sufficient to > > guarantee that you will not get "two extnding parallel writes". If > > another client on a different machine truncated the file, it is > > possible this client has old cached ->i_size and it will can > > get multiple file extending parallel writes. > > There are two cases: > > 1. the filesystem can be changed only through a single fuse instance > > 2. the filesystem can be changed externally. > > In case 1 the fuse client must ensure that data is updated > consistently (as defined by e.g. POSIX). This is what I'm mostly > worried about. > > Case 2 is much more difficult in the general case, and network > filesystems often have a relaxed consistency model. > > > > So if fuse daemon enables parallel extending writes, it should be > > prepared to deal with multiple extending parallel writes. > > > > And if this is correct assumption, I am wondering why to even try > > to do ->i_size check and try to avoid parallel extending writes > > in fuse kernel. May be there is something I am not aware of. And > > that's why I am just raising questions. > > We can probably do that, but it needs careful review of where i_size > is changed and where i_size is used so we can never get into an > inconsistent state. Ok. Agreed that non-extending parallel writes are safer option. Atleast for the case 1) above. For case 2) we can get multiple parallel extending writes with these patches if another client on another machine truncates file. So I don't have any objections to these patches. I just wanted to understand it better. Thanks Vivek