Whamcloud - gitweb
LU-11914 build: add a configure check for l_getsepol
[fs/lustre-release.git] / lustre / osd-zfs / osd_xattr.c
index 20b064e..67be1b4 100644 (file)
@@ -292,6 +292,11 @@ int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
                RETURN(-EOPNOTSUPP);
 
        down_read(&obj->oo_guard);
+       if (unlikely(!dt_object_exists(dt) || obj->oo_destroyed)) {
+               up_read(&obj->oo_guard);
+               RETURN(-ENOENT);
+       }
+
        /* For the OST migrated from ldiskfs, the PFID EA may
         * be stored in LMA because of ldiskfs inode size. */
        if (strcmp(name, XATTR_NAME_FID) == 0 && obj->oo_pfid_in_lma)
@@ -421,12 +426,12 @@ int osd_declare_xattr_set(const struct lu_env *env, struct dt_object *dt,
 int __osd_sa_attr_init(const struct lu_env *env, struct osd_object *obj,
                       struct osd_thandle *oh)
 {
-       sa_bulk_attr_t  *bulk = osd_oti_get(env)->oti_attr_bulk;
-       struct osa_attr *osa = &osd_oti_get(env)->oti_osa;
+       sa_bulk_attr_t *bulk = osd_oti_get(env)->oti_attr_bulk;
+       struct osa_attr *osa = &osd_oti_get(env)->oti_osa;
        struct lu_buf *lb = &osd_oti_get(env)->oti_xattr_lbuf;
        struct osd_device *osd = osd_obj2dev(obj);
        uint64_t crtime[2], gen;
-       timestruc_t now;
+       inode_timespec_t now;
        size_t size;
        int rc, cnt;
 
@@ -964,7 +969,17 @@ static int __osd_sa_xattr_del(const struct lu_env *env, struct osd_object *obj,
                return rc;
 
        rc = -nvlist_remove(obj->oo_sa_xattr, name, DATA_TYPE_BYTE_ARRAY);
-       if (rc == 0)
+       if (rc)
+               return rc;
+
+       /*
+        * only migrate delete LMV, and it needs to be done immediately, because
+        * it's used in deleting sub stripes, and if this is delayed, later when
+        * destroying the master object, it will delete sub stripes again.
+        */
+       if (!strcmp(name, XATTR_NAME_LMV))
+               rc = __osd_sa_xattr_update(env, obj, oh);
+       else
                rc = __osd_sa_xattr_schedule_update(env, obj, oh);
        return rc;
 }