Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48541bd3 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French
Browse files

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: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 058daf4f
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -365,9 +365,11 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file)
/* Release a reference on the file private data */
/* Release a reference on the file private data */
static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
{
{
	if (atomic_dec_and_test(&cifs_file->count))
	if (atomic_dec_and_test(&cifs_file->count)) {
		iput(cifs_file->pInode);
		kfree(cifs_file);
		kfree(cifs_file);
	}
	}
}


/*
/*
 * One of these for each file inode
 * One of these for each file inode
+1 −1
Original line number Original line Diff line number Diff line
@@ -147,7 +147,7 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle,


	pCifsFile->netfid = fileHandle;
	pCifsFile->netfid = fileHandle;
	pCifsFile->pid = current->tgid;
	pCifsFile->pid = current->tgid;
	pCifsFile->pInode = newinode;
	pCifsFile->pInode = igrab(newinode);
	pCifsFile->invalidHandle = false;
	pCifsFile->invalidHandle = false;
	pCifsFile->closePend = false;
	pCifsFile->closePend = false;
	mutex_init(&pCifsFile->fh_mutex);
	mutex_init(&pCifsFile->fh_mutex);
+1 −1
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ static inline struct cifsFileInfo *cifs_init_private(
	mutex_init(&private_data->lock_mutex);
	mutex_init(&private_data->lock_mutex);
	INIT_LIST_HEAD(&private_data->llist);
	INIT_LIST_HEAD(&private_data->llist);
	private_data->pfile = file; /* needed for writepage */
	private_data->pfile = file; /* needed for writepage */
	private_data->pInode = inode;
	private_data->pInode = igrab(inode);
	private_data->invalidHandle = false;
	private_data->invalidHandle = false;
	private_data->closePend = false;
	private_data->closePend = false;
	/* Initialize reference count to one.  The private data is
	/* Initialize reference count to one.  The private data is