Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3091525imw; Mon, 18 Jul 2022 01:49:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t5U9GC66rEWyKkeTP723dEl1n1jsgPQPcRYbt3/rygeyQg862fYHHPMSAYllqSiQiMFplR X-Received: by 2002:a05:6402:3708:b0:433:2d3b:ed5 with SMTP id ek8-20020a056402370800b004332d3b0ed5mr35172108edb.246.1658134198295; Mon, 18 Jul 2022 01:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658134198; cv=none; d=google.com; s=arc-20160816; b=ePMJiVsAuB9DzcY9Olr7eIZlEjnh1S52y7lzDj7JaPVDFinbA1CueEyFBcnElxnDEo drepAZMIfyjJGbakuARUP8PxhrysCNKbgxNzO5hqiy2YAXfvM2bx4VKCOAduGep0yC0q JMtJXKq2+/fdkuc651jJm4ib933Um22LSj4XlvH1xbjmxQuM+uIyxfGSREXrzjZQP1KX 1cTaWc9SveIwrJXfPEEOoVbVNtwK2Lx7yBd+1gSJC7RrxXoGZDklZUrCttihGMaArGrS vHhS6Qu9ZSw/P4yv/ABXRVdBwdpazZiQDirt5XyUqlP+EnBvIWD6/7+z6Uvfq51otPM1 m5uQ== 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=Z+u8dlZ8Muf2HXMeU0KFrMSR2DdrEfYE39jHtYBLJvk=; b=csK9eYm9aRD/5BgasXtW4o8reim8trIW9G+YzYE/J+Z4HYcXLvEZFG/bwXEeJ1mmOL /FJ2/EnOhSeeJwrMvb33OM7e0gexkv3vDSkUfkuO35GvL56lsZdXxNDRqpNhZXfvFxt+ /6HlztzzaqQekOX2EgmF4nojUMlyB4DE15m/EoyFhd+Uc7IfG8FNun8pEFRM4zGz85TE pd/rH/96EyHIzYJZ0A5CoTmVcZpNlrcCcxyS8wNk7ZWfL52JwbMYOPrxG7yMyapovjBN zUIERcXuoe/Cvuu/vUKh18uexdBXBD/QS0cx0PbvoaYsCem02yrCBYaqujZOVnKvCrfE Or/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b="e/pfi4Li"; 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 y12-20020a170906914c00b006fe9e0df24dsi12703454ejw.876.2022.07.18.01.49.33; Mon, 18 Jul 2022 01:49:58 -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="e/pfi4Li"; 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 S233680AbiGRISh (ORCPT + 99 others); Mon, 18 Jul 2022 04:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233682AbiGRISe (ORCPT ); Mon, 18 Jul 2022 04:18:34 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E854E1900D for ; Mon, 18 Jul 2022 01:18:30 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id x91so14220004ede.1 for ; Mon, 18 Jul 2022 01:18:30 -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=Z+u8dlZ8Muf2HXMeU0KFrMSR2DdrEfYE39jHtYBLJvk=; b=e/pfi4LiQiBx98KeNwsNG85Q9l7RndPje7VUL/FYpkZcIQkcvtf7tM4VafS+M7L8wa +r9PGqWoTeSaG9Ow4MsGxFsdeZu1szALQtbuu+oyGz0fGits8Gami5fdaVLPTukXEo7V eLr6Zn4BxFxFNd6hCuekvtVsP+0z3UqKCJVYg= 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=Z+u8dlZ8Muf2HXMeU0KFrMSR2DdrEfYE39jHtYBLJvk=; b=Ws1tab4PpUlAVO/gnzoY4Q8T57KG6pVLWv5oarFeLR98goRtzAzHVRIDvVRrpXLp02 Nnjar1hMcehc2Rs7TEw2MeYHGbRL/RQpE8RAwFIul9n0TWN1CMvrg8vUVtBFRLC1E84d JAtg/RdxRADC7anFdBlzRo1hHTDq0nQptOAu6rsPjIW49htz5AxlpEnZQtR3eRpMy8mC NoY51UDR4vrWN2d5HaHYhK8nwcODQOV6QNNklk6mtV/8rbu2loTQsMqw4KEg6IPnPXLl xUH7k+KHocXdeJ1foeL54T4g9aWDKA5zhGqOmlKPkaPz7157jPGR8uP/jc8u9+kUE0/6 KLaQ== X-Gm-Message-State: AJIora9GusYraHxM1I8eKcEQLEkWhwR9SxGRWHEuxZs1O5Hrv6L2Dgae UTGtL6YPlSn3NQGeRZ66bAEUfHYOEN+HOhM/M0g+oA== X-Received: by 2002:a05:6402:3202:b0:43a:86f5:a930 with SMTP id g2-20020a056402320200b0043a86f5a930mr34796033eda.389.1658132309531; Mon, 18 Jul 2022 01:18:29 -0700 (PDT) MIME-Version: 1.0 References: <20220624055825.29183-1-zhangjiachen.jaycee@bytedance.com> In-Reply-To: From: Miklos Szeredi Date: Mon, 18 Jul 2022 10:18:18 +0200 Message-ID: Subject: Re: [PATCH] fuse: writeback_cache consistency enhancement (writeback_cache_v2) To: Jiachen Zhang Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Xie Yongji , fam.zheng@bytedance.com, Miklos Szeredi 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 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 Mon, 18 Jul 2022 at 08:01, Jiachen Zhang wrote: > > On Fri, Jul 15, 2022 at 6:07 PM Miklos Szeredi wrote: > > > > On Fri, 24 Jun 2022 at 07:58, Jiachen Zhang > > wrote: > > > + if (fc->writeback_cache_v2 && S_ISREG(inode->i_mode)) { > > > + inode_lock(inode); > > > > I don't think this can work. fuse_change_attributes() might be > > called from within inlode locked context. E.g. > > > > lookup_slow -> __lookup_slow -> d_revalidate -> fuse_dentry_revalidate > > -> fuse_change_attributes > > > > Yes, this is a problem that should be fixed. As we can not check the > inode lock state from the inode->i_rwsem structure, I think we can > pass the inode lock state along the FUSE function call-path to > fuse_change_attributes(), and only when we can certainly know whether > the inode is locked or unlocked then we continue the > writeback_cache_v2 logics. What do you think? Not liking it very much. Better create a new lock for this purpose that we do always know the state of. Thanks, Miklos