summaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorJeff Layton2010-09-30 01:51:11 +0200
committerSteve French2010-10-06 18:12:49 +0200
commit13cfb7334eb6fd0fc06da5589aea1e947791f1d6 (patch)
tree56d884f6a5dbcf8b259247fdad55c9158bd4d865 /fs/cifs/cifsglob.h
parentcifs: add refcounted and timestamped container for holding tcons (diff)
downloadkernel-qcow2-linux-13cfb7334eb6fd0fc06da5589aea1e947791f1d6.tar.gz
kernel-qcow2-linux-13cfb7334eb6fd0fc06da5589aea1e947791f1d6.tar.xz
kernel-qcow2-linux-13cfb7334eb6fd0fc06da5589aea1e947791f1d6.zip
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)
return;
}
+static inline struct tcon_link *
+cifs_get_tlink(struct tcon_link *tlink)
+{
+ return tlink;
+}
+
/* This function is always expected to succeed */
static inline struct cifsTconInfo *
cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)
@@ -389,7 +395,7 @@ struct cifsFileInfo {
struct file *pfile; /* needed for writepage */
struct inode *pInode; /* needed for oplock break */
struct vfsmount *mnt;
- struct cifsTconInfo *tcon;
+ struct tcon_link *tlink;
struct mutex lock_mutex;
struct list_head llist; /* list of byte range locks we have. */
bool closePend:1; /* file is marked to close */
@@ -411,6 +417,7 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file)
static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
{
if (atomic_dec_and_test(&cifs_file->count)) {
+ cifs_put_tlink(cifs_file->tlink);
iput(cifs_file->pInode);
kfree(cifs_file);
}