@@ -49,17 +49,6 @@ struct cache_entry {
4949	struct  cache_dfs_tgt  * tgthint ;
5050};
5151
52- /* List of referral server sessions per dfs mount */ 
53- struct  mount_group  {
54- 	struct  list_head  list ;
55- 	uuid_t  id ;
56- 	struct  cifs_ses  * sessions [CACHE_MAX_ENTRIES ];
57- 	int  num_sessions ;
58- 	spinlock_t  lock ;
59- 	struct  list_head  refresh_list ;
60- 	struct  kref  refcount ;
61- };
62- 
6352static  struct  kmem_cache  * cache_slab  __read_mostly ;
6453static  struct  workqueue_struct  * dfscache_wq  __read_mostly ;
6554
@@ -76,85 +65,10 @@ static atomic_t cache_count;
7665static  struct  hlist_head  cache_htable [CACHE_HTABLE_SIZE ];
7766static  DECLARE_RWSEM (htable_rw_lock );
7867
79- static  LIST_HEAD (mount_group_list );
80- static  DEFINE_MUTEX (mount_group_list_lock );
81- 
8268static  void  refresh_cache_worker (struct  work_struct  * work );
8369
8470static  DECLARE_DELAYED_WORK (refresh_task , refresh_cache_worker );
8571
86- static  void  __mount_group_release (struct  mount_group  * mg )
87- {
88- 	int  i ;
89- 
90- 	for  (i  =  0 ; i  <  mg -> num_sessions ; i ++ )
91- 		cifs_put_smb_ses (mg -> sessions [i ]);
92- 	kfree (mg );
93- }
94- 
95- static  void  mount_group_release (struct  kref  * kref )
96- {
97- 	struct  mount_group  * mg  =  container_of (kref , struct  mount_group , refcount );
98- 
99- 	mutex_lock (& mount_group_list_lock );
100- 	list_del (& mg -> list );
101- 	mutex_unlock (& mount_group_list_lock );
102- 	__mount_group_release (mg );
103- }
104- 
105- static  struct  mount_group  * find_mount_group_locked (const  uuid_t  * id )
106- {
107- 	struct  mount_group  * mg ;
108- 
109- 	list_for_each_entry (mg , & mount_group_list , list ) {
110- 		if  (uuid_equal (& mg -> id , id ))
111- 			return  mg ;
112- 	}
113- 	return  ERR_PTR (- ENOENT );
114- }
115- 
116- static  struct  mount_group  * __get_mount_group_locked (const  uuid_t  * id )
117- {
118- 	struct  mount_group  * mg ;
119- 
120- 	mg  =  find_mount_group_locked (id );
121- 	if  (!IS_ERR (mg ))
122- 		return  mg ;
123- 
124- 	mg  =  kmalloc (sizeof (* mg ), GFP_KERNEL );
125- 	if  (!mg )
126- 		return  ERR_PTR (- ENOMEM );
127- 	kref_init (& mg -> refcount );
128- 	uuid_copy (& mg -> id , id );
129- 	mg -> num_sessions  =  0 ;
130- 	spin_lock_init (& mg -> lock );
131- 	list_add (& mg -> list , & mount_group_list );
132- 	return  mg ;
133- }
134- 
135- static  struct  mount_group  * get_mount_group (const  uuid_t  * id )
136- {
137- 	struct  mount_group  * mg ;
138- 
139- 	mutex_lock (& mount_group_list_lock );
140- 	mg  =  __get_mount_group_locked (id );
141- 	if  (!IS_ERR (mg ))
142- 		kref_get (& mg -> refcount );
143- 	mutex_unlock (& mount_group_list_lock );
144- 
145- 	return  mg ;
146- }
147- 
148- static  void  free_mount_group_list (void )
149- {
150- 	struct  mount_group  * mg , * tmp_mg ;
151- 
152- 	list_for_each_entry_safe (mg , tmp_mg , & mount_group_list , list ) {
153- 		list_del_init (& mg -> list );
154- 		__mount_group_release (mg );
155- 	}
156- }
157- 
15872/** 
15973 * dfs_cache_canonical_path - get a canonical DFS path 
16074 * 
@@ -704,7 +618,6 @@ void dfs_cache_destroy(void)
704618{
705619	cancel_delayed_work_sync (& refresh_task );
706620	unload_nls (cache_cp );
707- 	free_mount_group_list ();
708621	flush_cache_ents ();
709622	kmem_cache_destroy (cache_slab );
710623	destroy_workqueue (dfscache_wq );
@@ -1111,54 +1024,6 @@ int dfs_cache_get_tgt_referral(const char *path, const struct dfs_cache_tgt_iter
11111024	return  rc ;
11121025}
11131026
1114- /** 
1115-  * dfs_cache_add_refsrv_session - add SMB session of referral server 
1116-  * 
1117-  * @mount_id: mount group uuid to lookup. 
1118-  * @ses: reference counted SMB session of referral server. 
1119-  */ 
1120- void  dfs_cache_add_refsrv_session (const  uuid_t  * mount_id , struct  cifs_ses  * ses )
1121- {
1122- 	struct  mount_group  * mg ;
1123- 
1124- 	if  (WARN_ON_ONCE (!mount_id  ||  uuid_is_null (mount_id ) ||  !ses ))
1125- 		return ;
1126- 
1127- 	mg  =  get_mount_group (mount_id );
1128- 	if  (WARN_ON_ONCE (IS_ERR (mg )))
1129- 		return ;
1130- 
1131- 	spin_lock (& mg -> lock );
1132- 	if  (mg -> num_sessions  <  ARRAY_SIZE (mg -> sessions ))
1133- 		mg -> sessions [mg -> num_sessions ++ ] =  ses ;
1134- 	spin_unlock (& mg -> lock );
1135- 	kref_put (& mg -> refcount , mount_group_release );
1136- }
1137- 
1138- /** 
1139-  * dfs_cache_put_refsrv_sessions - put all referral server sessions 
1140-  * 
1141-  * Put all SMB sessions from the given mount group id. 
1142-  * 
1143-  * @mount_id: mount group uuid to lookup. 
1144-  */ 
1145- void  dfs_cache_put_refsrv_sessions (const  uuid_t  * mount_id )
1146- {
1147- 	struct  mount_group  * mg ;
1148- 
1149- 	if  (!mount_id  ||  uuid_is_null (mount_id ))
1150- 		return ;
1151- 
1152- 	mutex_lock (& mount_group_list_lock );
1153- 	mg  =  find_mount_group_locked (mount_id );
1154- 	if  (IS_ERR (mg )) {
1155- 		mutex_unlock (& mount_group_list_lock );
1156- 		return ;
1157- 	}
1158- 	mutex_unlock (& mount_group_list_lock );
1159- 	kref_put (& mg -> refcount , mount_group_release );
1160- }
1161- 
11621027/* Extract share from DFS target and return a pointer to prefix path or NULL */ 
11631028static  const  char  * parse_target_share (const  char  * target , char  * * share )
11641029{
@@ -1384,11 +1249,6 @@ int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb)
13841249		cifs_dbg (FYI , "%s: not a dfs mount\n" , __func__ );
13851250		return  0 ;
13861251	}
1387- 
1388- 	if  (uuid_is_null (& cifs_sb -> dfs_mount_id )) {
1389- 		cifs_dbg (FYI , "%s: no dfs mount group id\n" , __func__ );
1390- 		return  - EINVAL ;
1391- 	}
13921252	/* 
13931253	 * After reconnecting to a different server, unique ids won't match anymore, so we disable 
13941254	 * serverino. This prevents dentry revalidation to think the dentry are stale (ESTALE). 
0 commit comments