Whamcloud - gitweb
LU-10787 llite: correct removexattr detection 94/31594/3
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 8 Mar 2018 19:30:46 +0000 (13:30 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 9 Apr 2018 19:49:58 +0000 (19:49 +0000)
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 <john.hammond@intel.com>
Change-Id: I29a29851ad4ac432e257b63088e2d7a7dfc39605
Reviewed-on: https://review.whamcloud.com/31594
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/xattr.c

index 96ef059..b2c0407 100644 (file)
@@ -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 {