mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
drbd: fix check for too large lower level device
To check wether we are truncating a very large device due to limited meta data space, we need to check the ll_dev size. Also improve the printk to suggest "flexible" or "internal". Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
ad19bf6e54
commit
1352994b36
1 changed files with 9 additions and 5 deletions
|
@ -894,11 +894,6 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
|
||||||
min_md_device_sectors = MD_RESERVED_SECT * (nbc->dc.meta_dev_idx + 1);
|
min_md_device_sectors = MD_RESERVED_SECT * (nbc->dc.meta_dev_idx + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drbd_get_capacity(nbc->md_bdev) > max_possible_sectors)
|
|
||||||
dev_warn(DEV, "truncating very big lower level device "
|
|
||||||
"to currently maximum possible %llu sectors\n",
|
|
||||||
(unsigned long long) max_possible_sectors);
|
|
||||||
|
|
||||||
if (drbd_get_capacity(nbc->md_bdev) < min_md_device_sectors) {
|
if (drbd_get_capacity(nbc->md_bdev) < min_md_device_sectors) {
|
||||||
retcode = ERR_MD_DISK_TO_SMALL;
|
retcode = ERR_MD_DISK_TO_SMALL;
|
||||||
dev_warn(DEV, "refusing attach: md-device too small, "
|
dev_warn(DEV, "refusing attach: md-device too small, "
|
||||||
|
@ -917,6 +912,15 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
|
||||||
|
|
||||||
nbc->known_size = drbd_get_capacity(nbc->backing_bdev);
|
nbc->known_size = drbd_get_capacity(nbc->backing_bdev);
|
||||||
|
|
||||||
|
if (nbc->known_size > max_possible_sectors) {
|
||||||
|
dev_warn(DEV, "==> truncating very big lower level device "
|
||||||
|
"to currently maximum possible %llu sectors <==\n",
|
||||||
|
(unsigned long long) max_possible_sectors);
|
||||||
|
if (nbc->dc.meta_dev_idx >= 0)
|
||||||
|
dev_warn(DEV, "==>> using internal or flexible "
|
||||||
|
"meta data may help <<==\n");
|
||||||
|
}
|
||||||
|
|
||||||
drbd_suspend_io(mdev);
|
drbd_suspend_io(mdev);
|
||||||
/* also wait for the last barrier ack. */
|
/* also wait for the last barrier ack. */
|
||||||
wait_event(mdev->misc_wait, !atomic_read(&mdev->ap_pending_cnt));
|
wait_event(mdev->misc_wait, !atomic_read(&mdev->ap_pending_cnt));
|
||||||
|
|
Loading…
Reference in a new issue