cifs: Fix potential deadlock when updating vol in cifs_reconnect()
authorPaulo Alcantara (SUSE) <pc@cjr.nz>
Wed, 4 Dec 2019 20:38:02 +0000 (17:38 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 27 Jan 2020 01:24:16 +0000 (19:24 -0600)
commit06d57378bcc9b2c33640945174842115593795d1
treebcb8b54174a3b4c3ed19ddf49ec95768950250c7
parentff2f7fc08268f266372c30a815349749e8499eb5
cifs: Fix potential deadlock when updating vol in cifs_reconnect()

We can't acquire volume lock while refreshing the DFS cache because
cifs_reconnect() may call dfs_cache_update_vol() while we are walking
through the volume list.

To prevent that, make vol_info refcounted, create a temp list with all
volumes eligible for refreshing, and then use it without any locks
held.

Besides, replace vol_lock with a spinlock and protect cache_ttl from
concurrent accesses or changes.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/dfs_cache.c