Whamcloud - gitweb
LU-6999 osp: disable xattr cache for mdt obj 74/15974/4
authorwang di <di.wang@intel.com>
Tue, 11 Aug 2015 12:23:34 +0000 (05:23 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 1 Sep 2015 03:00:39 +0000 (03:00 +0000)
Because ldlm lock is missing for xattr cache on OSP obj,
let's Disable xattr cache for remote MDT object.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I4a7fa5f13791d531309f380f9e9303d04816c6a9
Reviewed-on: http://review.whamcloud.com/15974
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osp/osp_object.c

index 1ff4a88..0fa91c0 100644 (file)
@@ -935,32 +935,35 @@ int osp_xattr_get(const struct lu_env *env, struct dt_object *dt,
        if (unlikely(obj->opo_non_exist))
                RETURN(-ENOENT);
 
-       oxe = osp_oac_xattr_find(obj, name, false);
-       if (oxe != NULL) {
-               spin_lock(&obj->opo_lock);
-               if (oxe->oxe_ready) {
-                       if (!oxe->oxe_exist)
-                               GOTO(unlock, rc = -ENODATA);
+       /* Only cache xattr for OST object */
+       if (!osp->opd_connect_mdt) {
+               oxe = osp_oac_xattr_find(obj, name, false);
+               if (oxe != NULL) {
+                       spin_lock(&obj->opo_lock);
+                       if (oxe->oxe_ready) {
+                               if (!oxe->oxe_exist)
+                                       GOTO(unlock, rc = -ENODATA);
 
-                       if (buf->lb_buf == NULL)
-                               GOTO(unlock, rc = oxe->oxe_vallen);
+                               if (buf->lb_buf == NULL)
+                                       GOTO(unlock, rc = oxe->oxe_vallen);
 
-                       if (buf->lb_len < oxe->oxe_vallen)
-                               GOTO(unlock, rc = -ERANGE);
+                               if (buf->lb_len < oxe->oxe_vallen)
+                                       GOTO(unlock, rc = -ERANGE);
 
-                       memcpy(buf->lb_buf, oxe->oxe_value, oxe->oxe_vallen);
+                               memcpy(buf->lb_buf, oxe->oxe_value,
+                                      oxe->oxe_vallen);
 
-                       GOTO(unlock, rc = oxe->oxe_vallen);
+                               GOTO(unlock, rc = oxe->oxe_vallen);
 
 unlock:
-                       spin_unlock(&obj->opo_lock);
-                       osp_oac_xattr_put(oxe);
+                               spin_unlock(&obj->opo_lock);
+                               osp_oac_xattr_put(oxe);
 
-                       return rc;
+                               return rc;
+                       }
+                       spin_unlock(&obj->opo_lock);
                }
-               spin_unlock(&obj->opo_lock);
        }
-
        update = osp_update_request_create(dev);
        if (IS_ERR(update))
                GOTO(out, rc = PTR_ERR(update));
@@ -1029,7 +1032,7 @@ unlock:
 
        memcpy(buf->lb_buf, rbuf->lb_buf, rbuf->lb_len);
        rc = rbuf->lb_len;
-       if (obj->opo_ooa == NULL)
+       if (obj->opo_ooa == NULL || osp->opd_connect_mdt)
                GOTO(out, rc);
 
        if (oxe == NULL) {
@@ -1143,6 +1146,7 @@ int osp_xattr_set(const struct lu_env *env, struct dt_object *dt,
                  struct thandle *th)
 {
        struct osp_object       *o = dt2osp_obj(dt);
+       struct osp_device       *osp = lu2osp_dev(dt->do_lu.lo_dev);
        struct osp_update_request *update;
        struct osp_xattr_entry  *oxe;
        int                     rc;
@@ -1156,7 +1160,7 @@ int osp_xattr_set(const struct lu_env *env, struct dt_object *dt,
 
        rc = osp_update_rpc_pack(env, xattr_set, update, OUT_XATTR_SET,
                                 lu_object_fid(&dt->do_lu), buf, name, fl);
-       if (rc != 0 || o->opo_ooa == NULL)
+       if (rc != 0 || o->opo_ooa == NULL || osp->opd_connect_mdt)
                RETURN(rc);
 
        oxe = osp_oac_xattr_find_or_add(o, name, buf->lb_len);