Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318500
b: refs/heads/master
c: 764a1b1
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Jul 25, 2012
1 parent 06db05e commit f0e7ced
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29e20f9c65fae245d6fd4fce31cc5d01cde3d93f
refs/heads/master: 764a1b1acecedfe204cb2e80d8e2cc7c6df1b0b8
6 changes: 3 additions & 3 deletions trunk/fs/cifs/cifsglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,13 @@ struct cifs_io_parms {
* Take a reference on the file private data. Must be called with
* cifs_file_list_lock held.
*/
static inline
struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file)
static inline void
cifsFileInfo_get_locked(struct cifsFileInfo *cifs_file)
{
++cifs_file->count;
return cifs_file;
}

struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file);
void cifsFileInfo_put(struct cifsFileInfo *cifs_file);

/*
Expand Down
17 changes: 12 additions & 5 deletions trunk/fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,

static void cifs_del_lock_waiters(struct cifsLockInfo *lock);

struct cifsFileInfo *
cifsFileInfo_get(struct cifsFileInfo *cifs_file)
{
spin_lock(&cifs_file_list_lock);
cifsFileInfo_get_locked(cifs_file);
spin_unlock(&cifs_file_list_lock);
return cifs_file;
}

/*
* Release a reference on the file private data. This may involve closing
* the filehandle out on the server. Must be called without holding
Expand Down Expand Up @@ -1562,7 +1571,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode,
if (!open_file->invalidHandle) {
/* found a good file */
/* lock it so it will not be closed on us */
cifsFileInfo_get(open_file);
cifsFileInfo_get_locked(open_file);
spin_unlock(&cifs_file_list_lock);
return open_file;
} /* else might as well continue, and look for
Expand Down Expand Up @@ -1614,7 +1623,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode,
if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
if (!open_file->invalidHandle) {
/* found a good writable file */
cifsFileInfo_get(open_file);
cifsFileInfo_get_locked(open_file);
spin_unlock(&cifs_file_list_lock);
return open_file;
} else {
Expand All @@ -1631,7 +1640,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode,

if (inv_file) {
any_available = false;
cifsFileInfo_get(inv_file);
cifsFileInfo_get_locked(inv_file);
}

spin_unlock(&cifs_file_list_lock);
Expand Down Expand Up @@ -3082,8 +3091,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
break;
}

spin_lock(&cifs_file_list_lock);
spin_unlock(&cifs_file_list_lock);
rdata->cfile = cifsFileInfo_get(open_file);
rdata->mapping = mapping;
rdata->offset = offset;
Expand Down

0 comments on commit f0e7ced

Please sign in to comment.