Whamcloud - gitweb
LU-10922 osd-zfs: return -ENOENT if object destoryed 42/32042/3
authorFan Yong <fan.yong@intel.com>
Sat, 21 Apr 2018 04:08:47 +0000 (12:08 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 6 May 2018 03:42:30 +0000 (03:42 +0000)
Originally, if the target object does not exist or just destroyed,
the osd_xattr_get_internal() will return -ENOENT to the caller, it
is right. But one of the callers: osd_xattr_get(), converts it as
-ENODATA before returning to the upper layer by wrong.

This patch fixes it.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I9bfd03c53dda165af37a4ae62b4efbc5875833e5
Reviewed-on: https://review.whamcloud.com/32042
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-zfs/osd_xattr.c

index 20b064e..35c36c9 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)