From 33a4b5ef00e88b33136d09d2f4029223a3c4d681 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 10 Aug 2017 14:44:24 -0500 Subject: [PATCH] LU-9856 mdd: handle NULL buffer in mdd_xattr_list() 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 Change-Id: Iae87fba20325b228ef75ee762acfa49353932b1b Reviewed-on: https://review.whamcloud.com/28469 Tested-by: Jenkins Reviewed-by: Andrew Perepechko Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- lustre/mdd/mdd_object.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 7ab1a1a..beb9960 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -301,7 +301,9 @@ static int mdd_xattr_list(const struct lu_env *env, struct md_object *obj, 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); /* -- 1.8.3.1