Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6597980rwr; Tue, 25 Apr 2023 00:27:24 -0700 (PDT) X-Google-Smtp-Source: AKy350bEi3y0zSTC42KPwlYKX6kRT5ZlmRgChlTgNXmDR7VdsP4fS6dAFbj1zAJmd0RdM9tV1Zoy X-Received: by 2002:a05:6a20:9191:b0:ec:8859:7aa7 with SMTP id v17-20020a056a20919100b000ec88597aa7mr16609472pzd.62.1682407643743; Tue, 25 Apr 2023 00:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682407643; cv=none; d=google.com; s=arc-20160816; b=XjpdT9ZY4colZHXO13mE0LxQTJWy7KYSnJ0ro7ucES7g7swWJFweLb0U8hHE9DNSd2 VtikhgJJhM2mfyiHPWOqeNhvXy58g7ivgu01tCW+keOxLhggFjNZtMUcPo9Zo/UyCcw8 +3VKdju4Ljseu4WabaIT0l9PCII+UN18bDsuOz/BXLgISvS5AT6JQQ8boHfMNmYlbNCy Z5CiflixKxYTRFnKExRzD2eGJ2CImlyoIevLs7ZWZmnCEr3WEHyLKQxQLPJsMvUh2sE5 z5VTEQj4e3J825y44/x4arqOtgoD0ArC8wnFTxxrjtbikClpXartwwF9z+iVCloOS90/ gCIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=HsVyTMR83ttxuxKZQEOXlJIEnSx7WFKLjIUf5uGlz4k=; b=v2ovZ/vuS9FnQ8tW+3bCGwKuUHzU222Um/xEY9naXatSN4vTvjNwWqD9prfuCCBLJx L25Ae1QRmm+TtigO2xFLDPtbx1xsFEy8LdXaJNk+byTHNQOpS+HbbHU3lPwEtEYSIKE8 xUBJb+RPv9g0KpZm509BnE+BKPkB/z2NWx/ciWbCXnOejcvPnziFqrh0sP5Eu7nbmz39 XNs2L6+ADUcRnRnAkdDMMl+1NfpgpFElVxLLrPKfSKCsGYfvqiMpmllqsazmzP30jGzZ UV1SvCqUmg6ZZuTj9eGF1GJ3rceJ9Zyq5GozvMEG1LuOdZ8+pKab9yVtPCKLqWyIBz2u FkWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=K6ZFNMvQ; 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 6-20020a630006000000b00519d9206ff6si12958072pga.314.2023.04.25.00.27.07; Tue, 25 Apr 2023 00:27:23 -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=@wanadoo.fr header.s=t20230301 header.b=K6ZFNMvQ; 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 S233375AbjDYHLL (ORCPT + 99 others); Tue, 25 Apr 2023 03:11:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233327AbjDYHLJ (ORCPT ); Tue, 25 Apr 2023 03:11:09 -0400 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD944ED5 for ; Tue, 25 Apr 2023 00:11:05 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id rCpKpcPOC0ulprCpKpYEyY; Tue, 25 Apr 2023 09:11:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682406663; bh=HsVyTMR83ttxuxKZQEOXlJIEnSx7WFKLjIUf5uGlz4k=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=K6ZFNMvQnqvN61urx9LXNTzA6mMEvkC3DY5Uwq8pOIyr6z2zS6MqJ8mECK2iClJwR uDHePAGgIY+PErtHVMsNS+miKnJF/ePoGyWxjzpb1D0RX6tg++szbb8GtvIymQpd1n ekHsBJsb58p/PGF7HVgDKfFsSjwnqKBl8SD0cuIhJZ/OKW2ZjWmd+6/5nTOEPhn2VP hsC/rwIfWIRYrkn10e7H2N+iHdRP2dHJAewozjtACiBuOYYRT/vT/1e3AgWRN7q2jR 8lfHzDnwVXkLnsHYDuBG0VnaSUs7BSSX/UOv3VEGJWxqOX7I5efuQyysVd7VEcQc0D qOvP+Bs1f22OA== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 25 Apr 2023 09:11:03 +0200 X-ME-IP: 86.243.2.178 Message-ID: <7686c810-4ed6-9e3a-3714-8b803e2d3c46@wanadoo.fr> Date: Tue, 25 Apr 2023 09:11:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v5] fs/9p: remove writeback fid and fix per-file modes To: Eric Van Hensbergen , v9fs-developer@lists.sourceforge.net Cc: asmadeus@codewreck.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux_oss@crudebyte.com References: <20230218003323.2322580-11-ericvh@kernel.org> Content-Language: fr From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Le 27/03/2023 à 04:59, Eric Van Hensbergen a écrit : > This patch removes the creating of an additional writeback_fid > for opened files. The patch addresses problems when files > were opened write-only or getattr on files with dirty caches. > > This patch also incorporates information about cache behavior > in the fid for every file. This allows us to reflect cache > behavior from mount flags, open mode, and information from > the server to inform readahead and writeback behavior. > > This includes adding support for a 9p semantic that qid.version==0 > is used to mark a file as non-cachable which is important for > synthetic files. This may have a side-effect of not supporting > caching on certain legacy file servers that do not properly set > qid.version. There is also now a mount flag which can disable > the qid.version behavior. > > Signed-off-by: Eric Van Hensbergen > --- > fs/9p/fid.c | 48 +++++++++------------- > fs/9p/fid.h | 33 ++++++++++++++- > fs/9p/v9fs.h | 1 - > fs/9p/vfs_addr.c | 22 +++++----- > fs/9p/vfs_file.c | 91 ++++++++++++++---------------------------- > fs/9p/vfs_inode.c | 45 +++++++-------------- > fs/9p/vfs_inode_dotl.c | 48 +++++++++------------- > fs/9p/vfs_super.c | 33 ++++----------- > 8 files changed, 135 insertions(+), 186 deletions(-) > Hi, this patch has already reached -next, but there is some spurious code. As, I'm not sure what the real intent is, I prefer to reply here instead of sending a patch. [...] > @@ -817,9 +814,14 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, > > v9ses = v9fs_inode2v9ses(dir); > perm = unixmode2p9mode(v9ses, mode); > - fid = v9fs_create(v9ses, dir, dentry, NULL, perm, > - v9fs_uflags2omode(flags, > - v9fs_proto_dotu(v9ses))); > + p9_omode = v9fs_uflags2omode(flags, v9fs_proto_dotu(v9ses)); > + > + if ((v9ses->cache >= CACHE_WRITEBACK) && (p9_omode & P9_OWRITE)) { > + p9_omode = (p9_omode & !P9_OWRITE) | P9_ORDWR; This code looks strange. P9_OWRITE is 0x01, so !P9_OWRITE is 0. So the code is equivalent to "p9_omode = P9_ORDWR;" Is it what is expexted? Maybe p9_omode = (p9_omode & ~P9_OWRITE) | P9_ORDWR; ? > + p9_debug(P9_DEBUG_CACHE, > + "write-only file with writeback enabled, creating w/ O_RDWR\n"); > + } > + fid = v9fs_create(v9ses, dir, dentry, NULL, perm, p9_omode); > if (IS_ERR(fid)) { > err = PTR_ERR(fid); > goto error; [...] > diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c > index a28eb3aeab29..4b9488cb7a56 100644 > --- a/fs/9p/vfs_inode_dotl.c > +++ b/fs/9p/vfs_inode_dotl.c > @@ -232,12 +232,12 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, > int err = 0; > kgid_t gid; > umode_t mode; > + int p9_omode = v9fs_open_to_dotl_flags(flags); > const unsigned char *name = NULL; > struct p9_qid qid; > struct inode *inode; > struct p9_fid *fid = NULL; > - struct v9fs_inode *v9inode; > - struct p9_fid *dfid = NULL, *ofid = NULL, *inode_fid = NULL; > + struct p9_fid *dfid = NULL, *ofid = NULL; > struct v9fs_session_info *v9ses; > struct posix_acl *pacl = NULL, *dacl = NULL; > struct dentry *res = NULL; > @@ -282,14 +282,19 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, > /* Update mode based on ACL value */ > err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); > if (err) { > - p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n", > + p9_debug(P9_DEBUG_VFS, "Failed to get acl values in create %d\n", > err); > goto out; > } > - err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), > - mode, gid, &qid); > + > + if ((v9ses->cache >= CACHE_WRITEBACK) && (p9_omode & P9_OWRITE)) { > + p9_omode = (p9_omode & !P9_OWRITE) | P9_ORDWR; Same here. CJ > + p9_debug(P9_DEBUG_CACHE, > + "write-only file with writeback enabled, creating w/ O_RDWR\n"); > + } > + err = p9_client_create_dotl(ofid, name, p9_omode, mode, gid, &qid); > if (err < 0) { > - p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n", > + p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in create %d\n", > err); > goto out; > }