aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
authorSuresh Jayaraman <sjayaraman@suse.de>2010-09-17 09:26:39 -0400
committerSteve French <sfrench@us.ibm.com>2010-09-29 15:04:28 -0400
commitaa91c7e4ab9b0842b7d7a7cbf8cca18b20df89b5 (patch)
tree94827b3006d85b8accf179ea3da30e1569983e68 /fs/cifs/dir.c
parenta347ecb209b58a1b37f20d8299ab552f7d3ee8c3 (diff)
cifs: fix broken oplock handling
cifs_new_fileinfo() does not use the 'oplock' value from the callers. Instead, it sets it to REQ_OPLOCK which seems wrong. We should be using the oplock value obtained from the Server to set the inode's clientCanCacheAll or clientCanCacheRead flags. Fix this by passing oplock from the callers to cifs_new_fileinfo(). This change dates back to commit a6ce4932 (2.6.30-rc3). So, all the affected versions will need this fix. Please Cc stable once reviewed and accepted. Cc: Stable <stable@kernel.org> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index f9ed0751cc12..0f947bf73f8e 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -132,9 +132,9 @@ cifs_bp_rename_retry:
132 132
133struct cifsFileInfo * 133struct cifsFileInfo *
134cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, 134cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
135 struct file *file, struct vfsmount *mnt, unsigned int oflags) 135 struct file *file, struct vfsmount *mnt, unsigned int oflags,
136 __u32 oplock)
136{ 137{
137 int oplock = 0;
138 struct cifsFileInfo *pCifsFile; 138 struct cifsFileInfo *pCifsFile;
139 struct cifsInodeInfo *pCifsInode; 139 struct cifsInodeInfo *pCifsInode;
140 struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); 140 struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb);
@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
143 if (pCifsFile == NULL) 143 if (pCifsFile == NULL)
144 return pCifsFile; 144 return pCifsFile;
145 145
146 if (oplockEnabled)
147 oplock = REQ_OPLOCK;
148
149 pCifsFile->netfid = fileHandle; 146 pCifsFile->netfid = fileHandle;
150 pCifsFile->pid = current->tgid; 147 pCifsFile->pid = current->tgid;
151 pCifsFile->pInode = igrab(newinode); 148 pCifsFile->pInode = igrab(newinode);
@@ -468,7 +465,7 @@ cifs_create_set_dentry:
468 } 465 }
469 466
470 pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, 467 pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp,
471 nd->path.mnt, oflags); 468 nd->path.mnt, oflags, oplock);
472 if (pfile_info == NULL) { 469 if (pfile_info == NULL) {
473 fput(filp); 470 fput(filp);
474 CIFSSMBClose(xid, tcon, fileHandle); 471 CIFSSMBClose(xid, tcon, fileHandle);
@@ -729,7 +726,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
729 726
730 cfile = cifs_new_fileinfo(newInode, fileHandle, filp, 727 cfile = cifs_new_fileinfo(newInode, fileHandle, filp,
731 nd->path.mnt, 728 nd->path.mnt,
732 nd->intent.open.flags); 729 nd->intent.open.flags,
730 oplock);
733 if (cfile == NULL) { 731 if (cfile == NULL) {
734 fput(filp); 732 fput(filp);
735 CIFSSMBClose(xid, pTcon, fileHandle); 733 CIFSSMBClose(xid, pTcon, fileHandle);