blob: disallow bs load on device with unsupported block length
Blobstore supports only block lengths that are less than SPDK_BS_PAGE_SIZE or when multiplication of block len results in SPDK_BS_PAGE_SIZE. This was checked only on spdk_bs_init(), but not spdk_bs_load(). When not checked, it caused issues with lvol store tasting. During tasting, there is an attempt to perform spdk_bs_load() on a given device. It was possible to hit asserts in blobstore by creating malloc with block size 8192. Change-Id: I30b62bebad405b581eb2158925884adc616d9b92 Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.gerrithub.io/404537 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
da415ae9a0
commit
ea3a17fb55
@ -2811,6 +2811,13 @@ spdk_bs_load(struct spdk_bs_dev *dev, struct spdk_bs_opts *o,
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_BLOB, "Loading blobstore from dev %p\n", dev);
|
||||
|
||||
if ((SPDK_BS_PAGE_SIZE % dev->blocklen) != 0) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_BLOB, "unsupported dev block length of %d\n", dev->blocklen);
|
||||
dev->destroy(dev);
|
||||
cb_fn(cb_arg, NULL, -EINVAL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (o) {
|
||||
opts = *o;
|
||||
} else {
|
||||
|
@ -1541,6 +1541,11 @@ bs_load(void)
|
||||
super_block = (struct spdk_bs_super_block *)g_dev_buffer;
|
||||
CU_ASSERT(super_block->clean == 1);
|
||||
|
||||
/* Load should fail for device with an unsupported blocklen */
|
||||
dev = init_dev();
|
||||
dev->blocklen = SPDK_BS_PAGE_SIZE * 2;
|
||||
spdk_bs_load(dev, NULL, bs_op_with_handle_complete, NULL);
|
||||
CU_ASSERT(g_bserrno == -EINVAL);
|
||||
|
||||
/* Load an existing blob store */
|
||||
dev = init_dev();
|
||||
|
Loading…
Reference in New Issue
Block a user