Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp159648lqb; Thu, 23 May 2024 14:01:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/1rdRN0ZN4XpDtDjS8Pdj9/5YizdD6ZLCFD+z578PRcoahnld3Uv/8Jh2yGW8VnjxUdOtiskNBzqhPlZIZ+P47HdJZ/jJ7h2GMwvSLw== X-Google-Smtp-Source: AGHT+IGkZXQHmWDJ54UeXdFQCbAXXTzkbav9PTTF8AfUrqAPJJVjI4uNKXTz/w+FwKfhK0ZkxrQc X-Received: by 2002:a17:902:c794:b0:1f4:33a3:4b73 with SMTP id d9443c01a7336-1f4486fd7c9mr3597185ad.17.1716498093754; Thu, 23 May 2024 14:01:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716498093; cv=pass; d=google.com; s=arc-20160816; b=RC6p5x6HI+PxexQqUi8Cb0KiHVR0ElufG4m0xkH4hog1i/W3HaeKkZHkKja0KEJ08z xtiL1hki74hlPdfeuu1HRgnD9jiU9tvOxPSz8MjU5EbC6k6PQQsCKOiWdElmgO+pD6uZ QID0q8iYwDfVCtUP35DxIt/ELpmKvZDJcBIHo+dX2+xPkdIlWdkIVcyU1Ocm8j4/2dm+ ttmfWhzIjWed8O5snzU7ciozU/n3GqzqWlVGL/o8qOqM4+le1cSGR9T30RmiWvsuSqfh RW/eXw2Gm5n4zjQeH620OFAJfyB26J4SNqIfj5vKErlroVWSqOW3jzy/MvP7COiSDzla m7xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=a2tvRl1dT+9coVyGAznzC5MWLzknTsetbMaUwWFZ01A=; fh=jHSs6J/gzs63ngNL9Vjjj8GupRG8SiHeF6Vt96jrLX4=; b=HHPEnNxs+Mv5xH94IIXXLilLfAJPprOuKo0+j1FexcC47y9XkqJeMqQHj1SsIbPsna wnvA73CuiWMVFya1BK2IoD0INmRvsff88jbU9meKgVtz5rg1h6Ctjzz+ycWZ7uqayucc ZBp4eDrf/RcPZXheYur1Gm2C3Ya8OaxgTuw6naDxFL10RlPmDI/hCQAh6uIvohFxXnUJ oWVCyR+nk7xobyMCmBmobhpGkG+7gUFRvAhSmNzLsJwohS2V9w4Rt7Es/VYunT5L88lo U+anx2oU+f9wSa5TqqCALRXmiS+eA63rp0nLNCKrZcgr7mlc/WNYRWsj/hwixaUDF7Vj jMLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=ifSUja34; arc=pass (i=1 spf=pass spfdomain=codewreck.org dkim=pass dkdomain=codewreck.org dmarc=pass fromdomain=codewreck.org); spf=pass (google.com: domain of linux-kernel+bounces-187999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187999-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.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 41be03b00d2f7-68222db109asi16782a12.236.2024.05.23.14.01.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 14:01:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187999-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=@codewreck.org header.s=2 header.b=ifSUja34; arc=pass (i=1 spf=pass spfdomain=codewreck.org dkim=pass dkdomain=codewreck.org dmarc=pass fromdomain=codewreck.org); spf=pass (google.com: domain of linux-kernel+bounces-187999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187999-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.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 698E22820C5 for ; Thu, 23 May 2024 21:00:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FDF3127E21; Thu, 23 May 2024 21:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codewreck.org header.i=@codewreck.org header.b="ifSUja34" Received: from submarine.notk.org (62-210-214-84.rev.poneytelecom.eu [62.210.214.84]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 882D8127E0E for ; Thu, 23 May 2024 21:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.210.214.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716498036; cv=none; b=ugPQ+wO9eS1OKHIx5+New+tU6TpWfpyHpXWzJ+RtAWlRxHbWZUPqywucS6YqYsRyr8Z3P/focYbTlBkMq0Gfpp6gfx+QK2MNGmLe5ItaKDyJPTOLdNIf84ccyp4UFxN/RszzeJPCEbF7RNhM9Thu0vy2J74DYgsMqJCFhuHxaQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716498036; c=relaxed/simple; bh=M7s0vSWRDCFYfDbE+HleEFzeiaxWIsQ9hYliav9ZcNY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ClbR99lpCrN4M1UwQtGnFSaHHiYXCOk4ExbTa4kZSGf1LEhF5UqawLiQ+fq46VFoCJqO9QGaRvvAlFEn1mfQ9A/8KmGeSYFvYg9GRWqsFKFOFTV3kV5pOi/Q53aV0R66fo+SAbnspzBgSdsLpbAJIhIfPi6GSBgyeDTDh9H878M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codewreck.org; spf=pass smtp.mailfrom=codewreck.org; dkim=pass (2048-bit key) header.d=codewreck.org header.i=@codewreck.org header.b=ifSUja34; arc=none smtp.client-ip=62.210.214.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codewreck.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codewreck.org Received: from gaia.codewreck.org (localhost [127.0.0.1]) by submarine.notk.org (Postfix) with ESMTPS id 3CE5914C2DB; Thu, 23 May 2024 23:00:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1716498033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a2tvRl1dT+9coVyGAznzC5MWLzknTsetbMaUwWFZ01A=; b=ifSUja34kWxBPSoFJmEKiM457nFHdQG+EVQ0ZwZxlUzkkxj+e08T+0CPgrWvVKb0PZRAyQ xhr9hCPcKuzpJHWOUI7e3X7dHgja5g8wXN3wizao9QuKLOyysvhB3y5R3MnQbjKrEciSQc KMCF45GEWwRtTd6uXUjGST9Kd1AFZvdb/+Jl3YO3Dd2K+DHoCWDLfsUM5cVobCY4mZMKdK cK2sHNsnWBad8qhnQGAhNOd9v/NWt30vNu+9JTaT1isQYE2MLehec0bQMUZqaOYQ6s3VNv qlYKcfFApOhd4NudoFeNWjkPeib031p7Jxgj8nrAg0j59AzK8N4EkbjPQV5ueQ== Received: from gaia.codewreck.org (localhost.lan [::1]) by gaia.codewreck.org (OpenSMTPD) with ESMTP id 25b9365d; Thu, 23 May 2024 21:00:27 +0000 (UTC) From: Dominique Martinet To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] 9p: v9fs_fid_find: also lookup by inode if not found dentry Date: Fri, 24 May 2024 06:00:23 +0900 Message-ID: <20240523210024.1214386-1-asmadeus@codewreck.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240523113638.1196299-1-asmadeus@codewreck.org> References: <20240523113638.1196299-1-asmadeus@codewreck.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It's possible for v9fs_fid_find "find by dentry" branch to not turn up anything despite having an entry set (because e.g. uid doesn't match), in which case the calling code will generally make an extra lookup to the server. In this case we might have had better luck looking by inode, so fall back to look up by inode if we have one and the lookup by dentry failed. Signed-off-by: Dominique Martinet --- v1 -> v2: fix build error Sorry, shouldn't send patches without testing even if I'm not planning to apply them for a while... fs/9p/fid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/9p/fid.c b/fs/9p/fid.c index de009a33e0e2..f84412290a30 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c @@ -131,10 +131,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) } } spin_unlock(&dentry->d_lock); - } else { - if (dentry->d_inode) - ret = v9fs_fid_find_inode(dentry->d_inode, false, uid, any); } + if (!ret && dentry->d_inode) + ret = v9fs_fid_find_inode(dentry->d_inode, false, uid, any); return ret; } -- 2.44.0