Whamcloud - gitweb
Process cross-mkdir with SGID mode.
authorfanyong <fanyong>
Fri, 13 Oct 2006 10:33:42 +0000 (10:33 +0000)
committerfanyong <fanyong>
Fri, 13 Oct 2006 10:33:42 +0000 (10:33 +0000)
lustre/cmm/mdc_object.c
lustre/mdt/mdt_idmap.c

index aa496ce..b53eb29 100644 (file)
@@ -258,7 +258,10 @@ static int mdc_object_create(const struct lu_env *env,
         if (uc &&
             ((uc->mu_valid == UCRED_OLD) || (uc->mu_valid == UCRED_NEW))) {
                 uid = uc->mu_fsuid;
-                gid = uc->mu_fsgid;
+                if (la->la_mode & S_ISGID)
+                        gid = la->la_gid;
+                else
+                        gid = uc->mu_fsgid;
                 cap = uc->mu_cap;
                 if (uc->mu_ginfo || (uc->mu_valid == UCRED_OLD))
                         mci->mci_opdata.suppgids[0] = uc->mu_suppgids[0];
index 20277ee..ecd1c01 100644 (file)
@@ -688,8 +688,13 @@ int mdt_fix_attr_ucred(struct mdt_thread_info *info, __u32 op)
         if (op != REINT_SETATTR) {
                 if ((attr->la_valid & LA_UID) && (attr->la_uid != -1))
                         attr->la_uid = uc->mu_fsuid;
-                if ((attr->la_valid & LA_GID) && (attr->la_gid != -1))
-                        attr->la_gid = uc->mu_fsgid;
+                if (op != REINT_CREATE) {
+                        if ((attr->la_valid & LA_GID) && (attr->la_gid != -1))
+                                attr->la_gid = uc->mu_fsgid;
+                } else {
+                        if (!(attr->la_mode & S_ISGID) && (attr->la_gid != -1))
+                                attr->la_gid = uc->mu_fsgid;
+                }
         } else if (med->med_rmtclient) {
                 /* NB: -1 case will be handled by mdt_fix_attr() later. */
                 if ((attr->la_valid & LA_UID) && (attr->la_uid != -1)) {