Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / fs / fuse / dir.c
index 45f704a..a430c19 100644 (file)
@@ -63,11 +63,15 @@ static inline u64 fuse_dentry_time(struct dentry *entry)
 /*
  * Calculate the time in jiffies until a dentry/attributes are valid
  */
-static u64 time_to_jiffies(unsigned long sec, unsigned long nsec)
+static u64 time_to_jiffies(u64 sec, u32 nsec)
 {
        if (sec || nsec) {
-               struct timespec ts = {sec, nsec};
-               return get_jiffies_64() + timespec_to_jiffies(&ts);
+               struct timespec64 ts = {
+                       sec,
+                       max_t(u32, nsec, NSEC_PER_SEC - 1)
+               };
+
+               return get_jiffies_64() + timespec64_to_jiffies(&ts);
        } else
                return 0;
 }
@@ -1024,7 +1028,7 @@ int fuse_allow_current_process(struct fuse_conn *fc)
 {
        const struct cred *cred;
 
-       if (fc->flags & FUSE_ALLOW_OTHER)
+       if (fc->allow_other)
                return 1;
 
        cred = current_cred();
@@ -1100,7 +1104,7 @@ static int fuse_permission(struct inode *inode, int mask)
        /*
         * If attributes are needed, refresh them before proceeding
         */
-       if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) ||
+       if (fc->default_permissions ||
            ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
                struct fuse_inode *fi = get_fuse_inode(inode);
 
@@ -1113,7 +1117,7 @@ static int fuse_permission(struct inode *inode, int mask)
                }
        }
 
-       if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
+       if (fc->default_permissions) {
                err = generic_permission(inode, mask);
 
                /* If permission is denied, try to refresh file
@@ -1600,9 +1604,10 @@ int fuse_flush_times(struct inode *inode, struct fuse_file *ff)
  * vmtruncate() doesn't allow for this case, so do the rlimit checking
  * and the actual truncation by hand.
  */
-int fuse_do_setattr(struct inode *inode, struct iattr *attr,
+int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
                    struct file *file)
 {
+       struct inode *inode = d_inode(dentry);
        struct fuse_conn *fc = get_fuse_conn(inode);
        struct fuse_inode *fi = get_fuse_inode(inode);
        FUSE_ARGS(args);
@@ -1614,10 +1619,10 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr,
        int err;
        bool trust_local_cmtime = is_wb && S_ISREG(inode->i_mode);
 
-       if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
+       if (!fc->default_permissions)
                attr->ia_valid |= ATTR_FORCE;
 
-       err = inode_change_ok(inode, attr);
+       err = setattr_prepare(dentry, attr);
        if (err)
                return err;
 
@@ -1754,7 +1759,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
        if (!attr->ia_valid)
                return 0;
 
-       ret = fuse_do_setattr(inode, attr, file);
+       ret = fuse_do_setattr(entry, attr, file);
        if (!ret) {
                /*
                 * If filesystem supports acls it may have updated acl xattrs in