cifs: fix broken oplock handling
[pandora-kernel.git] / fs / cifs / dir.c
index f17d500..0f947bf 100644 (file)
@@ -132,9 +132,9 @@ cifs_bp_rename_retry:
 
 struct cifsFileInfo *
 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 cifsInodeInfo *pCifsInode;
        struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb);
@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
        if (pCifsFile == NULL)
                return pCifsFile;
 
-       if (oplockEnabled)
-               oplock = REQ_OPLOCK;
-
        pCifsFile->netfid = fileHandle;
        pCifsFile->pid = current->tgid;
        pCifsFile->pInode = igrab(newinode);
@@ -305,8 +302,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        full_path = build_path_from_dentry(direntry);
        if (full_path == NULL) {
                rc = -ENOMEM;
-               FreeXid(xid);
-               return rc;
+               goto cifs_create_out;
        }
 
        if (oplockEnabled)
@@ -365,9 +361,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
 
        buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
        if (buf == NULL) {
-               kfree(full_path);
-               FreeXid(xid);
-               return -ENOMEM;
+               rc = -ENOMEM;
+               goto cifs_create_out;
        }
 
        /*
@@ -470,7 +465,7 @@ cifs_create_set_dentry:
                }
 
                pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp,
-                                              nd->path.mnt, oflags);
+                                              nd->path.mnt, oflags, oplock);
                if (pfile_info == NULL) {
                        fput(filp);
                        CIFSSMBClose(xid, tcon, fileHandle);
@@ -731,7 +726,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 
                        cfile = cifs_new_fileinfo(newInode, fileHandle, filp,
                                                  nd->path.mnt,
-                                                 nd->intent.open.flags);
+                                                 nd->intent.open.flags,
+                                                 oplock);
                        if (cfile == NULL) {
                                fput(filp);
                                CIFSSMBClose(xid, pTcon, fileHandle);