From 5596d5f019142286ef32f31f6373a4e8d8e586a0 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 16 Mar 2021 12:22:56 -0400 Subject: [PATCH] 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) --- src/mds/Server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index f1f1997dae4d8..4869ff2472c43 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; } -- 2.39.5