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>
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);
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);
int osp_trans_stop(const struct lu_env *env, struct dt_device *dt,
struct thandle *th);
* invalidate opo cache for the object after the object is created, so
* attr_get will try to get attr from remote object.
*/
* 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);
+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.
*
/**
* Implement OSP layer dt_object_operations::do_invalidate() interface.
*
int osp_invalidate(const struct lu_env *env, struct dt_object *dt)
{
struct osp_object *obj = dt2osp_obj(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;
+ osp_obj_invalidate_cache(obj);
+
spin_lock(&obj->opo_lock);
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);
obj->opo_stale = 1;
spin_unlock(&obj->opo_lock);