From patchwork Mon Jan 8 15:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 186037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1084923dyq; Mon, 8 Jan 2024 07:19:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGy5ngtYoolFT+qp859BZVEK7J+xzJCNiFFHanFNZNGi0mR8AcaoG0MOOsvvUFTvKyjvE1A X-Received: by 2002:aa7:8887:0:b0:6d9:bc39:e5ac with SMTP id z7-20020aa78887000000b006d9bc39e5acmr1625784pfe.6.1704727166724; Mon, 08 Jan 2024 07:19:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727166; cv=none; d=google.com; s=arc-20160816; b=iAjTLShjrWsXNkn1modkvwOzPFoYB8C3fWdVLsZfDul70v8obeMA5RWgRzWB4z4no1 A4i0sMy8V4Vk7+gC4bt9oXT4QlihbuiqyBNkMJ7smFs18zN4JySf/ws/pjcPcC7Jbvwu Z18vbniL4kl3CgbbxHID4jJDhDRto2FW8NJGNdywthR9FRJHlr1tzUUagdFEbF4PMkfN zs0rqkvOELWESiB65vaD62alPWXwWKC57M+Uf8XqKaj9xKR+KZrcse+blqFzOy306Xjr Cwo8IOxtyVWgIwe+kKJsf9xRCuuKw4JdyLyqrmAFSUBUfYEs3mvtP0DmBi0WRsO4rZsk E3lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=lnIZsL+Gfm5vt9T1Ku0R0rqDGcsChXoKQb6rnEU1r2I=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=Cfuk6QlWdlrvTdG4MPNa1kS9qm88f5NK5vs/MFT5nxF5Vnk05mJILASDXQ3BqVMgVk 04E0EkdO8kG2+QoYe15LXtx2P1C8ZM1PtEOK11ZZwGqbQsHG833uHSp+sxqsM5B/mGQX RviRl/NPcmGECJx5/9u+trBiMSKZCZ7YOLo6CWMvUIdPPFIg9Gd7rmF+mtmxAAxQ1H2B +dumIc2v6apGvliWwKjdj/CfA+3/wL9tOv6ktLsYwJyixW1slAOVJmk+J0wSt0qkh5BH rK7JBIJg919s493UZDx8hYpSXF1owix1YiOX+cuGp6Ep2OPYVZavCDJNDUTC6zlAcOi8 q8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bqXvlbXp; spf=pass (google.com: domain of linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x19-20020a63f713000000b005cdf80f8417si6052998pgh.871.2024.01.08.07.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:19:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bqXvlbXp; spf=pass (google.com: domain of linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D940284815 for ; Mon, 8 Jan 2024 15:19:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 670EB51C25; Mon, 8 Jan 2024 15:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bqXvlbXp" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B46385027B; Mon, 8 Jan 2024 15:18:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2E90C43391; Mon, 8 Jan 2024 15:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727110; bh=6J7EZJj9VWIpSwcWubGlaBSfbZNbY5oiwi0szyHJl2k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bqXvlbXpOCMmgpQ9VcsXqL7T58j6ZPvokybsOFXiGpDplJVyJNnednreBYtb/7qq0 50wURALuXCHxyy0J0023MhMjfg5ovZZ6YeSJ3UBxIYz/RM2g9J+fn83lBULmcQsYrs BcoS3PHSse5AHLvugYHGtp2MonVUNYmCH63IQKduvfk8HxhzpZZOt+QTzoixx54htt P2tuCycgC8NYXRRtOfy0e/aJiDtn9VGoQa/x0p8MWvtWrWduOKILUKYBB5LzwxBi2H mB+D9WsSyedZNrYSVu6tLzFaCiekT3V7Szl3eGWpRgPzRuVbaOLjDg8uX3JEDN06cM u0UUYU/anblRw== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:18 +0000 Subject: [PATCH v2 2/8] fs/9p: convert mkdir to use get_new_inode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-2-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1893; i=ericvh@kernel.org; h=from:subject:message-id; bh=6J7EZJj9VWIpSwcWubGlaBSfbZNbY5oiwi0szyHJl2k=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDf3xA25bd6ZNge4qdcB0YfAp+Kxxh4WkRt 9dUbSCCA9SJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mB2fD/0durKg/03hcGzp65W1RgAfi/Gil7/upa753Z62meQO7ZvCpmBHDKidax2iJnjAnieZfhV 9WqnO1EQukimB1YLZW5wsJfNwNTYyWlFEczxMyG4luuRDQSksTuAoKmLqvKMFTB4GHyW1ZfH8Iw b5bUGesYH5SRjlCEJzxSy0cnUJPCd6YaMhEzrxIvRMUTGYirppm8N3sh/U90kkFY7DewxbSxQ4q Kl3X7TCBsZeIKHXSnc8zkivy8dcKVcEA2jhAMkxDNzZNE+G/6Llgs+ySxxJCOs+u6oGSGUviH1h qkW9PZQbEAdi8FCHvare9k8W1hYd20jQsswrpHd+34FE+ahyiqQ9RInl/Ou9Dl7oAgrML7h1fJz KE87trQerbk5Jj71h0K7NNASay7qA/CJaVXs1+vIovyoMpRebm+w42BkmATlonbsno3E/YXSRnk 6fSHZWclok7TvYmZqfj4+fLsdeyj+ExlxDh0ZBUaxM0V1U46wz4sfM4lBUaO96oiOgEenMOiOzf WO1ZaB1V6LayV7luQdzVJ7zLAFUaKuBlASwn2FGXrBrM4TSqYDMe/2QS9VEOUIr1BilGdIwN0TO y2j+gtseEC+GfCLsxtWKLd2ZLyursnInarYSP+whuSxEuDgZDBYuYGsvgmR3FxgN9yGrwH3pMSa Nlco5bxWVzYcFXA== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787535993418562907 X-GMAIL-MSGID: 1787535993418562907 mkdir had different code paths for inode creation, cache used the get_new_inode_from_fid helper, but non-cached used v9fs_get_inode. Collapsed into a single implementation across both as there should be no difference. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_inode_dotl.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index c7319af2f471..981278d0788e 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -401,32 +401,17 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, } /* instantiate inode and assign the unopened fid to the dentry */ - if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", - err); - goto error; - } - v9fs_fid_add(dentry, &fid); - v9fs_set_create_acl(inode, fid, dacl, pacl); - d_instantiate(dentry, inode); - err = 0; - } else { - /* - * Not in cached mode. No need to populate - * inode with stat. We need to get an inode - * so that we can set the acl with dentry - */ - inode = v9fs_get_inode(dir->i_sb, mode, 0); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - goto error; - } - v9fs_set_create_acl(inode, fid, dacl, pacl); - d_instantiate(dentry, inode); + inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + if (IS_ERR(inode)) { + err = PTR_ERR(inode); + p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", + err); + goto error; } + v9fs_fid_add(dentry, &fid); + v9fs_set_create_acl(inode, fid, dacl, pacl); + d_instantiate(dentry, inode); + err = 0; inc_nlink(dir); v9fs_invalidate_inode_attr(dir); error: