From: wang di Date: Tue, 24 Feb 2015 04:22:03 +0000 (-0800) Subject: LU-6280 lod: delete xattr on striped dir X-Git-Tag: 2.7.51~86 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=2a7abc63732a6a7674bc606df9ce641dfe7bf092 LU-6280 lod: delete xattr on striped dir In lod_xattr_del(), it need delete EA on all stripes of striped directory. Signed-off-by: wang di Change-Id: I398a03d6a41daee34a344104d67cf8efa7d97f6a Reviewed-on: http://review.whamcloud.com/13867 Tested-by: Jenkins Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index fc9802c..791466c 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -2811,7 +2811,34 @@ static int lod_declare_xattr_del(const struct lu_env *env, struct dt_object *dt, const char *name, struct thandle *th) { - return dt_declare_xattr_del(env, dt_object_child(dt), name, th); + struct lod_object *lo = lod_dt_obj(dt); + int rc; + int i; + ENTRY; + + rc = dt_declare_xattr_del(env, dt_object_child(dt), name, th); + if (rc != 0) + RETURN(rc); + + if (!S_ISDIR(dt->do_lu.lo_header->loh_attr)) + RETURN(0); + + /* set xattr to each stripes, if needed */ + rc = lod_load_striping(env, lo); + if (rc != 0) + RETURN(rc); + + if (lo->ldo_stripenr == 0) + RETURN(0); + + for (i = 0; i < lo->ldo_stripenr; i++) { + LASSERT(lo->ldo_stripe[i]); + rc = dt_declare_xattr_del(env, lo->ldo_stripe[i], name, th); + if (rc != 0) + break; + } + + RETURN(rc); } /** @@ -2826,9 +2853,30 @@ static int lod_xattr_del(const struct lu_env *env, struct dt_object *dt, const char *name, struct thandle *th, struct lustre_capa *capa) { + struct dt_object *next = dt_object_child(dt); + struct lod_object *lo = lod_dt_obj(dt); + int rc; + int i; + ENTRY; + if (!strcmp(name, XATTR_NAME_LOV)) lod_object_free_striping(env, lod_dt_obj(dt)); - return dt_xattr_del(env, dt_object_child(dt), name, th, capa); + + rc = dt_xattr_del(env, next, name, th, capa); + if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr)) + RETURN(rc); + + if (lo->ldo_stripenr == 0) + RETURN(0); + + for (i = 0; i < lo->ldo_stripenr; i++) { + LASSERT(lo->ldo_stripe[i]); + rc = dt_xattr_del(env, lo->ldo_stripe[i], name, th, capa); + if (rc != 0) + break; + } + + RETURN(rc); } /**