]> git-server-git.apps.pok.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)
committerJeff Layton <jlayton@redhat.com>
Tue, 16 Mar 2021 17:17:09 +0000 (13:17 -0400)
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>
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;
     }