Whamcloud - gitweb
LU-8493 osp: Do not set stale for new osp obj 61/21861/2
authorDi Wang <di.wang@intel.com>
Thu, 4 Aug 2016 22:34:14 +0000 (18:34 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 22 Aug 2016 03:45:31 +0000 (03:45 +0000)
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 <di.wang@intel.com>
Change-Id: Ib92deab4e0c900d59fbdc2bf50e17fd29fd2ecce
Reviewed-on: http://review.whamcloud.com/21861
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osp/osp_internal.h
lustre/osp/osp_md_object.c
lustre/osp/osp_object.c

index 999da87..bfb43a6 100644 (file)
@@ -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);
index 4d72051..8b88358 100644 (file)
@@ -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;
 }
index 73b1ab7..268b82a 100644 (file)
@@ -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);