]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Oct 2008 17:43:36 +0000 (10:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Oct 2008 17:43:36 +0000 (10:43 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  cifs: handle the TCP_Server_Info->tsk field more carefully
  cifs: fix unlinking of rename target when server doesn't support open file renames
  [CIFS] improve setlease handling
  [CIFS] fix saving of resume key before CIFSFindNext
  cifs: make cifs_rename handle -EACCES errors
  [CIFS] fix build error
  [CIFS] undo changes in cifs_rename_pending_delete if it errors out
  cifs: track DeletePending flag in cifsInodeInfo
  cifs: don't use CREATE_DELETE_ON_CLOSE in cifs_rename_pending_delete
  [CIFS] eliminate usage of kthread_stop for cifsd
  [CIFS] Add nodfs mount option

1  2 
fs/cifs/cifsfs.c

diff --combined fs/cifs/cifsfs.c
index 84cc011a16e4d1afc90fe29d88ba2d1350902944,76919c25acc7927e6512b663c1a87658c42d2399..ac5915d61dca768d4f71d689c5948712e2bf012f
@@@ -275,12 -275,9 +275,12 @@@ static int cifs_permission(struct inod
  
        cifs_sb = CIFS_SB(inode->i_sb);
  
 -      if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
 -              return 0;
 -      else /* file mode might have been restricted at mount time
 +      if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) {
 +              if ((mask & MAY_EXEC) && !execute_ok(inode))
 +                      return -EACCES;
 +              else
 +                      return 0;
 +      } else /* file mode might have been restricted at mount time
                on the client (above and beyond ACL on servers) for
                servers which do not support setting and viewing mode bits,
                so allowing client to check permissions is useful */
@@@ -312,6 -309,7 +312,7 @@@ cifs_alloc_inode(struct super_block *sb
        file data or metadata */
        cifs_inode->clientCanCacheRead = false;
        cifs_inode->clientCanCacheAll = false;
+       cifs_inode->delete_pending = false;
        cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
  
        /* Can not set i_flags here - they get immediately overwritten
@@@ -620,6 -618,37 +621,37 @@@ static loff_t cifs_llseek(struct file *
        return generic_file_llseek_unlocked(file, offset, origin);
  }
  
+ #ifdef CONFIG_CIFS_EXPERIMENTAL
+ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
+ {
+       /* note that this is called by vfs setlease with the BKL held
+          although I doubt that BKL is needed here in cifs */
+       struct inode *inode = file->f_path.dentry->d_inode;
+       if (!(S_ISREG(inode->i_mode)))
+               return -EINVAL;
+       /* check if file is oplocked */
+       if (((arg == F_RDLCK) &&
+               (CIFS_I(inode)->clientCanCacheRead)) ||
+           ((arg == F_WRLCK) &&
+               (CIFS_I(inode)->clientCanCacheAll)))
+               return generic_setlease(file, arg, lease);
+       else if (CIFS_SB(inode->i_sb)->tcon->local_lease &&
+                       !CIFS_I(inode)->clientCanCacheRead)
+               /* If the server claims to support oplock on this
+                  file, then we still need to check oplock even
+                  if the local_lease mount option is set, but there
+                  are servers which do not support oplock for which
+                  this mount option may be useful if the user
+                  knows that the file won't be changed on the server
+                  by anyone else */
+               return generic_setlease(file, arg, lease);
+       else
+               return -EAGAIN;
+ }
+ #endif
  struct file_system_type cifs_fs_type = {
        .owner = THIS_MODULE,
        .name = "cifs",
@@@ -698,6 -727,7 +730,7 @@@ const struct file_operations cifs_file_
  
  #ifdef CONFIG_CIFS_EXPERIMENTAL
        .dir_notify = cifs_dir_notify,
+       .setlease = cifs_setlease,
  #endif /* CONFIG_CIFS_EXPERIMENTAL */
  };
  
@@@ -718,6 -748,7 +751,7 @@@ const struct file_operations cifs_file_
        .llseek = cifs_llseek,
  #ifdef CONFIG_CIFS_EXPERIMENTAL
        .dir_notify = cifs_dir_notify,
+       .setlease = cifs_setlease,
  #endif /* CONFIG_CIFS_EXPERIMENTAL */
  };
  const struct file_operations cifs_file_nobrl_ops = {
  
  #ifdef CONFIG_CIFS_EXPERIMENTAL
        .dir_notify = cifs_dir_notify,
+       .setlease = cifs_setlease,
  #endif /* CONFIG_CIFS_EXPERIMENTAL */
  };
  
@@@ -757,6 -789,7 +792,7 @@@ const struct file_operations cifs_file_
        .llseek = cifs_llseek,
  #ifdef CONFIG_CIFS_EXPERIMENTAL
        .dir_notify = cifs_dir_notify,
+       .setlease = cifs_setlease,
  #endif /* CONFIG_CIFS_EXPERIMENTAL */
  };
  
@@@ -768,7 -801,6 +804,7 @@@ const struct file_operations cifs_dir_o
        .dir_notify = cifs_dir_notify,
  #endif /* CONFIG_CIFS_EXPERIMENTAL */
        .unlocked_ioctl  = cifs_ioctl,
 +      .llseek = generic_file_llseek,
  };
  
  static void
@@@ -949,6 -981,12 +985,12 @@@ static int cifs_oplock_thread(void *dum
                                the call */
                        /* mutex_lock(&inode->i_mutex);*/
                        if (S_ISREG(inode->i_mode)) {
+ #ifdef CONFIG_CIFS_EXPERIMENTAL
+                               if (CIFS_I(inode)->clientCanCacheAll == 0)
+                                       break_lease(inode, FMODE_READ);
+                               else if (CIFS_I(inode)->clientCanCacheRead == 0)
+                                       break_lease(inode, FMODE_WRITE);
+ #endif
                                rc = filemap_fdatawrite(inode->i_mapping);
                                if (CIFS_I(inode)->clientCanCacheRead == 0) {
                                        waitrc = filemap_fdatawait(