mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
Merge PR #40158 into master
* refs/pull/40158/head: test: add test for removing non-existent xattr mds: fix removexattr logic when there aren't any Reviewed-by: Sidharth Anupkrishnan <sanupkri@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
commit
222ce06bfa
@ -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;
|
||||
}
|
||||
|
@ -540,6 +540,9 @@ TEST(LibCephFS, Xattrs) {
|
||||
int fd = ceph_open(cmount, test_xattr_file, O_CREAT, 0666);
|
||||
ASSERT_GT(fd, 0);
|
||||
|
||||
// test removing non-existent xattr
|
||||
ASSERT_EQ(-ENODATA, ceph_removexattr(cmount, test_xattr_file, "user.nosuchxattr"));
|
||||
|
||||
char i = 'a';
|
||||
char xattrk[128];
|
||||
char xattrv[128];
|
||||
|
Loading…
Reference in New Issue
Block a user