{"id":2226069,"url":"http://patchwork.ozlabs.org/api/patches/2226069/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260422073149.275831-1-ematsumiya@suse.de/","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":"<20260422073149.275831-1-ematsumiya@suse.de>","list_archive_url":null,"date":"2026-04-22T07:31:49","name":"[v3] smb: client: fix (remove) drop_dir_cache module parameter","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5d7301ce6939b937874fc0ba9391d8b3be457b77","submitter":{"id":78375,"url":"http://patchwork.ozlabs.org/api/people/78375/?format=json","name":"Enzo Matsumiya","email":"ematsumiya@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260422073149.275831-1-ematsumiya@suse.de/mbox/","series":[{"id":500935,"url":"http://patchwork.ozlabs.org/api/series/500935/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=500935","date":"2026-04-22T07:31:49","name":"[v3] smb: client: fix (remove) drop_dir_cache module parameter","version":3,"mbox":"http://patchwork.ozlabs.org/series/500935/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2226069/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2226069/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-cifs+bounces-11001-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 (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=MjRtaWGu;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=qhMJ9V+j;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=MjRtaWGu;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=qhMJ9V+j;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11001-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"MjRtaWGu\";\n\tdkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"qhMJ9V+j\";\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"MjRtaWGu\";\n\tdkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"qhMJ9V+j\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=195.135.223.130","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=suse.de","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=suse.de","smtp-out1.suse.de;\n\tdkim=pass header.d=suse.de header.s=susede2_rsa header.b=MjRtaWGu;\n\tdkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=qhMJ9V+j"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\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 4g0rdG3lTbz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 17:36:34 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 768233008A49\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 07:32:02 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 13B3B37266E;\n\tWed, 22 Apr 2026 07:32:01 +0000 (UTC)","from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\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 3B827372B32\n\tfor <linux-cifs@vger.kernel.org>; Wed, 22 Apr 2026 07:31:59 +0000 (UTC)","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby smtp-out1.suse.de (Postfix) with ESMTPS id 268F06A81A;\n\tWed, 22 Apr 2026 07:31:57 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1057D593AF;\n\tWed, 22 Apr 2026 07:31:57 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n\tby imap1.dmz-prg2.suse.org with ESMTPSA\n\tid 23ctAm156GmDQwAAD6G6ig\n\t(envelope-from <ematsumiya@suse.de>); Wed, 22 Apr 2026 07:31:57 +0000"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776843121; cv=none;\n b=EqspVtyDl/x4oatYEeS2se63lc6KqDm9TMI1ttqIOkbztIY1H+mOMIMjdyAI0k9yL7H/axQzqL3yWB6foKwcUW5nM6HldXbM+5R6DM8Z3tkeJt8kxW9rqgCBuaFuAkqIWTnoSlewhruFs3mOKVfcoG37FhhhOml2YfhZqkIFc+s=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776843121; c=relaxed/simple;\n\tbh=hxK0M4N2qAj+7AW3MohMnIUO5Jg09iBVanV0Qsb8qFk=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=IH8KM8kGyvb8W+Swv+P33BZ/d4q5O2h3lbeBO7evB1yrKU+mwi1fCnoAUxLnkUAafoiMaJTRUXfDGSYXn0suqEIR/Bmu0Eg5uKcAIqfxYOa2eqg5BavBOrJwD2m9iCGFj32AN81lYEHP2zzFWP/GiKptHllPNqjercxzNFDE7PI=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=suse.de;\n spf=pass smtp.mailfrom=suse.de;\n dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=MjRtaWGu;\n dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=qhMJ9V+j;\n dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=MjRtaWGu;\n dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=qhMJ9V+j; arc=none smtp.client-ip=195.135.223.130","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n\tt=1776843117;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n  content-transfer-encoding:content-transfer-encoding;\n\tbh=y5qrZRSPKIUFeMfxEBYgbo29b9A90EeEraynZKsTtZk=;\n\tb=MjRtaWGu5FkSbk4PIWrbfuR4XaNUywLYcIVzvxRci/C1vxlx/5RoBcMvsB+v/2qShq96Ly\n\t2U9LPMEg36F2pyF7P5z3lZj9zFHWjZ38ncPJq/AZRSjHk71YnR+6XVAhbcUUM1jNvN+aiJ\n\t3OKQD2obdjPLivIG2m6R/HuNSUADP3w=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n\ts=susede2_ed25519; t=1776843117;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n  content-transfer-encoding:content-transfer-encoding;\n\tbh=y5qrZRSPKIUFeMfxEBYgbo29b9A90EeEraynZKsTtZk=;\n\tb=qhMJ9V+jRW9Tm1fTZQLrTTCh/zkgrO2MYOMvW/nuJ5gdE9GiBUPdZRwum5U1Gs5XO0bLpK\n\tCdcsPwL9oFSs87Dg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n\tt=1776843117;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n  content-transfer-encoding:content-transfer-encoding;\n\tbh=y5qrZRSPKIUFeMfxEBYgbo29b9A90EeEraynZKsTtZk=;\n\tb=MjRtaWGu5FkSbk4PIWrbfuR4XaNUywLYcIVzvxRci/C1vxlx/5RoBcMvsB+v/2qShq96Ly\n\t2U9LPMEg36F2pyF7P5z3lZj9zFHWjZ38ncPJq/AZRSjHk71YnR+6XVAhbcUUM1jNvN+aiJ\n\t3OKQD2obdjPLivIG2m6R/HuNSUADP3w=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n\ts=susede2_ed25519; t=1776843117;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:\n  content-transfer-encoding:content-transfer-encoding;\n\tbh=y5qrZRSPKIUFeMfxEBYgbo29b9A90EeEraynZKsTtZk=;\n\tb=qhMJ9V+jRW9Tm1fTZQLrTTCh/zkgrO2MYOMvW/nuJ5gdE9GiBUPdZRwum5U1Gs5XO0bLpK\n\tCdcsPwL9oFSs87Dg=="],"From":"Enzo Matsumiya <ematsumiya@suse.de>","To":"linux-cifs@vger.kernel.org","Cc":"smfrench@gmail.com,\n\tpc@manguebit.com,\n\tronniesahlberg@gmail.com,\n\tsprasad@microsoft.com,\n\ttom@talpey.com,\n\tbharathsm@microsoft.com,\n\thenrique.carvalho@suse.com","Subject":"[PATCH v3] smb: client: fix (remove) drop_dir_cache module parameter","Date":"Wed, 22 Apr 2026 09:31:49 +0200","Message-ID":"<20260422073149.275831-1-ematsumiya@suse.de>","X-Mailer":"git-send-email 2.53.0","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","X-Spamd-Result":"default: False [-3.01 / 50.00];\n\tBAYES_HAM(-3.00)[100.00%];\n\tNEURAL_HAM_LONG(-1.00)[-1.000];\n\tMID_CONTAINS_FROM(1.00)[];\n\tR_MISSING_CHARSET(0.50)[];\n\tNEURAL_HAM_SHORT(-0.20)[-1.000];\n\tR_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n\tMIME_GOOD(-0.10)[text/plain];\n\tMX_GOOD(-0.01)[];\n\tDBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:mid,suse.de:dkim,suse.de:email];\n\tRCVD_VIA_SMTP_AUTH(0.00)[];\n\tFROM_HAS_DN(0.00)[];\n\tARC_NA(0.00)[];\n\tFUZZY_RATELIMITED(0.00)[rspamd.com];\n\tFREEMAIL_ENVRCPT(0.00)[gmail.com];\n\tMIME_TRACE(0.00)[0:+];\n\tFREEMAIL_CC(0.00)[gmail.com,manguebit.com,microsoft.com,talpey.com,suse.com];\n\tRCVD_TLS_ALL(0.00)[];\n\tRCPT_COUNT_SEVEN(0.00)[8];\n\tTO_MATCH_ENVRCPT_ALL(0.00)[];\n\tTO_DN_NONE(0.00)[];\n\tFROM_EQ_ENVFROM(0.00)[];\n\tRCVD_COUNT_TWO(0.00)[2];\n\tDNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received];\n\tDKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n\tDKIM_TRACE(0.00)[suse.de:+]","X-Rspamd-Action":"no action","X-Spam-Flag":"NO","X-Spam-Score":"-3.01","X-Spam-Level":"","X-Rspamd-Server":"rspamd1.dmz-prg2.suse.org","X-Rspamd-Queue-Id":"268F06A81A"},"content":"Being a module parameter, it's possible to do:\n\n  # modprobe cifs drop_dir_cache=1\n\nWhich will lead to a crash, because cifs_tcp_ses_list hasn't been\ninitialized yet:\n\n  [  168.242624] BUG: kernel NULL pointer dereference, address: 0000000000000010\n  [  168.242952] #PF: supervisor read access in kernel mode\n  [  168.243175] #PF: error_code(0x0000) - not-present page\n  [  168.243394] PGD 0 P4D 0\n  [  168.243524] Oops: Oops: 0000 [#1] SMP NOPTI\n  [  168.243703] CPU: 2 UID: 0 PID: 1105 Comm: modprobe Not tainted 7.0.0-lku #5 PREEMPT(lazy)\n  [  168.244054] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-2-g4f253b9b-prebuilt.qemu.org 04/01/2014\n  [  168.244557] RIP: 0010:cifs_param_set_drop_dir_cache+0x7c/0x100 [cifs]\n  ...\n  [  168.248785] Call Trace:\n  [  168.248915]  <TASK>\n  [  168.249023]  parse_args+0x285/0x3a0\n  [  168.249204]  ? __pfx_unknown_module_param_cb+0x10/0x10\n  [  168.249448]  load_module+0x192b/0x1bb0\n  [  168.249637]  ? __pfx_unknown_module_param_cb+0x10/0x10\n  [  168.249882]  ? kernel_read_file+0x27d/0x2b0\n  [  168.250088]  init_module_from_file+0xce/0xf0\n  [  168.250291]  idempotent_init_module+0xfb/0x2f0\n  [  168.250496]  __x64_sys_finit_module+0x5a/0xa0\n  [  168.250694]  do_syscall_64+0xe0/0x5a0\n  [  168.250863]  ? exc_page_fault+0x65/0x160\n  [  168.251050]  entry_SYSCALL_64_after_hwframe+0x77/0x7f\n  [  168.251284] RIP: 0033:0x7fcaa12b774d\n\nInstead of fixing this with some kind of \"is module initialized\"\napproach, this patch instead moves that functionality to procfs,\nsetting a write op for the existing open_dirs entry, where\nwriting a 0 to it will drop the cached directory entries.\n\nAlso make it available only when CONFIG_CIFS_DEBUG=y.\n\nA small change needed now is to not call flush_delayed_work()\non invalidate_all_cached_dirs() when called from procfs (can't sleep in\nthat context).\nSo add a @sync arg to invalidate_all_cached_dirs() to control when to\nflush the delayed works.\n\nFixes: dde6667fa3c8 (\"smb: client: add drop_dir_cache module parameter to invalidate cached dirents\")\nSigned-off-by: Enzo Matsumiya <ematsumiya@suse.de>\n---\nv3:\n- missing change from CONFIG_CIFS_DEBUG2 to DEBUG\n- change open_dirs entry perms from 0644 to 0600 (when DEBUG=y) to\n  keep similar when DEBUG=n (0400)\n\nv2:\n- change to depend on CONFIG_CIFS_DEBUG instead of DEBUG2 (as per\n  Bharath's request)\n- remove redundant !IS_ENABLED(CONFIG_CIFS_DEBUG2) check from\n  cifs_debug_dirs_proc_write() (already wrapped in ifdef)\n\n\n fs/smb/client/cached_dir.c |  5 ++--\n fs/smb/client/cached_dir.h |  2 +-\n fs/smb/client/cifs_debug.c | 56 ++++++++++++++++++++++++++++++++++++--\n fs/smb/client/cifsfs.c     | 37 -------------------------\n fs/smb/client/file.c       |  2 +-\n fs/smb/client/smb2pdu.c    |  2 +-\n 6 files changed, 59 insertions(+), 45 deletions(-)","diff":"diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c\nindex 04bb95091f49..02791ec3c5a1 100644\n--- a/fs/smb/client/cached_dir.c\n+++ b/fs/smb/client/cached_dir.c\n@@ -593,7 +593,7 @@ void close_all_cached_dirs(struct cifs_sb_info *cifs_sb)\n  * Invalidate all cached dirs when a TCON has been reset\n  * due to a session loss.\n  */\n-void invalidate_all_cached_dirs(struct cifs_tcon *tcon)\n+void invalidate_all_cached_dirs(struct cifs_tcon *tcon, bool sync)\n {\n \tstruct cached_fids *cfids = tcon->cfids;\n \tstruct cached_fid *cfid, *q;\n@@ -625,7 +625,8 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon)\n \n \t/* run laundromat unconditionally now as there might have been previously queued work */\n \tmod_delayed_work(cfid_put_wq, &cfids->laundromat_work, 0);\n-\tflush_delayed_work(&cfids->laundromat_work);\n+\tif (sync)\n+\t\tflush_delayed_work(&cfids->laundromat_work);\n }\n \n static void\ndiff --git a/fs/smb/client/cached_dir.h b/fs/smb/client/cached_dir.h\nindex 19d5592512e4..fc756836da95 100644\n--- a/fs/smb/client/cached_dir.h\n+++ b/fs/smb/client/cached_dir.h\n@@ -90,7 +90,7 @@ void close_cached_dir(struct cached_fid *cfid);\n void drop_cached_dir_by_name(const unsigned int xid, struct cifs_tcon *tcon,\n \t\t\t     const char *name, struct cifs_sb_info *cifs_sb);\n void close_all_cached_dirs(struct cifs_sb_info *cifs_sb);\n-void invalidate_all_cached_dirs(struct cifs_tcon *tcon);\n+void invalidate_all_cached_dirs(struct cifs_tcon *tcon, bool sync);\n bool cached_dir_lease_break(struct cifs_tcon *tcon, __u8 lease_key[16]);\n \n #endif\t\t\t/* _CACHED_DIR_H */\ndiff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c\nindex 0691d2a3e04b..4ed4f55a0bb7 100644\n--- a/fs/smb/client/cifs_debug.c\n+++ b/fs/smb/client/cifs_debug.c\n@@ -306,6 +306,9 @@ static int cifs_debug_dirs_proc_show(struct seq_file *m, void *v)\n \tLIST_HEAD(entry);\n \n \tseq_puts(m, \"# Version:1\\n\");\n+#ifdef CONFIG_CIFS_DEBUG\n+\tseq_puts(m, \"# Write 0 to this file to drop all cached directory entries\\n\");\n+#endif /* CONFIG_CIFS_DEBUG */\n \tseq_puts(m, \"# Format:\\n\");\n \tseq_puts(m, \"# <tree id> <sess id> <persistent fid> <lease-key> <path>\\n\");\n \n@@ -353,6 +356,51 @@ static int cifs_debug_dirs_proc_show(struct seq_file *m, void *v)\n \treturn 0;\n }\n \n+#ifdef CONFIG_CIFS_DEBUG\n+static int cifs_debug_dirs_proc_open(struct inode *inode, struct file *file)\n+{\n+\treturn single_open(file, cifs_debug_dirs_proc_show, NULL);\n+}\n+\n+/* Drop all cached directory entries across all CIFS mounts. */\n+static ssize_t cifs_debug_dirs_proc_write(struct file *file, const char __user *buffer,\n+\t\t\t\t\t  size_t count, loff_t *ppos)\n+{\n+\tint rc, v;\n+\n+\trc = kstrtoint_from_user(buffer, count, 10, &v);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (v == 0) {\n+\t\tstruct TCP_Server_Info *server;\n+\t\tstruct cifs_ses *ses;\n+\t\tstruct cifs_tcon *tcon;\n+\n+\t\tspin_lock(&cifs_tcp_ses_lock);\n+\t\tlist_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {\n+\t\t\tlist_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {\n+\t\t\t\tif (cifs_ses_exiting(ses))\n+\t\t\t\t\tcontinue;\n+\t\t\t\tlist_for_each_entry(tcon, &ses->tcon_list, tcon_list)\n+\t\t\t\t\tinvalidate_all_cached_dirs(tcon, false);\n+\t\t\t}\n+\t\t}\n+\t\tspin_unlock(&cifs_tcp_ses_lock);\n+\t}\n+\n+\treturn count;\n+}\n+\n+static const struct proc_ops cifs_debug_dirs_proc_ops = {\n+\t.proc_open\t= cifs_debug_dirs_proc_open,\n+\t.proc_read\t= seq_read,\n+\t.proc_lseek\t= seq_lseek,\n+\t.proc_release\t= single_release,\n+\t.proc_write\t= cifs_debug_dirs_proc_write,\n+};\n+#endif /* CONFIG_CIFS_DEBUG */\n+\n static __always_inline const char *compression_alg_str(__le16 alg)\n {\n \tswitch (alg) {\n@@ -885,9 +933,11 @@ cifs_proc_init(void)\n \tproc_create_single(\"open_files\", 0400, proc_fs_cifs,\n \t\t\tcifs_debug_files_proc_show);\n \n-\tproc_create_single(\"open_dirs\", 0400, proc_fs_cifs,\n-\t\t\tcifs_debug_dirs_proc_show);\n-\n+#ifdef CONFIG_CIFS_DEBUG\n+\tproc_create(\"open_dirs\", 0600, proc_fs_cifs, &cifs_debug_dirs_proc_ops);\n+#else /* CONFIG_CIFS_DEBUG */\n+\tproc_create_single(\"open_dirs\", 0400, proc_fs_cifs, cifs_debug_dirs_proc_show);\n+#endif /* !CONFIG_CIFS_DEBUG */\n \tproc_create(\"Stats\", 0644, proc_fs_cifs, &cifs_stats_proc_ops);\n \tproc_create(\"cifsFYI\", 0644, proc_fs_cifs, &cifsFYI_proc_ops);\n \tproc_create(\"traceSMB\", 0644, proc_fs_cifs, &traceSMB_proc_ops);\ndiff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c\nindex 081fc1f9447d..9f76b0347fa9 100644\n--- a/fs/smb/client/cifsfs.c\n+++ b/fs/smb/client/cifsfs.c\n@@ -127,43 +127,6 @@ atomic64_t cifs_dircache_bytes_used = ATOMIC64_INIT(0);\n atomic_t cifs_sillycounter;\n atomic_t cifs_tmpcounter;\n \n-/*\n- * Write-only module parameter to drop all cached directory entries across\n- * all CIFS mounts. Echo a non-zero value to trigger.\n- */\n-static void cifs_drop_all_dir_caches(void)\n-{\n-\tstruct TCP_Server_Info *server;\n-\tstruct cifs_ses *ses;\n-\tstruct cifs_tcon *tcon;\n-\n-\tspin_lock(&cifs_tcp_ses_lock);\n-\tlist_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {\n-\t\tlist_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {\n-\t\t\tif (cifs_ses_exiting(ses))\n-\t\t\t\tcontinue;\n-\t\t\tlist_for_each_entry(tcon, &ses->tcon_list, tcon_list)\n-\t\t\t\tinvalidate_all_cached_dirs(tcon);\n-\t\t}\n-\t}\n-\tspin_unlock(&cifs_tcp_ses_lock);\n-}\n-\n-static int cifs_param_set_drop_dir_cache(const char *val, const struct kernel_param *kp)\n-{\n-\tbool bv;\n-\tint rc = kstrtobool(val, &bv);\n-\n-\tif (rc)\n-\t\treturn rc;\n-\tif (bv)\n-\t\tcifs_drop_all_dir_caches();\n-\treturn 0;\n-}\n-\n-module_param_call(drop_dir_cache, cifs_param_set_drop_dir_cache, NULL, NULL, 0200);\n-MODULE_PARM_DESC(drop_dir_cache, \"Write 1 to drop all cached directory entries across all CIFS mounts\");\n-\n #ifdef CONFIG_CIFS_STATS2\n unsigned int slow_rsp_threshold = 1;\n module_param(slow_rsp_threshold, uint, 0644);\ndiff --git a/fs/smb/client/file.c b/fs/smb/client/file.c\nindex f743f058667f..664a2c223089 100644\n--- a/fs/smb/client/file.c\n+++ b/fs/smb/client/file.c\n@@ -393,7 +393,7 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)\n \t}\n \tspin_unlock(&tcon->open_file_lock);\n \n-\tinvalidate_all_cached_dirs(tcon);\n+\tinvalidate_all_cached_dirs(tcon, true);\n \tspin_lock(&tcon->tc_lock);\n \tif (tcon->status == TID_IN_FILES_INVALIDATE)\n \t\ttcon->status = TID_NEED_TCON;\ndiff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c\nindex cd8b49722149..cb61051f9af3 100644\n--- a/fs/smb/client/smb2pdu.c\n+++ b/fs/smb/client/smb2pdu.c\n@@ -2257,7 +2257,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)\n \t}\n \tspin_unlock(&ses->chan_lock);\n \n-\tinvalidate_all_cached_dirs(tcon);\n+\tinvalidate_all_cached_dirs(tcon, true);\n \n \trc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, server,\n \t\t\t\t (void **) &req,\n","prefixes":["v3"]}