The new quota format requires that quota inodes have snaprealm.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Fixes: http://tracker.ceph.com/issues/23491
void MDCache::broadcast_quota_to_client(CInode *in)
{
+ if (!(mds->is_active() || mds->is_stopping()))
+ return;
+
if (!in->is_auth() || in->is_frozen())
return;
auto i = in->get_projected_inode();
-
if (!i->quota.is_enable())
return;
+ // creaete snaprealm for quota inode (quota was set before mimic)
+ if (!in->get_projected_srnode())
+ mds->server->create_quota_realm(in);
+
for (map<client_t,Capability*>::iterator it = in->client_caps.begin();
it != in->client_caps.end();
++it) {
if (name == "quota") {
string::iterator begin = value.begin();
string::iterator end = value.end();
+ if (begin == end) {
+ // keep quota unchanged. (for create_quota_realm())
+ return 0;
+ }
keys_and_values<string::iterator> p; // create instance of parser
std::map<string, string> m; // map to receive results
if (!qi::parse(begin, end, p, m)) { // returns true if successful
return 0;
}
+void Server::create_quota_realm(CInode *in)
+{
+ dout(10) << __func__ << " " << *in << dendl;
+
+ MClientRequest *req = new MClientRequest(CEPH_MDS_OP_SETXATTR);
+ req->set_filepath(filepath(in->ino()));
+ req->set_string2("ceph.quota");
+ // empty vxattr value
+ req->set_tid(mds->issue_tid());
+
+ mds->send_message_mds(req, in->authority().first);
+}
+
/*
* Verify that the file layout attribute carried by client
* is well-formatted.
void handle_client_setlayout(MDRequestRef& mdr);
void handle_client_setdirlayout(MDRequestRef& mdr);
+ int parse_quota_vxattr(string name, string value, quota_info_t *quota);
+ void create_quota_realm(CInode *in);
int parse_layout_vxattr(string name, string value, const OSDMap& osdmap,
file_layout_t *layout, bool validate=true);
- int parse_quota_vxattr(string name, string value, quota_info_t *quota);
int check_layout_vxattr(MDRequestRef& mdr,
string name,
string value,