From patchwork Sun Apr 6 16:18:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tingmao Wang X-Patchwork-Id: 14039417 Received: from flow-b5-smtp.messagingengine.com (flow-b5-smtp.messagingengine.com [202.12.124.140]) (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 103B08F7D for ; Sun, 6 Apr 2025 16:19:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743956391; cv=none; b=b1nCJQDPpOVlWGQgcZcwSdlqjQEezwdelB/w3PvKULnxvu0BNiIslbfsbVNPGoqjQy0zWlO5QaiwRpkujwG1gziOpfVMc2aGLf50m/UF5eDIwxKU/RWyuwNLq5TxuZgPOfK8bAC2cUjJji5u9NRdwf08stTrNUWYLUVsmZdpo94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743956391; c=relaxed/simple; bh=QwgBKRqOOaa6XKwENYwuwFGW7dQ1LFO1U001UDfjcAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sgVvPODvq6t8U7Hx/zbc63MaRk6LDiWv8vXZ8t1QlIgBNhoPAOIKCPOKihZ4OShwg69tMttxb/mvcV/ZLp5xgTTLPKD16sYMxlHimtoIkSirijFevdUpxLV+xKFDpP4kvUUemDk7t4DKAUeBTe+keUkMcckKm+RJg3dF+AC/ha8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=maowtm.org; spf=pass smtp.mailfrom=maowtm.org; dkim=pass (2048-bit key) header.d=maowtm.org header.i=@maowtm.org header.b=VzDTn9kL; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VQTAbrEG; arc=none smtp.client-ip=202.12.124.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=maowtm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=maowtm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=maowtm.org header.i=@maowtm.org header.b="VzDTn9kL"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VQTAbrEG" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailflow.stl.internal (Postfix) with ESMTP id D4DA11D41A15; Sun, 6 Apr 2025 12:19:47 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Sun, 06 Apr 2025 12:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maowtm.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1743956387; x= 1743959987; bh=iwH/QF/Ctp0KrjjgTmdRrmlkt9WJcBQcpU4nA7uR7AA=; b=V zDTn9kLD3tLLKoHb5kjEvD6wAgMnTFr/j2N1qXTWpIK4dJLvJqPCoeufQmLGDvou EaInVf9+xmfYWBOTbmzSrKMoH1CX9THiFCb9PWA/KyxXtRz8Q5bOQXmv12FGVBDi KfBRSEhqk0LZWWbt9OpKXOdzua3eAUNYxLTnvFND6Ow6Rkxzw3icw1J3Z4HROmh3 t2nl2IADBGRLSllHXkt3NWIa5NM3Y+f0vPk7HHzrTpulx4kiDJLkdLR4ct4Nf6sm 4vb8KFs2hGrdvOVqSDqv3yk851Zh1uinYsm71CLPa5NtgGrzTLlpbAUoVyOxyexa 0zNxeQKng/EnFyUEGgUvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1743956387; x=1743959987; bh=i wH/QF/Ctp0KrjjgTmdRrmlkt9WJcBQcpU4nA7uR7AA=; b=VQTAbrEGJmRnVv+Jd W2iqPQvkvEx8HU2I9eW+pT7KolFpjYP3JkHOA9kn3rmQhoIkgrYNdWMhnSX3Fr6t nnYAR6xOeDnkfZw74Wlx+XOx9hMKb8/58idxP5gq9JwK291zrcHLX+YMMzigPv26 e5Or2qFKVwUJQwkTV6eaEarpo0b1nABfLAyAKd4gLzZXgf24ob8wKBPcNzdtldam 5IEive2D1eEsZaYr0yoP3wOAN2bVCEtMY15fMwiwzuJ7cTTYPLu8AxeJfhlQjP1E fV5xKe7Oh1U+fYclpOC5pWdXpO0fWogdTQWUQJ4dfwEIVGzAlhVDjCYgj+OQh0LW Dud7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleejjeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredt tdenucfhrhhomhepvfhinhhgmhgrohcuhggrnhhguceomhesmhgrohifthhmrdhorhhgqe enucggtffrrghtthgvrhhnpeeuuddthefhhefhvdejteevvddvteefffegteetueegueel jeefueekjeetieeuleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehmsehmrghofihtmhdrohhrghdpnhgspghrtghpthhtohepjedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghrihgtvhhhsehkvghrnhgvlhdrohhrghdprh gtphhtthhopegrshhmrgguvghushestghouggvfihrvggtkhdrohhrghdprhgtphhtthho pehluhgthhhosehiohhnkhhovhdrnhgvthdprhgtphhtthhopehlihhnuhigpghoshhsse gtrhhuuggvsgihthgvrdgtohhmpdhrtghpthhtohepmhesmhgrohifthhmrdhorhhgpdhr tghpthhtohepvhelfhhssehlihhsthhsrdhlihhnuhigrdguvghvpdhrtghpthhtohepmh hitgesughighhikhhougdrnhgvth X-ME-Proxy: Feedback-ID: i580e4893:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Apr 2025 12:19:46 -0400 (EDT) From: Tingmao Wang To: Eric Van Hensbergen , Dominique Martinet , Latchesar Ionkov , Christian Schoenebeck Cc: Tingmao Wang , v9fs@lists.linux.dev, =?utf-8?q?Micka=C3=AB?= =?utf-8?q?l_Sala=C3=BCn?= Subject: [PATCH 1/3] fs/9p: Refresh metadata in d_revalidate for uncached mode too Date: Sun, 6 Apr 2025 17:18:42 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently if another process keeps a file open, due to existing dentry in the dcache, other processes will not see updated metadata of that file if it is changed on the server, even in uncached mode. This can also manifest as -ENODATA when reading a file that has shrunk on the server (even if it's re-opened in another process), or -ENOTSUPP if the file has changed type (e.g. regular file to directory) on the server. We can end up in a situation where both `readdir` or `read` fails until the file is closed by all processes using it. This commit fixes that, and invalidates the dentry altogether if the inode type is changed (for uncached mode). Signed-off-by: Tingmao Wang --- fs/9p/vfs_dentry.c | 11 ++++++++++- fs/9p/vfs_inode.c | 8 +++++++- fs/9p/vfs_inode_dotl.c | 8 +++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 5061f192eafd..7ba9e3498e85 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -66,6 +66,7 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) struct p9_fid *fid; struct inode *inode; struct v9fs_inode *v9inode; + unsigned int cached; if (flags & LOOKUP_RCU) return -ECHILD; @@ -75,7 +76,11 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) goto out_valid; v9inode = V9FS_I(inode); - if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) { + struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); + + cached = v9ses->cache & (CACHE_META | CACHE_LOOSE); + + if (!cached || v9inode->cache_validity & V9FS_INO_INVALID_ATTR) { int retval; struct v9fs_session_info *v9ses; @@ -92,6 +97,8 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) if (retval == -ENOENT) return 0; + if (!cached && v9inode->cache_validity & V9FS_INO_INVALID_ATTR) + return 0; if (retval < 0) return retval; } @@ -127,6 +134,8 @@ const struct dentry_operations v9fs_cached_dentry_operations = { }; const struct dentry_operations v9fs_dentry_operations = { + .d_revalidate = v9fs_lookup_revalidate, + .d_weak_revalidate = __v9fs_lookup_revalidate, .d_delete = always_delete_dentry, .d_release = v9fs_dentry_release, .d_unalias_trylock = v9fs_dentry_unalias_trylock, diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 3e68521f4e2f..1640765563e9 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -1350,8 +1350,14 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) * Don't update inode if the file type is different */ umode = p9mode2unixmode(v9ses, st, &rdev); - if (inode_wrong_type(inode, umode)) + if (inode_wrong_type(inode, umode)) { + /* + * Do this as a way of letting the caller know the inode should not + * be reused + */ + v9fs_invalidate_inode_attr(inode); goto out; + } /* * We don't want to refresh inode->i_size, diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 143ac03b7425..2d025e561ba1 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -902,8 +902,14 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) /* * Don't update inode if the file type is different */ - if (inode_wrong_type(inode, st->st_mode)) + if (inode_wrong_type(inode, st->st_mode)) { + /* + * Do this as a way of letting the caller know the inode should not + * be reused + */ + v9fs_invalidate_inode_attr(inode); goto out; + } /* * We don't want to refresh inode->i_size, From patchwork Sun Apr 6 16:18:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tingmao Wang X-Patchwork-Id: 14039418 Received: from flow-b5-smtp.messagingengine.com (flow-b5-smtp.messagingengine.com [202.12.124.140]) (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 1AB5113EFE3 for ; Sun, 6 Apr 2025 16:19:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743956393; cv=none; b=qtv80KsXV11JlVYobOTJsmqRCENHUMwO02WmtdbBZqCg4GXnDvVnozKUNkdq8mL0WC8JI4uJz52C9ITqBo/XdcYZy7sYjf37a44vadl/r9gnF9LER2QKYpuQMR0wmdAHyBlilivR4BcUoOTGv7zxpUvI7V468ytWF7PI/jYJNqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743956393; c=relaxed/simple; bh=fI3vkS+krf1U6BBkdYKQY/Hab6KZldsn+0ObTSBgNkQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wi1hnhZUWJTwytdMhXOPnR49aFVQC5CaAlFNvc7WUH3sM0iIKDh33RTxSysxd1+T2gqKaUvECgsOdat+d+fZUxI8mz/9IqplehpKK6FbPOv29wEbfgWSfNFErLBbI1g+5W2p47Xp2tQievLHz+3fcI7oagn1q9wJtb8NeLZemaQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=maowtm.org; spf=pass smtp.mailfrom=maowtm.org; dkim=pass (2048-bit key) header.d=maowtm.org header.i=@maowtm.org header.b=lxV1Bf6x; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=b/IhbFRB; arc=none smtp.client-ip=202.12.124.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=maowtm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=maowtm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=maowtm.org header.i=@maowtm.org header.b="lxV1Bf6x"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="b/IhbFRB" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailflow.stl.internal (Postfix) with ESMTP id EAF781D41D73; Sun, 6 Apr 2025 12:19:49 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Sun, 06 Apr 2025 12:19:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maowtm.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1743956389; x= 1743959989; bh=j3If938ipgLaWPPC85FEdL9RC4alBIGT14T+blq0sIQ=; b=l xV1Bf6xYNZw2F3N62VVnUFYe03lJ66bBWRkfaxskcWieUgIqE4TrXWZVxcJtWrYl ea34IjpbK0UFbr99uYl+nd3aEOJwV76JDMcK/p64d2nFJGlgK5gj3wlif3eRIhab dEMR9DOResn9TZxsAoGS/wCnZa/yG7jEn0EnImxwRE25BFTdOCWysquOV/q3jgsB bdNmTfaq6ud+284SQ9AfqKJfFjLLF36ylSLJ7kMpBwwH9EROTrYzG6OjP+IapW9q 1e3M8zuXXjzdKZHJNf7SKJpJpvkFDDgVNeWplQz4nHSz0trjCw2HM6ntFBSmvZ4L i45s7r1Wl+VFuL+8svyuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1743956389; x=1743959989; bh=j 3If938ipgLaWPPC85FEdL9RC4alBIGT14T+blq0sIQ=; b=b/IhbFRB+WYvVzsaF rbgu3LCc+SDz18c2yTLzIqPaSJy/6DMrLDXxRblqG0PTAP2g69udp+sUuQEh6crN 6pA7QWZ4ss204OCLAhrLXem1DR4HQpMfjF9afXtRvGmdkLCF1vN2oTYshSc2Ypdi 5AAKyt7LVrjhwDvh4v4BifcZ/ggNL/qvV0W0cusOFwk/n1wD16eFPX9uCn2SH3XP 4BEp69ZsKYgjQNzy70QnrS+qGio5YG/e0WLFKje+5iVprMphSfSoS40dVLDiCO6u Wr0IE0Vqhn/ZD6XJwotc6QnqELObagToy4HUIaU6f8e0j114xut3+HG4k7e26zsj PmpGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleejjeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredt tdenucfhrhhomhepvfhinhhgmhgrohcuhggrnhhguceomhesmhgrohifthhmrdhorhhgqe enucggtffrrghtthgvrhhnpeeuuddthefhhefhvdejteevvddvteefffegteetueegueel jeefueekjeetieeuleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehmsehmrghofihtmhdrohhrghdpnhgspghrtghpthhtohepjedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghrihgtvhhhsehkvghrnhgvlhdrohhrghdprh gtphhtthhopegrshhmrgguvghushestghouggvfihrvggtkhdrohhrghdprhgtphhtthho pehluhgthhhosehiohhnkhhovhdrnhgvthdprhgtphhtthhopehlihhnuhigpghoshhsse gtrhhuuggvsgihthgvrdgtohhmpdhrtghpthhtohepmhesmhgrohifthhmrdhorhhgpdhr tghpthhtohepvhelfhhssehlihhsthhsrdhlihhnuhigrdguvghvpdhrtghpthhtohepmh hitgesughighhikhhougdrnhgvth X-ME-Proxy: Feedback-ID: i580e4893:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Apr 2025 12:19:48 -0400 (EDT) From: Tingmao Wang To: Eric Van Hensbergen , Dominique Martinet , Latchesar Ionkov , Christian Schoenebeck Cc: Tingmao Wang , v9fs@lists.linux.dev, =?utf-8?q?Micka=C3=AB?= =?utf-8?q?l_Sala=C3=BCn?= Subject: [PATCH 2/3] fs/9p: Invalidate dentry if inode type change detected in cached mode Date: Sun, 6 Apr 2025 17:18:43 +0100 Message-ID: <01afd3c77d5cda181780dc931baa8f3fc54562c8.1743956147.git.m@maowtm.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is an extension of the last commit to cached mode as well. While server-side changes when using cached mode is not expected, when it does happen we can get things like -EOPNOTSUPP. With this change at least when we realize the inode has updated (for example after a `touch` on the client), we can get a new one. Signed-off-by: Tingmao Wang --- fs/9p/vfs_dentry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 7ba9e3498e85..38c494870ffb 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -97,7 +97,7 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) if (retval == -ENOENT) return 0; - if (!cached && v9inode->cache_validity & V9FS_INO_INVALID_ATTR) + if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) return 0; if (retval < 0) return retval; From patchwork Sun Apr 6 16:18:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tingmao Wang X-Patchwork-Id: 14039419 Received: from flow-b5-smtp.messagingengine.com (flow-b5-smtp.messagingengine.com [202.12.124.140]) (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 71CB213EFE3 for ; Sun, 6 Apr 2025 16:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743956396; cv=none; b=sP+1dB5bJWG9Ghug/u8NibC77K3MZQpRHdonIE3TJhH50K3Af17SzZ8lJPE6Wp2zQ2FFAda1SuZDDxSjWlv9rnWD2tIo4At5L+B/enE6mPscZy9VYtGfYb999nZk2+tEAyh4pPo5oqlOFHsRanicrMXISSUiM9qNH2Nc7PoyoRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743956396; c=relaxed/simple; bh=lIn8UtqzdKq2gDobWj2dwSZb7FhYW99dRsr4XD/NQ8o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VdZrBhw5+rO1ZVMW/xjK8hH158/E+T/21Cd5PzmS1ynX2P2AKCXbwI9c8jU8rg4wcEWRsyhDSH+1wcpUjXuBfKPzlFu79Av8m5GG4gx5AbR5hfucMkrRWcb0F4Qh/xhNeLM+Bb1Cm+04BZgwLO4t/6jUk322yyPchAKVm9BFAxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=maowtm.org; spf=pass smtp.mailfrom=maowtm.org; dkim=pass (2048-bit key) header.d=maowtm.org header.i=@maowtm.org header.b=cLXItSVV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Ub/7oQ/z; arc=none smtp.client-ip=202.12.124.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=maowtm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=maowtm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=maowtm.org header.i=@maowtm.org header.b="cLXItSVV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Ub/7oQ/z" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailflow.stl.internal (Postfix) with ESMTP id 60AF41D41A15; Sun, 6 Apr 2025 12:19:52 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Sun, 06 Apr 2025 12:19:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maowtm.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1743956392; x= 1743959992; bh=BeXfQsghkCsYRf2XAe2luXeuvCr4AKRkMSkzfqQlTTM=; b=c LXItSVVXC61/n7hYg8h6o9GG6QwD4NWSRzbEYcyWoDzmR8JQDxWHWeZKUp0Qd/Po ddYEobZiOkXcPuv5uqmcu2KKMR4TFa/A5+w81Btb+gcTfq7tiWOdsY0K/tl+x8OS EN/h7zrhTSnq2uC2VBuO4gjVeBy6+/U+/Pfilw3kCgqMRslDAcFxWz3/3yYM4igJ 96nVxo8uJriZCFsHTtrLh2eLO4Hf9u7CVPVz2wIqk3i460EsUnYn2VP751uZKrID tyvg2klcv320DbwzfwFHR3RdQ4nUDcEDZnI/UC8QXYRsT7GWWTNIO+A/yvv+RB6S K02maMw16fw+qvcZmQLXA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1743956392; x=1743959992; bh=B eXfQsghkCsYRf2XAe2luXeuvCr4AKRkMSkzfqQlTTM=; b=Ub/7oQ/zs4lj7efbb PUJaraF38XeADl3CCu5vugko92I3fsP4NsvByTJi/raHokM0wtNDghxXddfbB3tX tE6MGJ59GKkg+f06vnJHLN69ha6EkZELOsjw9fkhuukrUtNgh7AFPpfUqit9zePi qxH0/+ADHFKUqdnpfRsntio0I2K4U9FTIsVmS3DBR45CDT9LxILg4FGh855/xihA ddzMH4cRoykcliTJuUhYq9wEL7+ia8Og2M9qDjeUmbzyhXHC+fVhd3S6asU4JKlK 06I5N2QQbJqkG6lTX3yob4Pv5p0ueaLeOkLiPwZ8uZjjX51m37hJanojM6W2QKYv tCI/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleejjeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredt tdenucfhrhhomhepvfhinhhgmhgrohcuhggrnhhguceomhesmhgrohifthhmrdhorhhgqe enucggtffrrghtthgvrhhnpeeuuddthefhhefhvdejteevvddvteefffegteetueegueel jeefueekjeetieeuleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehmsehmrghofihtmhdrohhrghdpnhgspghrtghpthhtohepjedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghrihgtvhhhsehkvghrnhgvlhdrohhrghdprh gtphhtthhopegrshhmrgguvghushestghouggvfihrvggtkhdrohhrghdprhgtphhtthho pehluhgthhhosehiohhnkhhovhdrnhgvthdprhgtphhtthhopehlihhnuhigpghoshhsse gtrhhuuggvsgihthgvrdgtohhmpdhrtghpthhtohepmhesmhgrohifthhmrdhorhhgpdhr tghpthhtohepvhelfhhssehlihhsthhsrdhlihhnuhigrdguvghvpdhrtghpthhtohepmh hitgesughighhikhhougdrnhgvth X-ME-Proxy: Feedback-ID: i580e4893:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Apr 2025 12:19:50 -0400 (EDT) From: Tingmao Wang To: Eric Van Hensbergen , Dominique Martinet , Latchesar Ionkov , Christian Schoenebeck Cc: Tingmao Wang , v9fs@lists.linux.dev, =?utf-8?q?Micka=C3=AB?= =?utf-8?q?l_Sala=C3=BCn?= Subject: [PATCH 3/3] fs/9p: Add p9_debug(VFS) in d_revalidate Date: Sun, 6 Apr 2025 17:18:44 +0100 Message-ID: <00829a99549e33d26139fa4d756c466629f13e00.1743956147.git.m@maowtm.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This was a useful debugging / validation aid, and can explain why a GETATTR request is made. Signed-off-by: Tingmao Wang --- fs/9p/vfs_dentry.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 38c494870ffb..0b940d595e34 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -85,8 +85,13 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) struct v9fs_session_info *v9ses; fid = v9fs_fid_lookup(dentry); - if (IS_ERR(fid)) + if (IS_ERR(fid)) { + p9_debug( + P9_DEBUG_VFS, + "v9fs_fid_lookup: dentry = %pd (%p), got error %pe\n", + dentry, dentry, fid); return PTR_ERR(fid); + } v9ses = v9fs_inode2v9ses(inode); if (v9fs_proto_dotl(v9ses)) @@ -95,14 +100,25 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) retval = v9fs_refresh_inode(fid, inode); p9_fid_put(fid); - if (retval == -ENOENT) + if (retval == -ENOENT) { + p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) invalidated due to ENOENT\n", + dentry, dentry); return 0; - if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) + } + if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) { + p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) invalidated due to type change\n", + dentry, dentry); return 0; - if (retval < 0) + } + if (retval < 0) { + p9_debug(P9_DEBUG_VFS, + "refresh inode: dentry = %pd (%p), got error %pe\n", + dentry, dentry, ERR_PTR(retval)); return retval; + } } out_valid: + p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) is valid\n", dentry, dentry); return 1; }