]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix removexattr logic when there aren't any
authorJeff Layton <jlayton@redhat.com>
Tue, 16 Mar 2021 16:22:56 +0000 (12:22 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 24 Mar 2021 15:57:06 +0000 (08:57 -0700)
The MDS currently returns success on a removexattr if the xattr map is
completely empty. Fix the subtle logic bug and have it return -ENODATA
in that case.

Fixes: https://tracker.ceph.com/issues/49833
Signed-off-by: Jeff Layton <jlayton@redhat.com>
(cherry picked from commit 85e73c7c7509cefbc50902436aca07a9a333eb23)

src/mds/Server.cc

index f1f1997dae4d89bf87b54750da44ec5e3c330a42..4869ff2472c43675c4887aaadd11957a0a6d0831 100644 (file)
@@ -5903,7 +5903,7 @@ int Server::xattr_validate(CInode *cur, const InodeStoreBase::xattr_map_const_pt
   }
 
   if (op == CEPH_MDS_OP_RMXATTR) {
-    if (xattrs && xattrs->count(mempool::mds_co::string(xattr_name)) == 0) {
+    if (!xattrs || xattrs->count(mempool::mds_co::string(xattr_name)) == 0) {
       dout(10) << "removexattr '" << xattr_name << "' and CEPHFS_ENODATA on " << *cur << dendl;
       return -CEPHFS_ENODATA;
     }