From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221571; b=Kez9A7J7t3XbGLw1HuQhlHgW00O+FxcyDjgYrb70GMNdNz1Q0ikcKWRcmA2IGGKjBxy/ 8axL0fD59Zjiz7Qd+h/BLABI+T5h+4vMDP7xGyb7HkSFwrTl5T4T9kGNXm+vYjMwbwKf3 2Nh9B6zLXh3WNBLHwiAw0KgFtD4rLAyFva0BvjCau4P6tIAEtdpHdwfSMZSL/uHkAHBdT LNO010vkHoRz24keBKou7SdGIWBf2uZx/EHEpKPHEUK5+F5pbgwI+NnSSRJ3zP9PAR8xW +601ZbBuSIi1hWJSQ7PMLDZGuBUxfMJEsLfWB2AD1YXds+wh21BmWHzV2fsIn2nWEkw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221571; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=HipN9faDERRH7hzlXnIOETj/tvNiJKZP/jnK6bMGND4=; b=AnVvOdnn16etX+FFjuvM59ebRLcmTgr4eOf7Za+nGh4ZJ5EbAe/M2x1NQ4bXd0P9kZhx qEOCldIK0Gm/7ZUjIG+4qHZEKo59ObQezVDrL+gwxb86ZvGX5gop0HginuuSrxNDJMXmq TnfVFuQfSrIwmhwPlKF1nu/hLkm6nn3yFf1I/cubP2e5ozS9WRezD6msbGEG6JgwGRkmD DUQT6RKh1vY1Pcyibgb4AyTybTPX7GyQv9cuqKUpYyWwYKnZycOea+G1rdL6DugKj5D/k lFYE2eV9nvYT+lzL/uLi2co/dycJd34+eb+DPqs6dZJ3a4V9jCMpPlAFAEJdNdM+/Jw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2Vgxj99F; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 728B4606A31A for ; Wed, 2 Dec 2026 14:26:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2Vgxj99F Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74EFB1F00A15; Wed, 2 Dec 2026 14:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221571; bh=HipN9faDERRH7hzlXnIOETj/tvNiJKZP/jnK6bMGND4=; h=Subject:To:Cc:From:Date; b=2Vgxj99FmIszNtoeKVd7DmQzou6qs8FYMfwSCo+CjVsZ8Jsus+h18C0K9s/tS6ZYg BtXqmsnWKiSzfBcno6xoxPms2lucCH6FBS2N4xTi+0hNA2f8/HjkjU1aVWnnXMNNMf /UX8L9NEKG9/VOFD7UJNwuD9j4zexicElHaV/gAo= Subject: FAILED: patch "[PATCH] smb: client: fix busy dentry on unmount from persistent" failed to apply to 6.12-stable tree To: sidchintamaneni@gmail.com,adamkim@microsoft.com,pc@manguebit.org Cc: From: Date: Wed, 02 Dec 2026 14:56:00 +0100 Message-ID: <2026120200-frantic-defective-e379@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 340ca61e9d31c31403013dc9190550d615844828 # git commit -s git send-email --to '' --in-reply-to '2026120200-frantic-defective-e379@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 340ca61e9d31c31403013dc9190550d615844828 Mon Sep 17 00:00:00 2001 From: Siddharth Chintamaneni Date: Tue, 17 Nov 2026 00:17:33 +0000 Subject: [PATCH] smb: client: fix busy dentry on unmount from persistent handle reopen During unmount, cifs_kill_sb() waits on cifs_sb->outstanding_rreq for in-flight netfs I/O requests and oplock breaks to complete before flushing serverclose_wq and fileinfo_put_wq. While cifs_kill_sb() is waiting on outstanding_rreq, any cifsFileInfo referenced by an in-flight request (req->cfile) remains on tcon->openFileList. On a mount using persistent handles, if a reconnect runs on cifsiod_wq during this window, smb2_reconnect_server() calls cifs_reopen_persistent_handles(), which walks tcon->openFileList and takes a new reference on open_file via cifsFileInfo_get() to reopen the handle over the network: Thread 1 (umount) Thread 2 (cifsiod_wq) Thread 3 (workers) ----------------- --------------------- ------------------ cifs_kill_sb() wait(outstanding_rreq) [blocks: rreq == 1] smb2_reconnect_server() cifs_reopen_persistent_handles() finds open_file on list cifsFileInfo_get(open_file) [cfile->count: 1 -> 2] cifs_reopen_file() cifs_free_request() cifsFileInfo_put() [cfile->count: 2 -> 1] dec(outstanding_rreq) [wakes: rreq == 0] flush(serverclose_wq) flush(fileinfo_put_wq) kill_anon_super(sb) -> generic_shutdown_super() BUG: Dentry still in use (1) VFS: Busy inodes after unmount! Fix this by incrementing cifs_sb->outstanding_rreq when cifs_reopen_persistent_handles() takes a reference on open_file and decrementing it after cifsFileInfo_put(open_file), so wait_var_event() in cifs_kill_sb() waits for any in-progress persistent handle reopen to finish and queue its final put before draining fileinfo_put_wq. Fixes: 340cea84f691 ("cifs: open files should not hold ref on superblock") Cc: stable@vger.kernel.org Reported-by: Adam Kim Signed-off-by: Siddharth Chintamaneni Signed-off-by: Paulo Alcantara diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 146ff2adfa24..d272320436b3 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -2044,6 +2044,7 @@ bool cifs_reopen_persistent_handles(struct cifs_tcon *tcon) { struct cifsFileInfo *open_file, *tmp; + struct cifs_sb_info *cifs_sb; LIST_HEAD(tmp_list); bool retry = false; int rc; @@ -2060,12 +2061,15 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon) list_for_each_entry(open_file, &tcon->openFileList, tlist) { if (!open_file->invalidHandle) continue; + cifs_sb = CIFS_SB(open_file->dentry); cifsFileInfo_get(open_file); + atomic_inc(&cifs_sb->outstanding_rreq); list_add_tail(&open_file->rlist, &tmp_list); } spin_unlock(&tcon->open_file_lock); list_for_each_entry_safe(open_file, tmp, &tmp_list, rlist) { + cifs_sb = CIFS_SB(open_file->dentry); /* do not flush */ rc = cifs_reopen_file(open_file, false, CIFS_REOPEN_BOUND | CIFS_REOPEN_NOWAIT); @@ -2075,6 +2079,8 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon) } list_del_init(&open_file->rlist); cifsFileInfo_put(open_file); + if (atomic_dec_and_test(&cifs_sb->outstanding_rreq)) + wake_up_var(&cifs_sb->outstanding_rreq); } return retry; }