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 D159F2459D1; Thu, 28 May 2026 20:19:06 +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=1779999547; cv=none; b=kz+xid9YOumHDYUxfWvoN2+go6ScX+mmTmoT0b9axedMc6A6QFymiSlG4DAGubFMLT9z7PAYxk/pVqLeULI688QVk6OdRh+WEYuLr84dZTEv3avo1nvjVpAtmBKynj7M67gx6YUh+PSj7PWCEe95yjRSMhev3Ss/kLHA4ELlbMI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999547; c=relaxed/simple; bh=FhD7ippQOT+lXV8jZVcKXsyktF8PYl7MgMmF+SbP/k4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ILGrtHokEJj6sXvSMTwm0RpxtXqUdFX/vc/SK0HDjl49/hIB6Rf6czMYAk3w1zz6dzL2ZU/jwZ6lZvZW1ceVGj+xEsxk86g1beOit4UttlUmS99m6SvBaJNEIhnvbqyYwcdV9K0l4lja3JgReb2d0P33pPmznRAD+Nnq0/X3nB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QqWsbrIB; 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="QqWsbrIB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1D3D1F000E9; Thu, 28 May 2026 20:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779999546; bh=h7vsd3em1V13xr4P60owm7zxOGjPoDJsBCiAAqwsyHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QqWsbrIBcMpeu5eZSEJm4HDQfzXdekEZbfFMNeF1DyIQIMKCO+Cx/LLiuIs4nRc0V pq5d2qJwAWo/q9I5th3J8HZq71F/+Y50r5kbP7hjMCydMCbXZOSIS4MFWBZH7DJgZM WQafMkHmi8QN24oCCBeV213Ik/PzC4Su5txxpibo= 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.18 104/377] cifs: Fix busy dentry used after unmounting Date: Thu, 28 May 2026 21:45:42 +0200 Message-ID: <20260528194641.356781080@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -338,6 +338,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);