From 7a9a2e4aeec952169841a84be0679d1d1ed35acf Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 8 Mar 2018 13:30:46 -0600 Subject: [PATCH] LU-10787 llite: correct removexattr detection In ll_xattr_set_common() detect the removexattr() case correctly by testing for a NULL value as well as XATTR_REPLACE. Signed-off-by: John L. Hammond Change-Id: I29a29851ad4ac432e257b63088e2d7a7dfc39605 Reviewed-on: https://review.whamcloud.com/31594 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/llite/xattr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index 96ef059..b2c0407 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -94,7 +94,10 @@ static int ll_xattr_set_common(const struct xattr_handler *handler, int rc; ENTRY; - if (flags == XATTR_REPLACE) { + /* When setxattr() is called with a size of 0 the value is + * unconditionally replaced by "". When removexattr() is + * called we get a NULL value and XATTR_REPLACE for flags. */ + if (!value && flags == XATTR_REPLACE) { ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1); valid = OBD_MD_FLXATTRRM; } else { -- 1.8.3.1