diff options
| author | Siddharth Chintamaneni <sidchintamaneni@gmail.com> | 2026-11-17 00:17:33 +0000 |
|---|---|---|
| committer | Paulo Alcantara <pc@manguebit.org> | 2026-11-19 10:41:04 -0300 |
| commit | 340ca61e9d31c31403013dc9190550d615844828 (patch) | |
| tree | 5f35a4a8ade58bd4459a4d8a863d1e5375dd16e0 /tools/perf/scripts/python/bin | |
| parent | a10ec8dba77799a0460a4b3dfcac040ac452a325 (diff) | |
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 <adamkim@microsoft.com>
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
