]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/befs/linuxvfs.c
proc_devtree: remove duplicated include from proc_devtree.c
[karo-tx-linux.git] / fs / befs / linuxvfs.c
index cf7f3c67c8b7848e6e8e55b83c3c76bde007f60a..2b3bda8d5e6838619222359de38370baedfce7a4 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/vfs.h>
 #include <linux/parser.h>
 #include <linux/namei.h>
+#include <linux/sched.h>
 
 #include "befs.h"
 #include "btree.h"
@@ -352,9 +353,11 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
         */   
 
        inode->i_uid = befs_sb->mount_opts.use_uid ?
-           befs_sb->mount_opts.uid : (uid_t) fs32_to_cpu(sb, raw_inode->uid);
+               befs_sb->mount_opts.uid :
+               make_kuid(&init_user_ns, fs32_to_cpu(sb, raw_inode->uid));
        inode->i_gid = befs_sb->mount_opts.use_gid ?
-           befs_sb->mount_opts.gid : (gid_t) fs32_to_cpu(sb, raw_inode->gid);
+               befs_sb->mount_opts.gid :
+               make_kgid(&init_user_ns, fs32_to_cpu(sb, raw_inode->gid));
 
        set_nlink(inode, 1);
 
@@ -454,6 +457,11 @@ befs_init_inodecache(void)
 static void
 befs_destroy_inodecache(void)
 {
+       /*
+        * Make sure all delayed rcu free inodes are flushed before we
+        * destroy cache.
+        */
+       rcu_barrier();
        kmem_cache_destroy(befs_inode_cachep);
 }
 
@@ -674,10 +682,12 @@ parse_options(char *options, befs_mount_options * opts)
        char *p;
        substring_t args[MAX_OPT_ARGS];
        int option;
+       kuid_t uid;
+       kgid_t gid;
 
        /* Initialize options */
-       opts->uid = 0;
-       opts->gid = 0;
+       opts->uid = GLOBAL_ROOT_UID;
+       opts->gid = GLOBAL_ROOT_GID;
        opts->use_uid = 0;
        opts->use_gid = 0;
        opts->iocharset = NULL;
@@ -696,23 +706,29 @@ parse_options(char *options, befs_mount_options * opts)
                case Opt_uid:
                        if (match_int(&args[0], &option))
                                return 0;
-                       if (option < 0) {
+                       uid = INVALID_UID;
+                       if (option >= 0)
+                               uid = make_kuid(current_user_ns(), option);
+                       if (!uid_valid(uid)) {
                                printk(KERN_ERR "BeFS: Invalid uid %d, "
                                                "using default\n", option);
                                break;
                        }
-                       opts->uid = option;
+                       opts->uid = uid;
                        opts->use_uid = 1;
                        break;
                case Opt_gid:
                        if (match_int(&args[0], &option))
                                return 0;
-                       if (option < 0) {
+                       gid = INVALID_GID;
+                       if (option >= 0)
+                               gid = make_kgid(current_user_ns(), option);
+                       if (!gid_valid(gid)) {
                                printk(KERN_ERR "BeFS: Invalid gid %d, "
                                                "using default\n", option);
                                break;
                        }
-                       opts->gid = option;
+                       opts->gid = gid;
                        opts->use_gid = 1;
                        break;
                case Opt_charset: