The upper layer may call mdd_xattr_list() with a NULL buffer to get
the length of the xattr name list. Handle this case safely by skipping
the removal of the link xattr for unlinked objects.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Iae87fba20325b228ef75ee762acfa49353932b1b
Reviewed-on: https://review.whamcloud.com/28469
Tested-by: Jenkins
Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
rc = mdo_xattr_list(env, mdd_obj, buf);
mdd_read_unlock(env, mdd_obj);
- if (rc < 0)
+ /* If the buffer is NULL then we are only here to get the
+ * length of the xattr name list. */
+ if (rc < 0 || buf->lb_buf == NULL)
RETURN(rc);
/*