"Paulo Alcantara (SUSE)" <pc@xxxxxx> writes: > We can't acquire vol_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. > > Also turn vol_lock into a spinlock rather than a mutex. > > Signed-off-by: Paulo Alcantara (SUSE) <pc@xxxxxx> > --- > fs/cifs/dfs_cache.c | 104 +++++++++++++++++++++++++++++--------------- > 1 file changed, 69 insertions(+), 35 deletions(-) > > diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c > index 1d1f7c03931b..629190926197 100644 > --- a/fs/cifs/dfs_cache.c > +++ b/fs/cifs/dfs_cache.c > @@ -52,12 +52,14 @@ struct vol_info { > struct smb_vol smb_vol; > char *mntdata; > struct list_head list; > + struct list_head rlist; > + int vol_count; > }; If vol_count is going to be accessed/modified from multiple threads without locks there might be races. I think you should use kref https://www.kernel.org/doc/Documentation/kref.txt -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)