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

os/bluestore: fix min_alloc_size at mkfs time #13192

Merged
merged 4 commits into from Feb 2, 2017

Conversation

liewegas
Copy link
Member

No description provided.

try {
::decode(ondisk_format, p);
} catch (buffer::error& e) {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dump some error on exception as we suppose they are possible?

}
bl.clear();
{
r = db->get(PREFIX_SUPER, "compat_ondisk_format", &bl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest do at least assert(r>=0) afterwards

}
}

_set_alloc_sizes();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's better to be inserted in the next commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And currently is might be called without prior min_alloc_size var setting.

// - super: added min_readable_ondisk_format
// - super: added min_compat_ondisk_format
ondisk_format = 2;
_prepare_ondisk_format_super(t);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined t?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this's fixed in the next commit but makes this one broken - hence might produce issues with bisect or cherry-pick...

derr << __func__ << " failed to read min_min_alloc_size" << dendl;
return -EIO;
}
t->set(PREFIX_SUPER, "min_alloc_size", bl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see any read of that parameter, looks like min_alloc_size in uninitialized if mkfs is bypassed.

Signed-off-by: Sage Weil <sage@redhat.com>
Note the version of the ondisk format and the oldest version that is
allowed to read us.

Signed-off-by: Sage Weil <sage@redhat.com>
It is an ongoing challenge to allow min_alloc_size to be varied on
an existing bluestore instance, and the code paths are not well
tested.  Avoid the complexity entirely by fixing min_alloc_size at
mkfs time.

Signed-off-by: Sage Weil <sage@redhat.com>
@liewegas
Copy link
Member Author

fixed, cleaned up, tested trivial upgrade w/ vstart

db->get(PREFIX_SUPER, "min_min_alloc_size", &bl);
auto p = bl.begin();
try {
::decode(min_alloc_size, p);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to decode using a standalone variable instead of min_alloc_size. With an explicit type specification for that var (equal to min_min_alloc_size). Otherwise one might have a well hidden issue when changing min_alloc_size type in future.

Defend against future changes to min_alloc_size.

Signed-off-by: Sage Weil <sage@redhat.com>
@liewegas
Copy link
Member Author

retest this please

@liewegas liewegas merged commit 6e72005 into ceph:master Feb 2, 2017
@liewegas liewegas deleted the wip-bluestore-min-alloc-size branch February 2, 2017 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants