};
int Server::parse_layout_vxattr(string name, string value, const OSDMap *osdmap,
- ceph_file_layout *layout)
+ ceph_file_layout *layout, bool validate)
{
dout(20) << "parse_layout_vxattr name " << name << " value '" << value << "'" << dendl;
try {
if (begin != end)
return -EINVAL;
for (map<string,string>::iterator q = m.begin(); q != m.end(); ++q) {
- int r = parse_layout_vxattr(string("layout.") + q->first, q->second, osdmap, layout);
+ // Skip validation on each attr, we do it once at the end (avoid
+ // rejecting intermediate states if the overall result is ok)
+ int r = parse_layout_vxattr(string("layout.") + q->first, q->second,
+ osdmap, layout, false);
if (r < 0)
return r;
}
return -EINVAL;
}
- if (!ceph_file_layout_is_valid(layout)) {
+ if (validate && !ceph_file_layout_is_valid(layout)) {
dout(10) << "bad layout" << dendl;
return -EINVAL;
}
void handle_client_setdirlayout(MDRequestRef& mdr);
int parse_layout_vxattr(string name, string value, const OSDMap *osdmap,
- ceph_file_layout *layout);
+ ceph_file_layout *layout, bool validate=true);
int parse_quota_vxattr(string name, string value, quota_info_t *quota);
void handle_set_vxattr(MDRequestRef& mdr, CInode *cur,
ceph_file_layout *dir_layout,