From 8250c119566270adc4a9d8b1916293ec5d989a9c Mon Sep 17 00:00:00 2001 From: johann <johann> Date: Wed, 5 Dec 2007 13:58:17 +0000 Subject: [PATCH] Branch b1_6 b=12829 i=adilger i=bobijam When CRAY_XT3 is defined, the fsgid supplied by the client is overridden with the primary group provided by the group upcall, whereas the supplied fsgid can be trust if it is in the list of supplementary groups returned by the group upcall. --- lustre/ChangeLog | 10 ++++++++++ lustre/mds/mds_reint.c | 12 ++++++++++++ lustre/tests/sanity.sh | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index ed94aa359d..30a392b856 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -116,6 +116,16 @@ Description: touch file failed when fs is not full Details : OST in recovery should not be discarded by MDS in alloc_qos(), otherwise we can get ENOSP while fs is not full. +Severity : normal +Frequency : only for Cray XT3 +Bugzilla : 12829/13455 +Description: Changing primary group doesn't change the group lustre assigns to + a file +Details : When CRAY_XT3 is defined, the fsgid supplied by the client is + overridden with the primary group provided by the group upcall, + whereas the supplied fsgid can be trust if it is in the list of + supplementary groups returned by the group upcall. + -------------------------------------------------------------------------------- 2007-10-26 Cluster File Systems, Inc. <info@clusterfs.com> diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 869fb271ba..a7e4da4950 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -2352,6 +2352,9 @@ int mds_reint_rec(struct mds_update_record *rec, int offset, struct mds_obd *mds = &obd->u.mds; struct lvfs_run_ctxt saved; int rc; +#ifdef CRAY_XT3 + gid_t fsgid = rec->ur_uc.luc_fsgid; +#endif ENTRY; #ifdef CRAY_XT3 @@ -2385,6 +2388,15 @@ int mds_reint_rec(struct mds_update_record *rec, int offset, #endif push_ctxt(&saved, &obd->obd_lvfs_ctxt, &rec->ur_uc); + +#ifdef CRAY_XT3 + if (rec->ur_uc.luc_uce && fsgid != rec->ur_uc.luc_fsgid && + in_group_p(fsgid)) { + rec->ur_uc.luc_fsgid = fsgid; + current->fsgid = saved.luc.luc_fsgid = fsgid; + } +#endif + rc = reinters[rec->ur_opcode] (rec, offset, req, lockh); pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &rec->ur_uc); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 9e7f1833ac..c3cdf26c1c 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -4781,6 +4781,15 @@ test_125() { # 13358 } run_test 125 "don't return EPROTO when a dir has a non-default striping and ACLs" +test_126() { # bug 12829/13455 + [ "$UID" != 0 ] && echo "skipping $TESTNAME (must run as root)" && return + $RUNAS -u 0 -g 1 touch $DIR/$tfile || error "touch failed" + gid=`ls -n $DIR/$tfile | awk '{print $4}'` + rm -f $DIR/$tfile + [ $gid -eq "1" ] || error "gid is set to" $gid "instead of 1" +} +run_test 126 "check that the fsgid provided by the client is taken into account" + TMPDIR=$OLDTMPDIR TMP=$OLDTMP HOME=$OLDHOME -- GitLab