Merge remote-tracking branch 'jk/vfs' into work.misc
[cascardo/linux.git] / fs / cifs / inode.c
index 514dadb..7ab5be7 100644 (file)
@@ -1002,10 +1002,26 @@ struct inode *cifs_root_iget(struct super_block *sb)
        struct inode *inode = NULL;
        long rc;
        struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
+       char *path = NULL;
+       int len;
+
+       if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)
+           && cifs_sb->prepath) {
+               len = strlen(cifs_sb->prepath);
+               path = kzalloc(len + 2 /* leading sep + null */, GFP_KERNEL);
+               if (path == NULL)
+                       return ERR_PTR(-ENOMEM);
+               path[0] = '/';
+               memcpy(path+1, cifs_sb->prepath, len);
+       } else {
+               path = kstrdup("", GFP_KERNEL);
+               if (path == NULL)
+                       return ERR_PTR(-ENOMEM);
+       }
 
        xid = get_xid();
        if (tcon->unix_ext) {
-               rc = cifs_get_inode_info_unix(&inode, "", sb, xid);
+               rc = cifs_get_inode_info_unix(&inode, path, sb, xid);
                /* some servers mistakenly claim POSIX support */
                if (rc != -EOPNOTSUPP)
                        goto iget_no_retry;
@@ -1013,7 +1029,8 @@ struct inode *cifs_root_iget(struct super_block *sb)
                tcon->unix_ext = false;
        }
 
-       rc = cifs_get_inode_info(&inode, "", NULL, sb, xid, NULL);
+       convert_delimiter(path, CIFS_DIR_SEP(cifs_sb));
+       rc = cifs_get_inode_info(&inode, path, NULL, sb, xid, NULL);
 
 iget_no_retry:
        if (!inode) {
@@ -1042,6 +1059,7 @@ iget_no_retry:
        }
 
 out:
+       kfree(path);
        /* can not call macro free_xid here since in a void func
         * TODO: This is no longer true
         */
@@ -1933,7 +1951,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
 
        cifs_dbg(FYI, "Update attributes: %s inode 0x%p count %d dentry: 0x%p d_time %ld jiffies %ld\n",
                 full_path, inode, inode->i_count.counter,
-                dentry, dentry->d_time, jiffies);
+                dentry, cifs_get_time(dentry), jiffies);
 
        if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
                rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
@@ -2136,7 +2154,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
                attrs->ia_valid |= ATTR_FORCE;
 
-       rc = inode_change_ok(inode, attrs);
+       rc = setattr_prepare(direntry, attrs);
        if (rc < 0)
                goto out;
 
@@ -2276,7 +2294,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
                attrs->ia_valid |= ATTR_FORCE;
 
-       rc = inode_change_ok(inode, attrs);
+       rc = setattr_prepare(direntry, attrs);
        if (rc < 0) {
                free_xid(xid);
                return rc;