From: Niu Yawei Date: Fri, 4 Jul 2014 07:34:59 +0000 (-0400) Subject: LU-5296 lod: don't skip attr_set for osp objects X-Git-Tag: 2.6.0-RC1~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F10989%2F4;p=fs%2Flustre-release.git LU-5296 lod: don't skip attr_set for osp objects lod_attr_set() uses dt_object_exists() to check whether an osp object (for OST object) is existing, which is incorrect for non-dir object, and can lead to chown/chgrp being skipped on OST object. The lsr_valid handling in osp_sync_add_rec() was got a problem in commit 80f90fcde73e because it stored all of the passed attr flags in struct llog_setattr64_rec, even though there are only fields for storing the UID and GID. Since the time stamps do not need to be propagated to the OSTs (the MDT values are good enough), this is not a problem. Also, osp_sync_add_rec stored LA_UID/LA_GID flags on disk, but they are not part of lustre_idl.h or lustre_disk.h and are not guaranteed to be constant over time. Instead, use the flags OBD_MD_FLUID/OBD_MD_FLGID that are in lustre_idl.h. Re-enable sanity-quota.sh test_34 so that this is actually tested. Signed-off-by: Niu Yawei Signed-off-by: Andreas Dilger Change-Id: I245e59141324b34071c9eb188dedbf615052f19d Reviewed-on: http://review.whamcloud.com/10989 Tested-by: Jenkins Reviewed-by: Alex Zhuravlev Reviewed-by: wangdi Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 1892e3b..2ea9025 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -1149,16 +1149,16 @@ static int lod_attr_set(const struct lu_env *env, */ LASSERT(lo->ldo_stripe); for (i = 0; i < lo->ldo_stripenr; i++) { - if (likely(lo->ldo_stripe[i] != NULL)) { - if (dt_object_exists(lo->ldo_stripe[i]) == 0) - continue; - - rc = dt_attr_set(env, lo->ldo_stripe[i], attr, - handle, capa); - if (rc != 0) { - CERROR("failed declaration: %d\n", rc); - break; - } + if (unlikely(lo->ldo_stripe[i] == NULL)) + continue; + if (S_ISDIR(dt->do_lu.lo_header->loh_attr) && + (dt_object_exists(lo->ldo_stripe[i]) == 0)) + continue; + + rc = dt_attr_set(env, lo->ldo_stripe[i], attr, handle, capa); + if (rc != 0) { + CERROR("failed declaration: %d\n", rc); + break; } } diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index 8713ff0e3..8bbd938 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -237,7 +237,9 @@ static int osp_sync_add_rec(const struct lu_env *env, struct osp_device *d, LASSERT(attr); osi->osi_setattr.lsr_uid = attr->la_uid; osi->osi_setattr.lsr_gid = attr->la_gid; - osi->osi_setattr.lsr_valid = attr->la_valid; + osi->osi_setattr.lsr_valid = + ((attr->la_valid & LA_UID) ? OBD_MD_FLUID : 0) | + ((attr->la_valid & LA_GID) ? OBD_MD_FLGID : 0); break; default: LBUG(); @@ -483,8 +485,9 @@ static int osp_sync_new_setattr_job(struct osp_device *d, ENTRY; LASSERT(h->lrh_type == MDS_SETATTR64_REC); - /* lsr_valid can only be 0 or LA_UID/GID set */ - if ((rec->lsr_valid & ~(LA_UID | LA_GID)) != 0) { + /* lsr_valid can only be 0 or have OBD_MD_{FLUID,FLGID} set, + * so no bits other than these should be set. */ + if ((rec->lsr_valid & ~(OBD_MD_FLUID | OBD_MD_FLGID)) != 0) { CERROR("%s: invalid setattr record, lsr_valid:"LPU64"\n", d->opd_obd->obd_name, rec->lsr_valid); /* return 0 so that sync thread can continue processing @@ -504,14 +507,10 @@ static int osp_sync_new_setattr_job(struct osp_device *d, body->oa.o_valid = OBD_MD_FLGROUP | OBD_MD_FLID; /* old setattr record (prior 2.6.0) doesn't have 'valid' stored, * we assume that both UID and GID are valid in that case. */ - if (rec->lsr_valid == 0) { + if (rec->lsr_valid == 0) body->oa.o_valid |= (OBD_MD_FLUID | OBD_MD_FLGID); - } else { - if (rec->lsr_valid & LA_UID) - body->oa.o_valid |= OBD_MD_FLUID; - if (rec->lsr_valid & LA_GID) - body->oa.o_valid |= OBD_MD_FLGID; - } + else + body->oa.o_valid |= rec->lsr_valid; osp_sync_send_new_rpc(d, req); RETURN(1); diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 4de4a04..9e3ded1 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -50,9 +50,6 @@ if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] && skip "e2fsprogs doesn't support quota" && exit 0 fi -# bug number for skipped test: LU-4515 -ALWAYS_EXCEPT="$ALWAYS_EXCEPT 34" - if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then # bug number for skipped test: LU-2872 LU-2836 LU-2836 LU-2059 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 1 3 6 7d"