]> err.no Git - linux-2.6/blobdiff - fs/cifs/file.c
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[linux-2.6] / fs / cifs / file.c
index 5857d12611e6019a8ab2db69b1cbb2f60d427605..ef455dda0473c2551325212f5943a44c11f6a781 100644 (file)
@@ -196,7 +196,7 @@ int cifs_open(struct inode *inode, struct file *file)
        }
 
        down(&inode->i_sb->s_vfs_rename_sem);
-       full_path = build_path_from_dentry(file->f_dentry, cifs_sb);
+       full_path = build_path_from_dentry(file->f_dentry);
        up(&inode->i_sb->s_vfs_rename_sem);
        if (full_path == NULL) {
                FreeXid(xid);
@@ -256,6 +256,13 @@ int cifs_open(struct inode *inode, struct file *file)
                         CREATE_NOT_DIR, &netfid, &oplock, buf,
                         cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
                                 & CIFS_MOUNT_MAP_SPECIAL_CHR);
+       if (rc == -EIO) {
+               /* Old server, try legacy style OpenX */
+               rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
+                       desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
+                       cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
+                               & CIFS_MOUNT_MAP_SPECIAL_CHR);
+       }
        if (rc) {
                cFYI(1, ("cifs_open returned 0x%x ", rc));
                goto out;
@@ -359,7 +366,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
    those that already have the rename sem can end up causing writepage
    to get called and if the server was down that means we end up here,
    and we can never tell if the caller already has the rename_sem */
-       full_path = build_path_from_dentry(file->f_dentry, cifs_sb);
+       full_path = build_path_from_dentry(file->f_dentry);
        if (full_path == NULL) {
                up(&pCifsFile->fh_sem);
                FreeXid(xid);
@@ -643,7 +650,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
                         netfid, length,
                         pfLock->fl_start, numUnlock, numLock, lockType,
                         wait_flag);
-       if (rc == 0 && (pfLock->fl_flags & FL_POSIX))
+       if (pfLock->fl_flags & FL_POSIX)
                posix_lock_file_wait(file, pfLock);
        FreeXid(xid);
        return rc;
@@ -1210,7 +1217,12 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
                                 open_file->netfid,
                                 current_read_size, *poffset,
                                 &bytes_read, &smb_read_data);
-
+                       if(rc == -EINVAL) {
+                               rc = SMBLegacyRead(xid, pTcon,
+                                       open_file->netfid,
+                                       current_read_size, *poffset,
+                                       &bytes_read, &smb_read_data);
+                       }
                        pSMBr = (struct smb_com_read_rsp *)smb_read_data;
                        if (copy_to_user(current_offset, 
                                         smb_read_data + 4 /* RFC1001 hdr */
@@ -1287,6 +1299,12 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
                                 open_file->netfid,
                                 current_read_size, *poffset,
                                 &bytes_read, &current_offset);
+                       if(rc == -EINVAL) {
+                               rc = SMBLegacyRead(xid, pTcon,
+                                       open_file->netfid,
+                                       current_read_size, *poffset,
+                                       &bytes_read, &current_offset);
+                       }
                }
                if (rc || (bytes_read == 0)) {
                        if (total_read) {
@@ -1443,7 +1461,14 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
                                open_file->netfid,
                                read_size, offset,
                                &bytes_read, &smb_read_data);
-                       /* BB need to check return code here */
+                       if (rc == -EINVAL) {
+                               rc = SMBLegacyRead(xid, pTcon,
+                                       open_file->netfid,
+                                       read_size, offset,
+                                       &bytes_read, &smb_read_data);
+                       }
+
+                       /* BB more RC checks ? */
                        if (rc== -EAGAIN) {
                                if (smb_read_data) {
                                        cifs_buf_release(smb_read_data);