@@ -52,7 +52,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
5252
5353 dentry = cifs_sb -> root ;
5454
55- cfid = tcon -> cfid ;
55+ cfid = & tcon -> cfids -> cfid ;
5656 mutex_lock (& cfid -> fid_mutex );
5757 if (cfid -> is_valid ) {
5858 cifs_dbg (FYI , "found a cached root file handle\n" );
@@ -226,7 +226,7 @@ int open_cached_dir_by_dentry(struct cifs_tcon *tcon,
226226{
227227 struct cached_fid * cfid ;
228228
229- cfid = tcon -> cfid ;
229+ cfid = & tcon -> cfids -> cfid ;
230230
231231 mutex_lock (& cfid -> fid_mutex );
232232 if (cfid -> dentry == dentry ) {
@@ -320,7 +320,7 @@ void close_all_cached_dirs(struct cifs_sb_info *cifs_sb)
320320 tcon = tlink_tcon (tlink );
321321 if (IS_ERR (tcon ))
322322 continue ;
323- cfid = tcon -> cfid ;
323+ cfid = & tcon -> cfids -> cfid ;
324324 mutex_lock (& cfid -> fid_mutex );
325325 if (cfid -> dentry ) {
326326 dput (cfid -> dentry );
@@ -336,12 +336,14 @@ void close_all_cached_dirs(struct cifs_sb_info *cifs_sb)
336336 */
337337void invalidate_all_cached_dirs (struct cifs_tcon * tcon )
338338{
339- mutex_lock (& tcon -> cfid -> fid_mutex );
340- tcon -> cfid -> is_valid = false;
339+ struct cached_fid * cfid = & tcon -> cfids -> cfid ;
340+
341+ mutex_lock (& cfid -> fid_mutex );
342+ cfid -> is_valid = false;
341343 /* cached handle is not valid, so SMB2_CLOSE won't be sent below */
342- close_cached_dir_lease_locked (tcon -> cfid );
343- memset (& tcon -> cfid -> fid , 0 , sizeof (struct cifs_fid ));
344- mutex_unlock (& tcon -> cfid -> fid_mutex );
344+ close_cached_dir_lease_locked (cfid );
345+ memset (& cfid -> fid , 0 , sizeof (struct cifs_fid ));
346+ mutex_unlock (& cfid -> fid_mutex );
345347}
346348
347349static void
@@ -355,34 +357,36 @@ smb2_cached_lease_break(struct work_struct *work)
355357
356358int cached_dir_lease_break (struct cifs_tcon * tcon , __u8 lease_key [16 ])
357359{
358- if (tcon -> cfid -> is_valid &&
360+ struct cached_fid * cfid = & tcon -> cfids -> cfid ;
361+
362+ if (cfid -> is_valid &&
359363 !memcmp (lease_key ,
360- tcon -> cfid -> fid .lease_key ,
364+ cfid -> fid .lease_key ,
361365 SMB2_LEASE_KEY_SIZE )) {
362- tcon -> cfid -> time = 0 ;
363- INIT_WORK (& tcon -> cfid -> lease_break ,
366+ cfid -> time = 0 ;
367+ INIT_WORK (& cfid -> lease_break ,
364368 smb2_cached_lease_break );
365369 queue_work (cifsiod_wq ,
366- & tcon -> cfid -> lease_break );
370+ & cfid -> lease_break );
367371 return true;
368372 }
369373 return false;
370374}
371375
372- struct cached_fid * init_cached_dir (void )
376+ struct cached_fids * init_cached_dirs (void )
373377{
374- struct cached_fid * cfid ;
378+ struct cached_fids * cfids ;
375379
376- cfid = kzalloc (sizeof (* cfid ), GFP_KERNEL );
377- if (!cfid )
380+ cfids = kzalloc (sizeof (* cfids ), GFP_KERNEL );
381+ if (!cfids )
378382 return NULL ;
379- INIT_LIST_HEAD (& cfid -> dirents .entries );
380- mutex_init (& cfid -> dirents .de_mutex );
381- mutex_init (& cfid -> fid_mutex );
382- return cfid ;
383+ INIT_LIST_HEAD (& cfids -> cfid . dirents .entries );
384+ mutex_init (& cfids -> cfid . dirents .de_mutex );
385+ mutex_init (& cfids -> cfid . fid_mutex );
386+ return cfids ;
383387}
384388
385- void free_cached_dir (struct cifs_tcon * tcon )
389+ void free_cached_dirs (struct cached_fids * cfids )
386390{
387- kfree (tcon -> cfid );
391+ kfree (cfids );
388392}
0 commit comments