Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1263353iog; Thu, 16 Jun 2022 02:35:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vyINB6qvzFO+aPBTuGyh1hRKB4o0Q9NSRnoaVsqD6+sSjhkquWKV3I2RtFUvgeF+eKbZdn X-Received: by 2002:a17:906:fc12:b0:711:d2e9:99d9 with SMTP id ov18-20020a170906fc1200b00711d2e999d9mr3756736ejb.734.1655372143008; Thu, 16 Jun 2022 02:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655372143; cv=none; d=google.com; s=arc-20160816; b=u20T/TkP5DRbVv3sEbOJNfC+SUO6kZzERirT8IqKlOfNrQXDnK1k1lD4UMrRBcbNSM Bh4eY3QxBKVVXC/nWykeamnY5EeqRX9kyj+x1OXHNus6LT0nDXXKJKDlvnWfjIdcITdy hoPLWaf9FdUbBUjbwSTxb2oID/lEiAcAm43b3UM8mMWEw0HrsnQG/oya7RWPGC4rnOFe QSuZcpSTcXxjMhZuXDL83Iq3eZsQk4H6pGbHpKHd7Q5Qhr1I4V4jr92nBT7WckaZ3fnn BiwxbXH5ljMuXEwV/lkQ4a3Wu1ZGHpak3SZN9frFGIZyU7cDtcMonyDwZXS1f8kt4zJS pzNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pc5Amsn8TgDKhR/5plxMGf5bc0SbsnTaDD4PIb/Yu5w=; b=swql4+Hsj4TeNflbxMddpmMClYzDA4YJOODR99sv01pqCSTvI7P0QL+mQC4rYwG/I9 Zp+B2+FGwBjj1AYzBTtIvFQ8KLvuJE2m42eoGof0LRk4jwU9RHBlcO3STmzPJMkZY6uW 6NzXzf6VlyxvnkQSlAZqwLlzn7hxkFODm/OR0akJM7d9AMgfOVQvN7+Sulfz2cdMb9e2 LvXXKsSY2qzT+3a79QT3nLhyUPS5KUCMDrc/txAewZmCmpaT4kfhJuihnjDM48TrTV/H naQg9nA3a4gzlE8Inj7lsinwE0x/5SkT/kEMhzkjsrxbdpZx9iGCvAfbJVdGmQEEV0jx mnAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=UXL5I2ys; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a056402280300b004355574bf3asi342853ede.504.2022.06.16.02.35.06; Thu, 16 Jun 2022 02:35:42 -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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=UXL5I2ys; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359190AbiFPJCV (ORCPT + 99 others); Thu, 16 Jun 2022 05:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231732AbiFPJCT (ORCPT ); Thu, 16 Jun 2022 05:02:19 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F2D92DD4A for ; Thu, 16 Jun 2022 02:02:12 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id s12so1554460ejx.3 for ; Thu, 16 Jun 2022 02:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pc5Amsn8TgDKhR/5plxMGf5bc0SbsnTaDD4PIb/Yu5w=; b=UXL5I2ysh9P8L6Oo8E2wnIxMZ60LLgOVT2jV9ZytcZfsqDdOP5nX9tjZkutipW1NyM Qttk6WOE1hInbn4Lm+SpGlypygKTWfQYsjM4t7T15ZzIPDaUD+/ZvG7C9UE9cAkyljXS cEEY44p6T1VkjiNRqDpJG67fqs7FXJEqJSyuE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pc5Amsn8TgDKhR/5plxMGf5bc0SbsnTaDD4PIb/Yu5w=; b=gQvSGqU5m5bqL7Ha9AKLum9kOBF6HV31F2H10HGdZckzuKY0RDha6hy16EJsBzShDp Yu2WZ9KyfBZhbhLr8PHRJr9Q//YB3mNyC4JuWml2uEjcVkjWLIp7ivGBQhNYV95l6Hi1 v0DWw2p3mtc0kJDzk5DzzzxeIhJ5d8yCBHSA/mRmHb/svY7CFVyWz6pzrOGV4mWz2OYh iCr3c44yoVgGkcl8iiWWwgmE8xN8gH2GIxJ/7DPnA9U58yNaDw+yafBUUzdV6XJMwJFE iSMny3iwhCme8CStu+wwDcd2vBbtvdn5K/dd/Khy7BewYamc8Q5REHWvky4m8FXtUo92 m32Q== X-Gm-Message-State: AJIora/IFANrrVrQvKrjsR/ixoLv4iA6K8ERi8FBaaexvQ1OaAg4z8Me MLMnVGHtdywX0qT+tS/pssgjtrjd8R+MJ3w9/EVMHqrBHPQswA== X-Received: by 2002:a17:907:3f92:b0:706:db40:a0ef with SMTP id hr18-20020a1709073f9200b00706db40a0efmr3487509ejc.524.1655370130911; Thu, 16 Jun 2022 02:02:10 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: Miklos Szeredi Date: Thu, 16 Jun 2022 11:01:59 +0200 Message-ID: Subject: Re: [PATCH v4 1/1] Allow non-extending parallel direct writes on the same file. To: Vivek Goyal Cc: Bernd Schubert , Dharmendra Singh , linux-fsdevel@vger.kernel.org, fuse-devel , linux-kernel@vger.kernel.org, Dharmendra Singh Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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, 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. Thanks, Miklos