From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9FC0C34D397; Thu, 28 May 2026 20:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000586; cv=none; b=CQXJI/seZWIUUcAfu6MdEQLml7ie7SWg+LMVIbsKK5saEHfFycuGmmAeUhO72pTaPHhRjZiD3qG8Mmlf3zangmmn7d4Hg7EeNGPE1eWjUj+C+dJ0Gp2qDvfI2o2KIYcmZi6tuLwsdRgUSOh0bH/kCZ6xRQ1jRK96fbefKaa+u4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000586; c=relaxed/simple; bh=p3v+4JArcN2xLLqLj4Cy22WBN5UnkMkHo4R8VepTe48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ay7xHxNJUseF5C+8kliOpVEflHWkEZ979i1QDsiYOpmeUhUZORVr8xRLZffA+nkNAq1K47vbOXwx6zYl5/7zG+hBr6sDaX2arGxyAgGv3a585E8IT56raBrWmfweeAj5rqXvYyXSMEuWR8vRVvuXYBFwmZhNY7ikcXqjYTYHoJ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WYLyZeBN; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WYLyZeBN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF111F00A3A; Thu, 28 May 2026 20:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000585; bh=hSyXBhNDRYcJJxzawFXTubFlKdgGEGu4ze/GXfXfpy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WYLyZeBNu11jxUO3adDsSSNWIR3PxXVCtMMOJqfNALRr8xme+SYts/GgKFGQwOYI9 DrMdCcmBlUohQ2Bjsho6O5TUqzikpzh4AUiYsFwCbRFOoH1O8QrUSsfZjYjI01LkIc fdbeBDTQZr70kzkAjud6HCSxFjbldsLGnbB54ylY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shyam Prasad N , Zhihao Cheng , Steve French Subject: [PATCH 6.12 098/272] cifs: Fix busy dentry used after unmounting Date: Thu, 28 May 2026 21:47:52 +0200 Message-ID: <20260528194632.124497563@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194629.379955525@linuxfoundation.org> References: <20260528194629.379955525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhihao Cheng commit c68337442f03953237a94577beb468ab2662a851 upstream. Since commit 340cea84f691c ("cifs: open files should not hold ref on superblock"), cifs file only holds the dentry ref_cnt, the cifs file close work(cfile->deferred) could be executed after unmounting, which will trigger a warning in generic_shutdown_super: BUG: Dentry 00000000a14a6845{i=c,n=file} still in use (1) [unmount of cifs cifs] The detailed processs is: process A process B kworker fd = open(PATH) vfs_open file->__f_path = *path // dentry->d_lockref.count = 1 cifs_open cifs_new_fileinfo cfile->dentry = dget(dentry) // dentry->d_lockref.count = 2 close(fd) __fput cifs_close queue_delayed_work(deferredclose_wq, cfile->deferred) dput(dentry) // dentry->d_lockref.count = 1 smb2_deferred_work_close _cifsFileInfo_put list_del(&cifs_file->flist) umount cleanup_mnt deactivate_super cifs_kill_sb cifs_close_all_deferred_files_sb cifs_close_all_deferred_files // cannot find cfile, skip _cifsFileInfo_put kill_anon_super generic_shutdown_super shrink_dcache_for_umount umount_check WARN ! // dentry->d_lockref.count = 1 cifsFileInfo_put_final dput(cifs_file->dentry) // dentry->d_lockref.count = 0 Fix it by flushing 'deferredclose_wq' before calling kill_anon_super. Fetch a reproducer in https://bugzilla.kernel.org/show_bug.cgi?id=221548. Fixes: 340cea84f691c ("cifs: open files should not hold ref on superblock") Cc: stable@vger.kernel.org Reviewed-by: Shyam Prasad N Signed-off-by: Zhihao Cheng Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/cifsfs.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -299,6 +299,8 @@ static void cifs_kill_sb(struct super_bl /* Wait for all pending oplock breaks to complete */ flush_workqueue(cifsoplockd_wq); + /* Wait for all opened files to release */ + flush_workqueue(deferredclose_wq); /* finally release root dentry */ dput(cifs_sb->root);