aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-09-29 19:51:11 -0400
committerSteve French <sfrench@us.ibm.com>2010-10-06 12:12:49 -0400
commit13cfb7334eb6fd0fc06da5589aea1e947791f1d6 (patch)
tree56d884f6a5dbcf8b259247fdad55c9158bd4d865 /fs/cifs/cifsglob.h
parent7ffec372458d163492e56e663a1b3a2d7be0a0a2 (diff)
cifs: have cifsFileInfo hold a reference to a tlink rather than tcon pointer
cifsFileInfo needs a pointer to a tcon, but it doesn't currently hold a reference to it. Change it to keep a pointer to a tcon_link instead and hold a reference to it. That will keep the tcon from being freed until the file is closed. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index cdfd2db4e70d..d5324853203b 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -341,6 +341,12 @@ cifs_put_tlink(struct tcon_link *tlink)
341 return; 341 return;
342} 342}
343 343
344static inline struct tcon_link *
345cifs_get_tlink(struct tcon_link *tlink)
346{
347 return tlink;
348}
349
344/* This function is always expected to succeed */ 350/* This function is always expected to succeed */
345static inline struct cifsTconInfo * 351static inline struct cifsTconInfo *
346cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb) 352cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)
@@ -389,7 +395,7 @@ struct cifsFileInfo {
389 struct file *pfile; /* needed for writepage */ 395 struct file *pfile; /* needed for writepage */
390 struct inode *pInode; /* needed for oplock break */ 396 struct inode *pInode; /* needed for oplock break */
391 struct vfsmount *mnt; 397 struct vfsmount *mnt;
392 struct cifsTconInfo *tcon; 398 struct tcon_link *tlink;
393 struct mutex lock_mutex; 399 struct mutex lock_mutex;
394 struct list_head llist; /* list of byte range locks we have. */ 400 struct list_head llist; /* list of byte range locks we have. */
395 bool closePend:1; /* file is marked to close */ 401 bool closePend:1; /* file is marked to close */
@@ -411,6 +417,7 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file)
411static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file) 417static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
412{ 418{
413 if (atomic_dec_and_test(&cifs_file->count)) { 419 if (atomic_dec_and_test(&cifs_file->count)) {
420 cifs_put_tlink(cifs_file->tlink);
414 iput(cifs_file->pInode); 421 iput(cifs_file->pInode);
415 kfree(cifs_file); 422 kfree(cifs_file);
416 } 423 }