Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111144
b: refs/heads/master
c: 2846d38
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Sep 23, 2008
1 parent 856350f commit 08afdbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 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: 232087cb734c7035c0a8947fb05d3e8092ff6c4d
refs/heads/master: 2846d3864738dd6e290755d0692cf377e09ba79f
10 changes: 9 additions & 1 deletion trunk/fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode)
struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
{
struct cifsFileInfo *open_file;
bool any_available = false;
int rc;

/* Having a null inode here (because mapping->host was set to zero by
Expand All @@ -1080,8 +1081,10 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
read_lock(&GlobalSMBSeslock);
refind_writable:
list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
if (open_file->closePend)
if (open_file->closePend ||
(!any_available && open_file->pid != current->tgid))
continue;

if (open_file->pfile &&
((open_file->pfile->f_flags & O_RDWR) ||
(open_file->pfile->f_flags & O_WRONLY))) {
Expand Down Expand Up @@ -1131,6 +1134,11 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
of the loop here. */
}
}
/* couldn't find useable FH with same pid, try any available */
if (!any_available) {
any_available = true;
goto refind_writable;
}
read_unlock(&GlobalSMBSeslock);
return NULL;
}
Expand Down

0 comments on commit 08afdbe

Please sign in to comment.