Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1242678ioo; Fri, 27 May 2022 04:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWO0iveaEyEg3oJ3atibPQsM9sp0ExVkM8pSuJ1+7vt2G4Q7nxluw4vvM/XZ3qpfQn94bQ X-Received: by 2002:a17:90b:3e8d:b0:1e0:3d95:a0e1 with SMTP id rj13-20020a17090b3e8d00b001e03d95a0e1mr8043872pjb.61.1653652343990; Fri, 27 May 2022 04:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653652343; cv=none; d=google.com; s=arc-20160816; b=QwIzZjsf03vQrknxn4+pWC9NxC3FzHpadhBknadcyRZLI2yO+k4E0cMJCz8vNIOWp6 XjKUWz2aofhGh1/jFl3ggRofCllJnuBCz0GuqEEDgPbqeo4lh3soc1CmH1S7ps8GMZea IDiLEDelQ/THBxeWj/oct7WWAUEJUnCk96zYZ9mg8pfrtUXbkrUXNGkzsnU3tREOeoNA IbIm8RMh+snJsT++r70cLaQBVHEvGoD9n9xeOJ1DYcZ0EPB71CNcmLzRdj4DbCwB4yWo nUKFwyBzbZ5fhwh+A0jvUFWzeAIhxfs1Zg6+WCBKWg2XV8f6rs8xBglEZ9wM+qQXnWJh oQ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=va52FY3CxVCP4CDaqya7zxaHqwkN4nQrlRwZnNMAbec=; b=Gwmrk4PWF9uwX652Fw+B2Bx393NOPPomqLq5h8QzrNnkr/tB+mINsP0sNh64Za+xCf myv+v2zpo+VeK5TuPM7rjPc8Vln8mgVa0r2SIPvCZcA2rn18mYJEDWGoCtQ4iWk1OcIS xBH3MgymxFOC1tSD0VmRaCO8eCqgSNmBzsmXaVWW07XFPJJethWJ87SXtR7MPlX6L3wd HNbSI4TgRbQJNbCAxGvyistNLV2XOrKBJl+k9AZNco+AF/ceFvF2uJSj+27OLMVv2c/H 7fY+rJ8CrVxLHnNJV8gzQASJ7pqIhFyzYH63TtuahxRtafQLMyF1omIHCcQofH3iEGSl AWhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Zr3h0vZV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a655345000000b003f5e7c0649bsi5843385pgr.698.2022.05.27.04.52.05; Fri, 27 May 2022 04:52: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=@linux.microsoft.com header.s=default header.b=Zr3h0vZV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344936AbiE0AAj (ORCPT + 99 others); Thu, 26 May 2022 20:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345134AbiE0AAc (ORCPT ); Thu, 26 May 2022 20:00:32 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5686D6F494 for ; Thu, 26 May 2022 17:00:31 -0700 (PDT) Received: from sequoia.corp.microsoft.com (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 8D85C20B44CF; Thu, 26 May 2022 17:00:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8D85C20B44CF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1653609631; bh=va52FY3CxVCP4CDaqya7zxaHqwkN4nQrlRwZnNMAbec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zr3h0vZVzjUnKnzcwb3bRT3m50dMDGbnXvq4t+KjgU8ZKb0L9PW3wNg71DoCtZjny rlAsS83qM8837mn79cM6xnxAiFJadS3UADG4sDuga74kS4IQ1/Lr1urFiKM3/kLY1b OCvI6YQ3xrPV0ZHJNHa2LfTmVTu01U3IPteZWL2E= From: Tyler Hicks To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet Cc: Christian Schoenebeck , Jianyong Wu , v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] 9p: Make the path walk logic more clear about when cloning is required Date: Thu, 26 May 2022 19:00:01 -0500 Message-Id: <20220527000003.355812-4-tyhicks@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220527000003.355812-1-tyhicks@linux.microsoft.com> References: <20220527000003.355812-1-tyhicks@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 Cloning during a path component walk is only needed when the old fid used for the walk operation is the root fid. Make that clear by comparing the two fids rather than using an additional variable. Signed-off-by: Tyler Hicks --- fs/9p/fid.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/9p/fid.c b/fs/9p/fid.c index dae276ca7f7a..dfe98a308612 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c @@ -150,7 +150,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, { struct dentry *ds; const unsigned char **wnames, *uname; - int i, n, l, clone, access; + int i, n, l, access; struct v9fs_session_info *v9ses; struct p9_fid *fid, *root_fid, *old_fid; @@ -214,7 +214,6 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, } fid = root_fid; old_fid = root_fid; - clone = 1; i = 0; while (i < n) { l = min(n - i, P9_MAXWELEM); @@ -222,7 +221,8 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, * We need to hold rename lock when doing a multipath * walk to ensure none of the patch component change */ - fid = p9_client_walk(old_fid, l, &wnames[i], clone); + fid = p9_client_walk(old_fid, l, &wnames[i], + old_fid == root_fid); p9_client_clunk(old_fid); if (IS_ERR(fid)) { kfree(wnames); @@ -230,7 +230,6 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry, } old_fid = fid; i += l; - clone = 0; } kfree(wnames); fid_out: -- 2.25.1