Whamcloud - gitweb
LU-12469 mdd: handle migrate case with SELinux 84/36684/2
authorSebastien Buisson <sbuisson@ddn.com>
Wed, 6 Nov 2019 12:51:55 +0000 (21:51 +0900)
committerOleg Drokin <green@whamcloud.com>
Sat, 14 Dec 2019 05:57:05 +0000 (05:57 +0000)
In case a metadata object is created for migration purpose,
its security context should not be initialized. The
security.selinux xattr will be copied after creation, just like
any other xattr, so that the migrated object has the right security
context.

Test-Parameters: clientselinux mdtcount=4 envdefinitions=ONLY=230 testlist=sanity,sanity,sanity,sanity
Test-Parameters: clientselinux mdtcount=4 testlist=sanity,recovery-small,sanity-sec
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I0bc274426c003f8081da2f4d1e8e6c12a70b9930
Reviewed-on: https://review.whamcloud.com/36684
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdd/mdd_dir.c
lustre/tests/sanity.sh

index 9d982ec..89f7f74 100644 (file)
@@ -2338,7 +2338,7 @@ static int mdd_create_object(const struct lu_env *env, struct mdd_object *pobj,
                             struct lu_buf *def_acl_buf,
                             struct lu_buf *hsm_buf,
                             struct dt_allocation_hint *hint,
                             struct lu_buf *def_acl_buf,
                             struct lu_buf *hsm_buf,
                             struct dt_allocation_hint *hint,
-                            struct thandle *handle)
+                            struct thandle *handle, bool initsecctx)
 {
        const struct lu_buf *buf;
        int rc;
 {
        const struct lu_buf *buf;
        int rc;
@@ -2432,7 +2432,7 @@ static int mdd_create_object(const struct lu_env *env, struct mdd_object *pobj,
                        GOTO(err_initlized, rc = -EFAULT);
        }
 
                        GOTO(err_initlized, rc = -EFAULT);
        }
 
-       if (spec->sp_cr_file_secctx_name != NULL) {
+       if (initsecctx && spec->sp_cr_file_secctx_name != NULL) {
                buf = mdd_buf_get_const(env, spec->sp_cr_file_secctx,
                                        spec->sp_cr_file_secctx_size);
                rc = mdo_xattr_set(env, son, buf, spec->sp_cr_file_secctx_name,
                buf = mdd_buf_get_const(env, spec->sp_cr_file_secctx,
                                        spec->sp_cr_file_secctx_size);
                rc = mdo_xattr_set(env, son, buf, spec->sp_cr_file_secctx_name,
@@ -2642,7 +2642,7 @@ int mdd_create(const struct lu_env *env, struct md_object *pobj,
                GOTO(out_stop, rc);
 
        rc = mdd_create_object(env, mdd_pobj, son, attr, spec, &acl_buf,
                GOTO(out_stop, rc);
 
        rc = mdd_create_object(env, mdd_pobj, son, attr, spec, &acl_buf,
-                              &def_acl_buf, &hsm_buf, hint, handle);
+                              &def_acl_buf, &hsm_buf, hint, handle, true);
        if (rc != 0)
                GOTO(out_stop, rc);
 
        if (rc != 0)
                GOTO(out_stop, rc);
 
@@ -4140,7 +4140,7 @@ static int mdd_migrate_create(const struct lu_env *env,
        attr->la_valid &= ~LA_NLINK;
 
        rc = mdd_create_object(env, tpobj, tobj, attr, spec, NULL, NULL, NULL,
        attr->la_valid &= ~LA_NLINK;
 
        rc = mdd_create_object(env, tpobj, tobj, attr, spec, NULL, NULL, NULL,
-                              hint, handle);
+                              hint, handle, false);
        if (rc)
                RETURN(rc);
 
        if (rc)
                RETURN(rc);
 
index 0f68ae6..a794bbf 100644 (file)
@@ -51,8 +51,8 @@ fi
 
 selinux_status=$(getenforce)
 if [ "$selinux_status" != "Disabled" ]; then
 
 selinux_status=$(getenforce)
 if [ "$selinux_status" != "Disabled" ]; then
-       # bug number:    LU-12469 LU-12469
-       ALWAYS_EXCEPT+=" 230b     230d"
+       # bug number:
+       ALWAYS_EXCEPT+=""
 fi
 
 # skip the grant tests for ARM until they are fixed
 fi
 
 # skip the grant tests for ARM until they are fixed