]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/cifs/file.c
cifs: move cifs_new_fileinfo call out of cifs_posix_open
[karo-tx-linux.git] / fs / cifs / file.c
index f1ff785b22924d8ccb736fd7794f8c424c2b32c0..542e0c874d6458d812409418cca57c95486f99dc 100644 (file)
@@ -299,8 +299,7 @@ int cifs_open(struct inode *inode, struct file *file)
                int oflags = (int) cifs_posix_convert_flags(file->f_flags);
                oflags |= SMB_O_CREAT;
                /* can not refresh inode info since size could be stale */
-               rc = cifs_posix_open(full_path, &inode, file->f_path.mnt,
-                               inode->i_sb,
+               rc = cifs_posix_open(full_path, &inode, inode->i_sb,
                                cifs_sb->mnt_file_mode /* ignored */,
                                oflags, &oplock, &netfid, xid);
                if (rc == 0) {
@@ -308,7 +307,16 @@ int cifs_open(struct inode *inode, struct file *file)
                        /* no need for special case handling of setting mode
                           on read only files needed here */
 
-                       pCifsFile = cifs_fill_filedata(file);
+                       pCifsFile = cifs_new_fileinfo(inode, netfid, file,
+                                                       file->f_path.mnt,
+                                                       oflags);
+                       if (pCifsFile == NULL) {
+                               CIFSSMBClose(xid, tcon, netfid);
+                               rc = -ENOMEM;
+                               goto out;
+                       }
+                       file->private_data = pCifsFile;
+
                        cifs_posix_open_inode_helper(inode, file, pCifsInode,
                                                     oplock, netfid);
                        goto out;
@@ -513,8 +521,7 @@ reopen_error_exit:
                        le64_to_cpu(tcon->fsUnixInfo.Capability))) {
                int oflags = (int) cifs_posix_convert_flags(file->f_flags);
                /* can not refresh inode info since size could be stale */
-               rc = cifs_posix_open(full_path, NULL, file->f_path.mnt,
-                               inode->i_sb,
+               rc = cifs_posix_open(full_path, NULL, inode->i_sb,
                                cifs_sb->mnt_file_mode /* ignored */,
                                oflags, &oplock, &netfid, xid);
                if (rc == 0) {
@@ -1952,6 +1959,7 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
                        bytes_read -= PAGE_CACHE_SIZE;
                        continue;
                }
+               page_cache_release(page);
 
                target = kmap_atomic(page, KM_USER0);