osd/PrimaryLogPG: get_snapset_context: don't look on snapdir

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-08-31 18:22:15 -04:00
parent 5e0d5c1213
commit 4d611cfaa6

View File

@ -10023,15 +10023,11 @@ SnapSetContext *PrimaryLogPG::get_snapset_context(
bufferlist bv;
if (!attrs) {
int r = -ENOENT;
if (!(oid.is_head() && !oid_existed))
if (!(oid.is_head() && !oid_existed)) {
r = pgbackend->objects_get_attr(oid.get_head(), SS_ATTR, &bv);
if (r < 0) {
// try _snapset
if (!(oid.is_snapdir() && !oid_existed))
r = pgbackend->objects_get_attr(oid.get_snapdir(), SS_ATTR, &bv);
if (r < 0 && !can_create)
return NULL;
}
if (r < 0 && !can_create)
return NULL;
} else {
assert(attrs->count(SS_ATTR));
bv = attrs->find(SS_ATTR)->second;