From 8d2655309a80a55a066011a66e7c95f7a0087e9c Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sat, 21 Apr 2018 12:08:47 +0800 Subject: [PATCH] LU-10922 osd-zfs: return -ENOENT if object destoryed 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 Change-Id: I9bfd03c53dda165af37a4ae62b4efbc5875833e5 Reviewed-on: https://review.whamcloud.com/32042 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_xattr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/osd-zfs/osd_xattr.c b/lustre/osd-zfs/osd_xattr.c index 20b064e..35c36c9 100644 --- a/lustre/osd-zfs/osd_xattr.c +++ b/lustre/osd-zfs/osd_xattr.c @@ -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) -- 1.8.3.1