From: John L. Hammond Date: Thu, 8 Mar 2018 19:30:46 +0000 (-0600) Subject: LU-10787 llite: correct removexattr detection X-Git-Tag: 2.11.51~40 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F94%2F31594%2F3;p=fs%2Flustre-release.git 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 --- 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 {