From: Di Wang Date: Thu, 4 Aug 2016 22:34:14 +0000 (-0400) Subject: LU-8493 osp: Do not set stale for new osp obj X-Git-Tag: 2.8.57~20 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=431f18c87d28b7cdfa2c411f5e9e067592254610 LU-8493 osp: Do not set stale for new osp obj Do not set stale for the new OSP object, otherwise it will cause ESTALE failure for the following write operation, see osp_md_declare_write(). This problem is brought in by http://review.whamcloud.com/19041 Signed-off-by: Di Wang Change-Id: Ib92deab4e0c900d59fbdc2bf50e17fd29fd2ecce Reviewed-on: http://review.whamcloud.com/21861 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h index 999da87..bfb43a6 100644 --- a/lustre/osp/osp_internal.h +++ b/lustre/osp/osp_internal.h @@ -734,6 +734,7 @@ int osp_declare_xattr_del(const struct lu_env *env, struct dt_object *dt, int osp_xattr_del(const struct lu_env *env, struct dt_object *dt, const char *name, struct thandle *th); int osp_invalidate(const struct lu_env *env, struct dt_object *dt); +void osp_obj_invalidate_cache(struct osp_object *obj); int osp_trans_stop(const struct lu_env *env, struct dt_device *dt, struct thandle *th); diff --git a/lustre/osp/osp_md_object.c b/lustre/osp/osp_md_object.c index 4d72051..8b88358 100644 --- a/lustre/osp/osp_md_object.c +++ b/lustre/osp/osp_md_object.c @@ -92,7 +92,7 @@ static int osp_object_create_interpreter(const struct lu_env *env, * invalidate opo cache for the object after the object is created, so * attr_get will try to get attr from remote object. */ - osp_invalidate(env, &obj->opo_obj); + osp_obj_invalidate_cache(obj); return 0; } diff --git a/lustre/osp/osp_object.c b/lustre/osp/osp_object.c index 73b1ab7..268b82a 100644 --- a/lustre/osp/osp_object.c +++ b/lustre/osp/osp_object.c @@ -1204,6 +1204,21 @@ int osp_xattr_del(const struct lu_env *env, struct dt_object *dt, return 0; } +void osp_obj_invalidate_cache(struct osp_object *obj) +{ + struct osp_xattr_entry *oxe; + struct osp_xattr_entry *tmp; + + spin_lock(&obj->opo_lock); + list_for_each_entry_safe(oxe, tmp, &obj->opo_xattr_list, oxe_list) { + oxe->oxe_ready = 0; + list_del_init(&oxe->oxe_list); + osp_oac_xattr_put(oxe); + } + obj->opo_attr.la_valid = 0; + spin_unlock(&obj->opo_lock); +} + /** * Implement OSP layer dt_object_operations::do_invalidate() interface. * @@ -1218,17 +1233,11 @@ int osp_xattr_del(const struct lu_env *env, struct dt_object *dt, int osp_invalidate(const struct lu_env *env, struct dt_object *dt) { struct osp_object *obj = dt2osp_obj(dt); - struct osp_xattr_entry *oxe; - struct osp_xattr_entry *tmp; ENTRY; + osp_obj_invalidate_cache(obj); + spin_lock(&obj->opo_lock); - list_for_each_entry_safe(oxe, tmp, &obj->opo_xattr_list, oxe_list) { - oxe->oxe_ready = 0; - list_del_init(&oxe->oxe_list); - osp_oac_xattr_put(oxe); - } - obj->opo_attr.la_valid = 0; obj->opo_stale = 1; spin_unlock(&obj->opo_lock);