From: Jeff Layton Date: Tue, 16 Mar 2021 16:22:56 +0000 (-0400) Subject: mds: fix removexattr logic when there aren't any X-Git-Tag: v16.2.0~14^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5596d5f019142286ef32f31f6373a4e8d8e586a0;p=ceph.git mds: fix removexattr logic when there aren't any 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 (cherry picked from commit 85e73c7c7509cefbc50902436aca07a9a333eb23) --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index f1f1997dae4..4869ff2472c 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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; }