From 42828154757396fba5b00b925fb164f94dfe07da Mon Sep 17 00:00:00 2001 From: fanyong Date: Mon, 25 Sep 2006 07:42:03 +0000 Subject: [PATCH] small fix for group_info. --- lustre/mdd/mdd_handler.c | 8 +++----- lustre/mdt/mdt_lib.c | 18 ++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index d707dca..71f735d 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -125,10 +125,8 @@ static int mdd_in_group_p(struct md_ucred *uc, gid_t grp) if (uc->mu_ginfo) group_info = uc->mu_ginfo; -#if 0 else if (uc->mu_identity) group_info = uc->mu_identity->mi_ginfo; -#endif if (!group_info) return 0; @@ -954,10 +952,10 @@ int mdd_fix_attr(const struct lu_context *ctxt, struct mdd_object *obj, } /* Check for setting the obj time. */ - if (la->la_valid & (LA_MTIME | LA_ATIME | LA_CTIME)) { + if ((la->la_valid & (LA_MTIME | LA_ATIME | LA_CTIME)) && + !(la->la_valid & ~(LA_MTIME | LA_ATIME | LA_CTIME))) { if ((uc->mu_fsuid != tmp_la->la_uid) && - !mdd_capable(uc, CAP_FOWNER) && - !(la->la_valid & (LA_SIZE | LA_BLOCKS))) + !mdd_capable(uc, CAP_FOWNER)) RETURN(-EPERM); } diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index 9de4efe..6ff3450 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -96,7 +96,7 @@ void mdt_exit_ucred(struct mdt_thread_info *info) struct mdt_device *mdt = info->mti_mdt; if (uc->mu_valid != UCRED_INIT) { - if (uc->mu_ginfo && (uc->mu_valid != UCRED_OLD)) { + if (uc->mu_ginfo) { groups_free(uc->mu_ginfo); uc->mu_ginfo = NULL; } @@ -296,7 +296,7 @@ check_squash: */ if (req->rq_auth_usr_mdt || (pud->pud_ngroups && !med->med_rmtclient && !root_squashed && - (setxid_perm & LUSTRE_SETGRP_PERM))) { + (setxid_perm & LUSTRE_SETGRP_PERM))) { struct group_info *ginfo; /* setgroups for local client */ @@ -316,14 +316,14 @@ check_squash: ucred->mu_valid = UCRED_NEW; out: - if (rc) + if (rc && identity) mdt_identity_put(mdt->mdt_identity_cache, identity); RETURN(rc); } static int old_init_ucred(struct mdt_thread_info *info, - struct mdt_body *body) + struct mdt_body *body) { struct md_ucred *uc = &info->mti_uc; struct mdt_device *mdt = info->mti_mdt; @@ -354,10 +354,7 @@ static int old_init_ucred(struct mdt_thread_info *info, uc->mu_fsuid = body->fsuid; uc->mu_fsgid = body->fsgid; uc->mu_cap = body->capability; - if (identity) - uc->mu_ginfo = identity->mi_ginfo; - else - uc->mu_ginfo = NULL; + uc->mu_ginfo = NULL; uc->mu_identity = identity; RETURN(0); @@ -402,10 +399,7 @@ static int old_init_ucred_reint(struct mdt_thread_info *info) uc->mu_valid = UCRED_OLD; uc->mu_o_uid = uc->mu_o_fsuid = uc->mu_uid = uc->mu_fsuid; uc->mu_o_gid = uc->mu_o_fsgid = uc->mu_gid = uc->mu_fsgid; - if (identity) - uc->mu_ginfo = identity->mi_ginfo; - else - uc->mu_ginfo = NULL; + uc->mu_ginfo = NULL; uc->mu_identity = identity; RETURN(0); -- 1.8.3.1