Since all ceph.* xattrs need not be virtual (stored in inode
structure), restrict certain xattrs (ceph.mirror.info) to be
persisted in xattr_map. Other ceph.* xattrs which do not pass
the virtual xattr check are rejected.
Signed-off-by: Venky Shankar <vshankar@redhat.com>
return;
}
+ if (!is_allowed_ceph_xattr(name)) {
+ respond_to_request(mdr, -EINVAL);
+ return;
+ }
+
CInode *cur = rdlock_path_pin_ref(mdr, true);
if (!cur)
return;
return;
}
+ if (!is_allowed_ceph_xattr(name)) {
+ respond_to_request(mdr, -EINVAL);
+ return;
+ }
+
CInode* cur = rdlock_path_pin_ref(mdr, true);
if (!cur)
return;
xattr_name == "ceph.dir.pin.distributed"sv;
}
+ static bool is_allowed_ceph_xattr(std::string_view xattr_name) {
+ // not a ceph xattr -- allow!
+ if (xattr_name.rfind("ceph.", 0) != 0) {
+ return true;
+ }
+
+ return xattr_name == "ceph.mirror.info";
+ }
+
void reply_client_request(MDRequestRef& mdr, const ref_t<MClientReply> &reply);
void flush_session(Session *session, MDSGatherBuilder& gather);