{"id":2225527,"url":"http://patchwork.ozlabs.org/api/patches/2225527/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260421063955.99164-3-sprasad@microsoft.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260421063955.99164-3-sprasad@microsoft.com>","list_archive_url":null,"date":"2026-04-21T06:39:51","name":"[v2,3/7] cifs: invalidate cfid on unlink/rename/rmdir","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a31a1adfd5ea52a0e35c676d0258a1ef4219a247","submitter":{"id":79368,"url":"http://patchwork.ozlabs.org/api/people/79368/?format=json","name":"Shyam Prasad N","email":"nspmangalore@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260421063955.99164-3-sprasad@microsoft.com/mbox/","series":[{"id":500744,"url":"http://patchwork.ozlabs.org/api/series/500744/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=500744","date":"2026-04-21T06:39:49","name":"[v2,1/7] cifs: change_conf needs to be called for session setup","version":2,"mbox":"http://patchwork.ozlabs.org/series/500744/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225527/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225527/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-cifs+bounces-10977-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=P3tNBUjv;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10977-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"P3tNBUjv\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.215.171","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0CQy281xz1yJG\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 16:40:26 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 3A2F4301626A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 06:40:18 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E696319F11B;\n\tTue, 21 Apr 2026 06:40:15 +0000 (UTC)","from mail-pg1-f171.google.com (mail-pg1-f171.google.com\n [209.85.215.171])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D524386576\n\tfor <linux-cifs@vger.kernel.org>; Tue, 21 Apr 2026 06:40:14 +0000 (UTC)","by mail-pg1-f171.google.com with SMTP id\n 41be03b00d2f7-c795f441ff7so2736953a12.2\n        for <linux-cifs@vger.kernel.org>;\n Mon, 20 Apr 2026 23:40:14 -0700 (PDT)","from sprasad-dev1.corp.microsoft.com ([167.220.110.184])\n        by smtp.gmail.com with ESMTPSA id\n 41be03b00d2f7-c7977031729sm10032811a12.25.2026.04.20.23.40.12\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Mon, 20 Apr 2026 23:40:12 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776753615; cv=none;\n b=JKosQgcnu8n7zaXJeB4Mr9lJeWxVYOXYZNw6TEHKLGG2vDq9GXJyr5N8wS/leUxhhvbTohrE3Dp/X3pqVV4R27dHdcQQGbeIqESXlYXVDjIcrv8a8mIZWPad6NarkoxpMrD9lqcF4ikGRvAuBLm4U84n3VJM+lxgOalXhUNSNbs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776753615; c=relaxed/simple;\n\tbh=wQe+RhB85yi02jo020KLvcVHTJCqLGplUXNCsaMyMYA=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=gR0iy9BZfvaXCxU+MdnvNMmBIsDJ40Hp5V5JoZTwGdNTuvguNs7E2I5Rlm3yuc6QL5kT0F/q9sBETGc5GfrNt5ruudunMdX7QDSMuohnUHm7wY2Kq5HP3mt8xem+6+A6tjhdvIZ9SHt5HFVUHPpQREz86n9kp3Pf6T0d+WzkHbw=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=P3tNBUjv; arc=none smtp.client-ip=209.85.215.171","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776753614; x=1777358414;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=vJ/ecoS+iyPaqh9vg50r98KJRrVZjWdsD/kOJ7GPw5M=;\n        b=P3tNBUjvHk7/yyiD6NN4wksXextE7m1w5/1e4LRaS+DxsbcB0/IOyJIown9dIUrGXg\n         KUnGkX+OWg71JBivNPefsDqM2kwsO/t2qr3ke5ql1HltxWXKqXv6auOtL8BXb/MFyTWo\n         EXcaVCJQ93u6QXjCgclmrDMyY2O3iignPMzjaZhslz+FWa/e8tKMqa8yLJOF3Su2bF94\n         rkNfQlgGrH84ctGEKaSpVmevdoBYtN6fmbDT1nrVt+24j3LtgE7W62VKyzC6MkML8pGA\n         PVcIcZvjUriElTeIK75Q3JH+EnO+mEhZ4qCvShy1iEuqAX1XgY23JOg55pQN77XLbnls\n         N5aA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776753614; x=1777358414;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=vJ/ecoS+iyPaqh9vg50r98KJRrVZjWdsD/kOJ7GPw5M=;\n        b=QdnE8R7JcUhHpR48A8UuXZEGQTxn9vpWGvMj2ZxKm0Wyh5LPOH2F2IFb4sS6xZp2zj\n         pdBbe45IaDWu+RqR4OVncOvOS1pHlTNh97Vfl8W+YBxFGAMLz0t068C6vRdrZxoh/UxK\n         r3DTWNP3cV7LpFgxMSTx3aRavlDOkJR7Ih4alGAJiRbtZzmxp6LuynJY36pV8M2HrY5c\n         t7+9bY5wqq+vZtACvp/RFursDhPvVkfZ5e6AbO8dKMNntPUba2elrUvS2CjCEOIWJqO3\n         1F3HPWieh+b4OF/FlvZVxpn1ccuNYOfZrpHxrDKSkRW8HL4co6jDfWx9suEKYE9mS+JM\n         MDIw==","X-Gm-Message-State":"AOJu0YxLsFCqng47Ykagm+sPuhFfI0kKHoDkt+Kk4x5xHrINUx/J1q+e\n\tZuEpI9lNmU+cKJAbcaz1VC/6A4fjB2zLR3HocpK+TbO1BwGWkkXaL6r9QNarwSkPHH0=","X-Gm-Gg":"AeBDietZ9lI3xXY6Q8tYWqZ9R9aTfsR/GUByyDp+LJFA4rRZNWx3tpauhj/vwSHflG2\n\tpaRKt5GQ33V+fBm0QvF1OcVs7EO2yWfQr8fbluCYhH5gvhX30NY/FJqsnyS00ndL0GUUyZHeMa9\n\tfBBZIFz8+MAZjfv59ut/ugl56ADQMGOToCtnkQDIehtNlrJqs3mZIJGPYPCFrjEeI0zHInmxW4E\n\tmMNuTD23NnH4dwE5JftxhqH+Po7LxWFNo0oUpXD6noDOiBTUYEpkHSuDQVQ1tjBqXCZV0qq9scg\n\txZnRQ223DpI08XaJUJ/XjDsyrMj3LjhC0j5ClKU5J54dgIvMZEvBPMf/0qWXtuc4BnWlCFf5L/C\n\to8dR93U5n1fmarqsbxY6U2GEmodTyIF+UBhjFRgb9UuqOkRVdvOAvu9eVm0Oy4rsuz1XEeAkDgu\n\tXytOue+MatVebk64fN2TezxixpD8ZisjEOlu+pQJKn1xo7pjG3MUILmWTRxhuvQ4bI","X-Received":"by 2002:a05:6a20:12c7:b0:3a1:1120:7971 with SMTP id\n adf61e73a8af0-3a11120834amr9191071637.18.1776753613406;\n        Mon, 20 Apr 2026 23:40:13 -0700 (PDT)","From":"nspmangalore@gmail.com","X-Google-Original-From":"sprasad@microsoft.com","To":"linux-cifs@vger.kernel.org,\n\tsmfrench@gmail.com,\n\tpc@manguebit.org,\n\tbharathsm@microsoft.com,\n\tdhowells@redhat.com,\n\thenrique.carvalho@suse.com,\n\tematsumiya@suse.de","Cc":"Shyam Prasad N <sprasad@microsoft.com>,\n\tstable@vger.kernel.org","Subject":"[PATCH v2 3/7] cifs: invalidate cfid on unlink/rename/rmdir","Date":"Tue, 21 Apr 2026 12:09:51 +0530","Message-ID":"<20260421063955.99164-3-sprasad@microsoft.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260421063955.99164-1-sprasad@microsoft.com>","References":"<20260421063955.99164-1-sprasad@microsoft.com>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"From: Shyam Prasad N <sprasad@microsoft.com>\n\nToday we do not invalidate the cached_dirent or the entire\nparent cfid when a dentry in a dir has been removed/moved.\n\nThis change invalidates the parent cfid so that we don't serve\ndirectory contents from the cache.\n\nCc: <stable@vger.kernel.org>\nSigned-off-by: Shyam Prasad N <sprasad@microsoft.com>\n---\n fs/smb/client/inode.c | 40 ++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 38 insertions(+), 2 deletions(-)","diff":"diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c\nindex 888f9e35f14b8..e077df844c819 100644\n--- a/fs/smb/client/inode.c\n+++ b/fs/smb/client/inode.c\n@@ -28,6 +28,23 @@\n #include \"cached_dir.h\"\n #include \"reparse.h\"\n \n+static void cifs_invalidate_cached_dir(struct cifs_tcon *tcon,\n+\t\t\t\t       struct dentry *parent)\n+{\n+\tstruct cached_fid *parent_cfid = NULL;\n+\n+\tif (!tcon || !parent)\n+\t\treturn;\n+\n+\tif (!open_cached_dir_by_dentry(tcon, parent, &parent_cfid)) {\n+\t\tmutex_lock(&parent_cfid->dirents.de_mutex);\n+\t\tparent_cfid->dirents.is_valid = false;\n+\t\tparent_cfid->dirents.is_failed = true;\n+\t\tmutex_unlock(&parent_cfid->dirents.de_mutex);\n+\t\tclose_cached_dir(parent_cfid);\n+\t}\n+}\n+\n /*\n  * Set parameters for the netfs library\n  */\n@@ -322,7 +339,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,\n \t\t\t\tfattr->cf_uid = uid;\n \t\t}\n \t}\n-\t\n+\n \tfattr->cf_gid = cifs_sb->ctx->linux_gid;\n \tif (!(sbflags & CIFS_MOUNT_OVERR_GID)) {\n \t\tu64 id = le64_to_cpu(info->Gid);\n@@ -2067,6 +2084,9 @@ static int __cifs_unlink(struct inode *dir, struct dentry *dentry, bool sillyren\n \t\tcifs_set_file_info(inode, attrs, xid, full_path, origattr);\n \n out_reval:\n+\tif (!rc && dentry->d_parent)\n+\t\tcifs_invalidate_cached_dir(tcon, dentry->d_parent);\n+\n \tif (inode) {\n \t\tcifs_inode = CIFS_I(inode);\n \t\tcifs_inode->time = 0;\t/* will force revalidate to get info\n@@ -2378,7 +2398,6 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)\n \t}\n \n \trc = server->ops->rmdir(xid, tcon, full_path, cifs_sb);\n-\tcifs_put_tlink(tlink);\n \n \tcifsInode = CIFS_I(d_inode(direntry));\n \n@@ -2388,6 +2407,8 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)\n \t\ti_size_write(d_inode(direntry), 0);\n \t\tclear_nlink(d_inode(direntry));\n \t\tspin_unlock(&d_inode(direntry)->i_lock);\n+\t\tif (direntry->d_parent)\n+\t\t\tcifs_invalidate_cached_dir(tcon, direntry->d_parent);\n \t}\n \n \t/* force revalidate to go get info when needed */\n@@ -2402,6 +2423,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)\n \n \tinode_set_ctime_current(d_inode(direntry));\n \tinode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));\n+\tcifs_put_tlink(tlink);\n \n rmdir_exit:\n \tfree_dentry_path(page);\n@@ -2501,6 +2523,8 @@ cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir,\n \tstruct cifs_sb_info *cifs_sb;\n \tstruct tcon_link *tlink;\n \tstruct cifs_tcon *tcon;\n+\tstruct dentry *source_parent;\n+\tstruct dentry *target_parent;\n \tbool rehash = false;\n \tunsigned int xid;\n \tint rc, tmprc;\n@@ -2532,6 +2556,8 @@ cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir,\n \tif (IS_ERR(tlink))\n \t\treturn PTR_ERR(tlink);\n \ttcon = tlink_tcon(tlink);\n+\tsource_parent = source_dentry->d_parent ? dget(source_dentry->d_parent) : NULL;\n+\ttarget_parent = target_dentry->d_parent ? dget(target_dentry->d_parent) : NULL;\n \tserver = tcon->ses->server;\n \n \tpage1 = alloc_dentry_path();\n@@ -2668,11 +2694,21 @@ cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir,\n \t}\n \n \t/* force revalidate to go get info when needed */\n+\tif (!rc) {\n+\t\tcifs_invalidate_cached_dir(tcon, source_parent);\n+\t\tif (target_parent != source_parent)\n+\t\t\tcifs_invalidate_cached_dir(tcon, target_parent);\n+\t}\n+\n \tCIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0;\n \n cifs_rename_exit:\n \tif (rehash)\n \t\td_rehash(target_dentry);\n+\tif (target_parent)\n+\t\tdput(target_parent);\n+\tif (source_parent)\n+\t\tdput(source_parent);\n \tkfree(info_buf_source);\n \tfree_dentry_path(page2);\n \tfree_dentry_path(page1);\n","prefixes":["v2","3/7"]}