]> 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 a83541ec97131af495e339dfa1e0a482d98dee72..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) {
@@ -1676,7 +1683,7 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
        return rc;
 }
 
-int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
+int cifs_fsync(struct file *file, int datasync)
 {
        int xid;
        int rc = 0;
@@ -1688,7 +1695,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
        xid = GetXid();
 
        cFYI(1, "Sync file - name: %s datasync: 0x%x",
-               dentry->d_name.name, datasync);
+               file->f_path.dentry->d_name.name, datasync);
 
        rc = filemap_write_and_wait(inode->i_mapping);
        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);