提交 aa91c7e4 编写于 作者: S Suresh Jayaraman 提交者: Steve French

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: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NSuresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 a347ecb2
...@@ -107,7 +107,8 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, ...@@ -107,7 +107,8 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode, extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode,
__u16 fileHandle, struct file *file, __u16 fileHandle, struct file *file,
struct vfsmount *mnt, unsigned int oflags); struct vfsmount *mnt, unsigned int oflags,
__u32 oplock);
extern int cifs_posix_open(char *full_path, struct inode **pinode, extern int cifs_posix_open(char *full_path, struct inode **pinode,
struct super_block *sb, struct super_block *sb,
int mode, int oflags, int mode, int oflags,
......
...@@ -132,9 +132,9 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -132,9 +132,9 @@ build_path_from_dentry(struct dentry *direntry)
struct cifsFileInfo * struct cifsFileInfo *
cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
struct file *file, struct vfsmount *mnt, unsigned int oflags) struct file *file, struct vfsmount *mnt, unsigned int oflags,
__u32 oplock)
{ {
int oplock = 0;
struct cifsFileInfo *pCifsFile; struct cifsFileInfo *pCifsFile;
struct cifsInodeInfo *pCifsInode; struct cifsInodeInfo *pCifsInode;
struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb);
...@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, ...@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
if (pCifsFile == NULL) if (pCifsFile == NULL)
return pCifsFile; return pCifsFile;
if (oplockEnabled)
oplock = REQ_OPLOCK;
pCifsFile->netfid = fileHandle; pCifsFile->netfid = fileHandle;
pCifsFile->pid = current->tgid; pCifsFile->pid = current->tgid;
pCifsFile->pInode = igrab(newinode); pCifsFile->pInode = igrab(newinode);
...@@ -468,7 +465,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -468,7 +465,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
} }
pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp,
nd->path.mnt, oflags); nd->path.mnt, oflags, oplock);
if (pfile_info == NULL) { if (pfile_info == NULL) {
fput(filp); fput(filp);
CIFSSMBClose(xid, tcon, fileHandle); CIFSSMBClose(xid, tcon, fileHandle);
...@@ -729,7 +726,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, ...@@ -729,7 +726,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
cfile = cifs_new_fileinfo(newInode, fileHandle, filp, cfile = cifs_new_fileinfo(newInode, fileHandle, filp,
nd->path.mnt, nd->path.mnt,
nd->intent.open.flags); nd->intent.open.flags,
oplock);
if (cfile == NULL) { if (cfile == NULL) {
fput(filp); fput(filp);
CIFSSMBClose(xid, pTcon, fileHandle); CIFSSMBClose(xid, pTcon, fileHandle);
......
...@@ -277,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -277,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file)
pCifsFile = cifs_new_fileinfo(inode, netfid, file, pCifsFile = cifs_new_fileinfo(inode, netfid, file,
file->f_path.mnt, file->f_path.mnt,
oflags); oflags, oplock);
if (pCifsFile == NULL) { if (pCifsFile == NULL) {
CIFSSMBClose(xid, tcon, netfid); CIFSSMBClose(xid, tcon, netfid);
rc = -ENOMEM; rc = -ENOMEM;
...@@ -370,7 +370,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -370,7 +370,7 @@ int cifs_open(struct inode *inode, struct file *file)
goto out; goto out;
pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt,
file->f_flags); file->f_flags, oplock);
if (pCifsFile == NULL) { if (pCifsFile == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册