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=1796221561; b=aZZjEfaHvnyt3pZM2eflWiinE+oEI/CAo+z5jn+wRMm0MBgNHNWhc994d4N+3/W/hwwr t7R7oLhqRg7+eN7sZvfq9NhZawxhbOV1ZFzSKb8R7UdZU77f6Ir17LAAce8hsR5O20Pne OhsFs8zqVUn+hBGqLU2094ukRQHC3jl+nnj0LOpK1qjFKtKV7JPQCbZEey8CRh8ShTOAu HQzn668sVa60xgYhkMNV2C6bcoAxdm4y7xb9CgVFy68y1caUYRR0QgQ9nMPCvz8cUh+14 NUVYPFAjsXERXLQp60Me9KT/ZvKSIQ6BPCE0a0L8h9pTULidp1V71v8BUtv8iKygL/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221561; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=k1oMBv1QiHm1VtiJ+elz5XzMuUz9O97ZmTsB9jyoTxg=; b=oHv4qzThVs3gF2M2wvD7fYaZRZDh6obqtVxOaDINLqMDqliYibyBGAS78nPi5GdU0uLg ztKgApRKVYYcCaJwbhIhvBAq9ofbLVxEHY4H1HNb8Vr0CgI05Xz1N7AQrg8p4UQJpQZ8l Ew27vEa+ty3lvgGJgaBVAzHw6EzfaaSbkqdThT13dBIYAfsdQ1z1M+79kpvGdnNhjrvwv /UnNlLDxeI9ooSg18HR1wwocuM9j6+vn8HLpqQNhn6h5iUPpNBRRz2AW8chpHXAAEJHH8 Jk+CN0t8/qVdKoB8XwdiAjvy/8EdWgu+nbQSGHff7daXCww6xUd9kjDxB/VJ9IcPRUg== 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="M2Tnf/+U"; 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 76868606A31A for ; Wed, 2 Dec 2026 14:26:01 +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=M2Tnf/+U Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8874B1F00897; Wed, 2 Dec 2026 14:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221560; bh=k1oMBv1QiHm1VtiJ+elz5XzMuUz9O97ZmTsB9jyoTxg=; h=Subject:To:Cc:From:Date; b=M2Tnf/+UQNhTYXMsqwkSt652dmg4aJG/O96c3Gxum8l31iLGt7FKsDgvcHwrrBBRR EG1domme0zMrtbDiY5NL6AMVAG0ydSPcwhr7n6dSSEjHJl53r7EGPWaLu/2pddX2P4 AxnkfSVFF9NQ8DVEmqFpDpe13oBsaRaQnDswPrE8= Subject: FAILED: patch "[PATCH] smb: client: fix busy dentry and inode on unmount from late" failed to apply to 6.6-stable tree To: sidchintamaneni@gmail.com,adamkim@microsoft.com,pc@manguebit.org Cc: From: Date: Wed, 02 Dec 2026 14:55:47 +0100 Message-ID: <2026120247-cold-satirical-d9d9@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.6-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.6.y git checkout FETCH_HEAD git cherry-pick -x a10ec8dba77799a0460a4b3dfcac040ac452a325 # git commit -s git send-email --to '' --in-reply-to '2026120247-cold-satirical-d9d9@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From a10ec8dba77799a0460a4b3dfcac040ac452a325 Mon Sep 17 00:00:00 2001 From: Siddharth Chintamaneni Date: Tue, 17 Nov 2026 00:17:32 +0000 Subject: [PATCH] smb: client: fix busy dentry and inode on unmount from late oplock break During unmount, cifs_kill_sb() flushes cifsoplockd_wq and deferredclose_wq before waiting on cifs_sb->outstanding_rreq for in-flight netfs I/O requests to finish their cleanup_work in cifs_free_request(). While cifs_kill_sb() is waiting on outstanding_rreq, any cifsFileInfo referenced by an in-flight request (req->cfile) still has cfile->count >= 1 and remains on tcon->openFileList. If the SMB server sends a lease or oplock break for that file during this window, the demultiplex thread (cifsd) finds cfile on tcon->openFileList and calls cifs_queue_oplock_break(cfile), which takes a new reference on cfile and queues cfile->oplock_break onto cifsoplockd_wq after cifsoplockd_wq was already flushed: Thread 1 (umount) Thread 2 (cifsd) Thread 3 (workers) ----------------- ---------------- ------------------ cifs_kill_sb() flush(cifsoplockd_wq) flush(deferredclose_wq) wait(outstanding_rreq) [blocks: rreq == 1] SMB2 Lease Break finds cfile on list cifs_queue_oplock_break() queue(cifsoplockd_wq) cifsFileInfo_get(cfile) [cfile->count: 1 -> 2] cifs_oplock_break() ihold(inode) 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! Furthermore, cifs_oplock_break() itself holds the inode via ihold() after dropping cfile and may initiate writeback via filemap_fdatawrite(), spawning new netfs I/O requests. Fix this by counting queued oplock breaks in cifs_sb->outstanding_rreq from when cifs_queue_oplock_break() queues the work until cifs_oplock_break() finishes, so wait_var_event() in cifs_kill_sb() waits for both in-flight I/O requests and any late oplock breaks to complete. 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/cifsfs.c b/fs/smb/client/cifsfs.c index 8cff7857b450..9faba158f8b6 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -418,11 +418,11 @@ static void cifs_kill_sb(struct super_block *sb) flush_workqueue(deferredclose_wq); /* - * Wait for all in-flight netfs I/O requests to finish their - * cleanup_work so that any cifsFileInfo final puts they queue - * to fileinfo_put_wq/serverclose_wq have been queued, then - * drain the workqueue so the cfile dentry refs are dropped to - * avoid the busy dentry warning. + * Wait for all in-flight netfs I/O requests and oplock breaks + * to finish so that any cifsFileInfo final puts they queue to + * fileinfo_put_wq/serverclose_wq have been queued, then drain + * the workqueue so the cfile dentry refs are dropped to avoid + * the busy dentry warning. */ wait_var_event(&cifs_sb->outstanding_rreq, !atomic_read(&cifs_sb->outstanding_rreq)); diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index f51653cb6432..146ff2adfa24 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4023,6 +4023,8 @@ void cifs_oplock_break(struct work_struct *work) out: cifs_done_oplock_break(cinode); iput(inode); + if (atomic_dec_and_test(&cifs_sb->outstanding_rreq)) + wake_up_var(&cifs_sb->outstanding_rreq); } #ifdef CONFIG_SWAP diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c index 4d0df73d15d7..a8f4c8644562 100644 --- a/fs/smb/client/misc.c +++ b/fs/smb/client/misc.c @@ -371,6 +371,8 @@ void cifs_put_writer(struct cifsInodeInfo *cinode) */ void cifs_queue_oplock_break(struct cifsFileInfo *cfile) { + struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry); + /* * Bump the handle refcount now while we hold the * open_file_lock to enforce the validity of it for the oplock @@ -379,8 +381,10 @@ void cifs_queue_oplock_break(struct cifsFileInfo *cfile) * * Only take a reference if the work is actually queued. */ - if (queue_work(cifsoplockd_wq, &cfile->oplock_break)) + if (queue_work(cifsoplockd_wq, &cfile->oplock_break)) { cifsFileInfo_get(cfile); + atomic_inc(&cifs_sb->outstanding_rreq); + } } void cifs_done_oplock_break(struct cifsInodeInfo *cinode)