Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kraken: librbd: default initialize snapshot namespace for legacy clients #14934

Merged
merged 1 commit into from Jul 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cls/rbd/cls_rbd.cc
Expand Up @@ -1525,6 +1525,12 @@ int snapshot_add(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
return -EINVAL;
}

if (boost::get<cls::rbd::UnknownSnapshotNamespace>(
&snap_meta.snapshot_namespace.snapshot_namespace) != nullptr) {
CLS_ERR("Unknown snapshot namespace provided");
return -EINVAL;
}

CLS_LOG(20, "snapshot_add name=%s id=%llu", snap_meta.name.c_str(),
(unsigned long long)snap_meta.id.val);

Expand Down
5 changes: 2 additions & 3 deletions src/cls/rbd/cls_rbd.h
Expand Up @@ -65,7 +65,8 @@ struct cls_rbd_snap {
uint8_t protection_status;
cls_rbd_parent parent;
uint64_t flags;
cls::rbd::SnapshotNamespaceOnDisk snapshot_namespace;
cls::rbd::SnapshotNamespaceOnDisk snapshot_namespace = {
cls::rbd::UserSnapshotNamespace{}};

/// true if we have a parent
bool has_parent() const {
Expand Down Expand Up @@ -105,8 +106,6 @@ struct cls_rbd_snap {
}
if (struct_v >= 5) {
::decode(snapshot_namespace, p);
} else {
snapshot_namespace = cls::rbd::SnapshotNamespaceOnDisk(cls::rbd::UserSnapshotNamespace());
}
DECODE_FINISH(p);
}
Expand Down