Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1690267rdb; Mon, 8 Jan 2024 07:18:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtY4CA774QnrkdF9Vp3t/oV5UXtKGqXMcEzItpV+j67nOGlZo4iVOSz+lcIlUhNs+WMuJ5 X-Received: by 2002:a05:6a20:9493:b0:199:4d22:e9b4 with SMTP id hs19-20020a056a20949300b001994d22e9b4mr1426821pzb.70.1704727135366; Mon, 08 Jan 2024 07:18:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727135; cv=none; d=google.com; s=arc-20160816; b=oicXzPeipS47W9GrcTt4BeEWUUD6dzmjnPFIDF91k3ViAIiviBHp7yskf6+O5gX+7y srp3YtYudj3/wxKGbBk/CMyKVDXbNCmf5O+HCow/bxYs0f7uYhYvQQnmMJ7sF1hxXeRO FvKqXdBqB1V5qTKkIrXE8tAr1NmNH68kD16KLEEKLjpT8SeT0HZsWPZVqq7wGWy8Akb7 oWMZOyUagWC1AL2PA2sajQ4RoslmVlEcbANPr1bnr4yvtDGxuCcYWxFxCTOwAuaVqFoX bZBiRDO4w/6og2YjVoQDkApQSPjaJ8xt73J8XszjZP/N2MPlOZGTVfhJUS5iVvbprQiZ bCXg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l126-20020a633e84000000b005cdf940a0d9si6154717pga.489.2024.01.08.07.18.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:18:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19748-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19748-linux.lists.archive=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 0735028454C for ; Mon, 8 Jan 2024 15:18:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8894F51032; Mon, 8 Jan 2024 15:18:31 +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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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: -- 2.41.0