]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging: lustre: llite: correct removexattr detection
authorJames Simmons <jsimmons@infradead.org>
Mon, 16 Apr 2018 04:15:10 +0000 (00:15 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Mar 2019 13:20:51 +0000 (14:20 +0100)
BugLink: http://bugs.launchpad.net/bugs/1815234
[ Upstream commit 1b60f6dfa38403ff7c4d0b4b7ecdb810f9789a2a ]

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>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10787
Reviewed-on: https://review.whamcloud.com/
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/staging/lustre/lustre/llite/xattr.c

index 532384c914471a5e5aeb19bdb161199cea62201b..074f86931c465b34eb9aca6cfc06d275b70cd3bf 100644 (file)
@@ -94,7 +94,11 @@ ll_xattr_set_common(const struct xattr_handler *handler,
        __u64 valid;
        int rc;
 
-       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 {