aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-09-12 11:54:29 -0400
committerSteve French <sfrench@us.ibm.com>2009-09-15 15:45:25 -0400
commit48541bd3dd4739b4d574b44ea47660c88d833677 (patch)
tree5ee6d16b924b8c171e66088c5bb3b1d1720cd29f /fs/cifs
parent058daf4f6795fd23fcca41fe53151cdcbbd263ec (diff)
cifs: have cifsFileInfo hold an extra inode reference
It's possible that this struct will outlive the filp to which it is attached. If it does and it needs to do some work on the inode, then it'll need a reference. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsglob.h4
-rw-r--r--fs/cifs/dir.c2
-rw-r--r--fs/cifs/file.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 9a7527dc977e..c19419a38f62 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -365,8 +365,10 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file)
365/* Release a reference on the file private data */ 365/* Release a reference on the file private data */
366static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file) 366static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
367{ 367{
368 if (atomic_dec_and_test(&cifs_file->count)) 368 if (atomic_dec_and_test(&cifs_file->count)) {
369 iput(cifs_file->pInode);
369 kfree(cifs_file); 370 kfree(cifs_file);
371 }
370} 372}
371 373
372/* 374/*
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 44f735aa2e3f..36435502b5e8 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -147,7 +147,7 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle,
147 147
148 pCifsFile->netfid = fileHandle; 148 pCifsFile->netfid = fileHandle;
149 pCifsFile->pid = current->tgid; 149 pCifsFile->pid = current->tgid;
150 pCifsFile->pInode = newinode; 150 pCifsFile->pInode = igrab(newinode);
151 pCifsFile->invalidHandle = false; 151 pCifsFile->invalidHandle = false;
152 pCifsFile->closePend = false; 152 pCifsFile->closePend = false;
153 mutex_init(&pCifsFile->fh_mutex); 153 mutex_init(&pCifsFile->fh_mutex);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 225d127c960e..b976cea24102 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -50,7 +50,7 @@ static inline struct cifsFileInfo *cifs_init_private(
50 mutex_init(&private_data->lock_mutex); 50 mutex_init(&private_data->lock_mutex);
51 INIT_LIST_HEAD(&private_data->llist); 51 INIT_LIST_HEAD(&private_data->llist);
52 private_data->pfile = file; /* needed for writepage */ 52 private_data->pfile = file; /* needed for writepage */
53 private_data->pInode = inode; 53 private_data->pInode = igrab(inode);
54 private_data->invalidHandle = false; 54 private_data->invalidHandle = false;
55 private_data->closePend = false; 55 private_data->closePend = false;
56 /* Initialize reference count to one. The private data is 56 /* Initialize reference count to one. The private data is