diff options
author | Jeff Layton <jlayton@redhat.com> | 2009-09-25 09:53:37 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-09-25 13:59:31 -0400 |
commit | 3321b791b2e8897323f8c044a0c77ff25781381c (patch) | |
tree | cf349723b7b4f48151d10eeaeff322c05fd9de3b /fs/cifs/file.c | |
parent | 15dd478107fb110689ef09d276d84051b31b7e5c (diff) |
cifs: fix locking and list handling code in cifs_open and its helper
The patch to remove cifs_init_private introduced a locking imbalance. It
didn't remove the leftover list addition code and the unlocking in that
function. cifs_new_fileinfo does the list addition now, so there should
be no need to do it outside of that function.
pCifsInode will never be NULL, so we don't need to check for that. This
patch also gets rid of the ugly locking and unlocking across function
calls.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index fee993c92f1a..429337eb7afe 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -201,17 +201,6 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | |||
201 | struct timespec temp; | 201 | struct timespec temp; |
202 | int rc; | 202 | int rc; |
203 | 203 | ||
204 | /* want handles we can use to read with first | ||
205 | in the list so we do not have to walk the | ||
206 | list to search for one in write_begin */ | ||
207 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) { | ||
208 | list_add_tail(&pCifsFile->flist, | ||
209 | &pCifsInode->openFileList); | ||
210 | } else { | ||
211 | list_add(&pCifsFile->flist, | ||
212 | &pCifsInode->openFileList); | ||
213 | } | ||
214 | write_unlock(&GlobalSMBSeslock); | ||
215 | if (pCifsInode->clientCanCacheRead) { | 204 | if (pCifsInode->clientCanCacheRead) { |
216 | /* we have the inode open somewhere else | 205 | /* we have the inode open somewhere else |
217 | no need to discard cache data */ | 206 | no need to discard cache data */ |
@@ -397,6 +386,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
397 | cFYI(1, ("cifs_open returned 0x%x", rc)); | 386 | cFYI(1, ("cifs_open returned 0x%x", rc)); |
398 | goto out; | 387 | goto out; |
399 | } | 388 | } |
389 | |||
400 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, | 390 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, |
401 | file->f_flags); | 391 | file->f_flags); |
402 | file->private_data = pCifsFile; | 392 | file->private_data = pCifsFile; |
@@ -405,14 +395,8 @@ int cifs_open(struct inode *inode, struct file *file) | |||
405 | goto out; | 395 | goto out; |
406 | } | 396 | } |
407 | 397 | ||
408 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | 398 | rc = cifs_open_inode_helper(inode, file, pCifsInode, pCifsFile, tcon, |
409 | if (pCifsInode) { | 399 | &oplock, buf, full_path, xid); |
410 | rc = cifs_open_inode_helper(inode, file, pCifsInode, | ||
411 | pCifsFile, tcon, | ||
412 | &oplock, buf, full_path, xid); | ||
413 | } else { | ||
414 | write_unlock(&GlobalSMBSeslock); | ||
415 | } | ||
416 | 400 | ||
417 | if (oplock & CIFS_CREATE_ACTION) { | 401 | if (oplock & CIFS_CREATE_ACTION) { |
418 | /* time to set mode which we can not set earlier due to | 402 | /* time to set mode which we can not set earlier due to |