vfs: do_last(): only return EISDIR for O_CREAT
[platform/adaptation/renesas_rcar/renesas_kernel.git] / mm / shmem.c
index f99ff3e..3711422 100644 (file)
@@ -597,7 +597,7 @@ static void shmem_evict_inode(struct inode *inode)
        }
        BUG_ON(inode->i_blocks);
        shmem_free_inode(inode->i_sb);
-       end_writeback(inode);
+       clear_inode(inode);
 }
 
 /*
@@ -2033,11 +2033,9 @@ static struct dentry *shmem_fh_to_dentry(struct super_block *sb,
        return dentry;
 }
 
-static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
-                               int connectable)
+static int shmem_encode_fh(struct inode *inode, __u32 *fh, int *len,
+                               struct inode *parent)
 {
-       struct inode *inode = dentry->d_inode;
-
        if (*len < 3) {
                *len = 3;
                return 255;
@@ -2075,6 +2073,8 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,
                               bool remount)
 {
        char *this_char, *value, *rest;
+       uid_t uid;
+       gid_t gid;
 
        while (options != NULL) {
                this_char = options;
@@ -2134,15 +2134,21 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,
                } else if (!strcmp(this_char,"uid")) {
                        if (remount)
                                continue;
-                       sbinfo->uid = simple_strtoul(value, &rest, 0);
+                       uid = simple_strtoul(value, &rest, 0);
                        if (*rest)
                                goto bad_val;
+                       sbinfo->uid = make_kuid(current_user_ns(), uid);
+                       if (!uid_valid(sbinfo->uid))
+                               goto bad_val;
                } else if (!strcmp(this_char,"gid")) {
                        if (remount)
                                continue;
-                       sbinfo->gid = simple_strtoul(value, &rest, 0);
+                       gid = simple_strtoul(value, &rest, 0);
                        if (*rest)
                                goto bad_val;
+                       sbinfo->gid = make_kgid(current_user_ns(), gid);
+                       if (!gid_valid(sbinfo->gid))
+                               goto bad_val;
                } else if (!strcmp(this_char,"mpol")) {
                        if (mpol_parse_str(value, &sbinfo->mpol, 1))
                                goto bad_val;
@@ -2210,10 +2216,12 @@ static int shmem_show_options(struct seq_file *seq, struct dentry *root)
                seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes);
        if (sbinfo->mode != (S_IRWXUGO | S_ISVTX))
                seq_printf(seq, ",mode=%03ho", sbinfo->mode);
-       if (sbinfo->uid != 0)
-               seq_printf(seq, ",uid=%u", sbinfo->uid);
-       if (sbinfo->gid != 0)
-               seq_printf(seq, ",gid=%u", sbinfo->gid);
+       if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID))
+               seq_printf(seq, ",uid=%u",
+                               from_kuid_munged(&init_user_ns, sbinfo->uid));
+       if (!gid_eq(sbinfo->gid, GLOBAL_ROOT_GID))
+               seq_printf(seq, ",gid=%u",
+                               from_kgid_munged(&init_user_ns, sbinfo->gid));
        shmem_show_mpol(seq, sbinfo->mpol);
        return 0;
 }