ANDROID: sdcardfs: Add option to not link obb
authorDaniel Rosenberg <drosen@google.com>
Thu, 25 Oct 2018 23:25:15 +0000 (16:25 -0700)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 28 Jun 2019 14:46:31 +0000 (23:46 +0900)
Add mount option unshared_obb to not link the obb
folders of multiple users together.

Bug: 27915347
Test: mount with option. Check if altering one obb
      alters the other
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I3956e06bd0a222b0bbb2768c9a8a8372ada85e1e

fs/sdcardfs/derived_perm.c
fs/sdcardfs/main.c
fs/sdcardfs/sdcardfs.h

index ea0d9900eb6a41f9c8b27901a53e3deb7b840446..78a669c8a4d6245c230295cc545243f2a44f190d 100644 (file)
@@ -360,7 +360,8 @@ int need_graft_path(struct dentry *dentry)
        struct sdcardfs_sb_info *sbi = SDCARDFS_SB(dentry->d_sb);
        struct qstr obb = QSTR_LITERAL("obb");
 
-       if (parent_info->data->perm == PERM_ANDROID &&
+       if (!sbi->options.unshared_obb &&
+                       parent_info->data->perm == PERM_ANDROID &&
                        qstr_case_eq(&dentry->d_name, &obb)) {
 
                /* /Android/obb is the base obbpath of DERIVED_UNIFIED */
index ba52af8644cc89b73c1149502f646f5ce15741d5..d890c571190785346920c818b6521ce0cfe05c61 100644 (file)
@@ -35,6 +35,7 @@ enum {
        Opt_gid_derivation,
        Opt_default_normal,
        Opt_nocache,
+       Opt_unshared_obb,
        Opt_err,
 };
 
@@ -48,6 +49,7 @@ static const match_table_t sdcardfs_tokens = {
        {Opt_multiuser, "multiuser"},
        {Opt_gid_derivation, "derive_gid"},
        {Opt_default_normal, "default_normal"},
+       {Opt_unshared_obb, "unshared_obb"},
        {Opt_reserved_mb, "reserved_mb=%u"},
        {Opt_nocache, "nocache"},
        {Opt_err, NULL}
@@ -134,6 +136,9 @@ static int parse_options(struct super_block *sb, char *options, int silent,
                case Opt_nocache:
                        opts->nocache = true;
                        break;
+               case Opt_unshared_obb:
+                       opts->unshared_obb = true;
+                       break;
                /* unknown option */
                default:
                        if (!silent)
@@ -187,13 +192,16 @@ int parse_options_remount(struct super_block *sb, char *options, int silent,
                                return 0;
                        vfsopts->mask = option;
                        break;
+               case Opt_unshared_obb:
                case Opt_default_normal:
                case Opt_multiuser:
                case Opt_userid:
                case Opt_fsuid:
                case Opt_fsgid:
                case Opt_reserved_mb:
-                       pr_warn("Option \"%s\" can't be changed during remount\n", p);
+               case Opt_gid_derivation:
+                       if (!silent)
+                               pr_warn("Option \"%s\" can't be changed during remount\n", p);
                        break;
                /* unknown option */
                default:
index c2a16a023f2cf0b2990a8d4af44360588cc3fee5..6219771ed71c3b58454cfdfc1cfd8af8a860c67e 100644 (file)
@@ -197,6 +197,7 @@ struct sdcardfs_mount_options {
        bool multiuser;
        bool gid_derivation;
        bool default_normal;
+       bool unshared_obb;
        unsigned int reserved_mb;
        bool nocache;
 };