From: fanyong Date: Fri, 13 Oct 2006 10:33:42 +0000 (+0000) Subject: Process cross-mkdir with SGID mode. X-Git-Tag: v1_8_0_110~486^2~554 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=bb45448b8cd5a468f14deb4fe69da4fc4b47fc81;p=fs%2Flustre-release.git Process cross-mkdir with SGID mode. --- diff --git a/lustre/cmm/mdc_object.c b/lustre/cmm/mdc_object.c index aa496ce..b53eb29 100644 --- a/lustre/cmm/mdc_object.c +++ b/lustre/cmm/mdc_object.c @@ -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]; diff --git a/lustre/mdt/mdt_idmap.c b/lustre/mdt/mdt_idmap.c index 20277ee..ecd1c01 100644 --- a/lustre/mdt/mdt_idmap.c +++ b/lustre/mdt/mdt_idmap.c @@ -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)) {