diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2012-06-25 13:15:58 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-07-24 09:14:00 -0400 |
commit | db141b2f42b485b700465fe2401fbe65c65b190c (patch) | |
tree | 2af5670c18463173c7b9f5450bf09a90e463f986 /drivers/block/drbd/drbd_main.c | |
parent | 7ee1fb93f390f7a7231abec4e34e6ab20abeed45 (diff) |
drbd: fix max_bio_size to be unsigned
We capped our max_bio_size respectively max_hw_sectors with
min_t(int, lower level limit, our limit);
unfortunately, some drivers, e.g. the kvm virtio block driver, initialize their
limits to "-1U", and that is of course a smaller "int" value than our limit.
Impact: we started to request 16 MB resync requests,
which lead to protocol error and a reconnect loop.
Fix all relevant constants and parameters to be unsigned int.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 29a276425079..1ee1404769c2 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2209,7 +2209,8 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
2209 | { | 2209 | { |
2210 | struct p_sizes p; | 2210 | struct p_sizes p; |
2211 | sector_t d_size, u_size; | 2211 | sector_t d_size, u_size; |
2212 | int q_order_type, max_bio_size; | 2212 | int q_order_type; |
2213 | unsigned int max_bio_size; | ||
2213 | int ok; | 2214 | int ok; |
2214 | 2215 | ||
2215 | if (get_ldev_if_state(mdev, D_NEGOTIATING)) { | 2216 | if (get_ldev_if_state(mdev, D_NEGOTIATING)) { |
@@ -2218,7 +2219,7 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
2218 | u_size = mdev->ldev->dc.disk_size; | 2219 | u_size = mdev->ldev->dc.disk_size; |
2219 | q_order_type = drbd_queue_order_type(mdev); | 2220 | q_order_type = drbd_queue_order_type(mdev); |
2220 | max_bio_size = queue_max_hw_sectors(mdev->ldev->backing_bdev->bd_disk->queue) << 9; | 2221 | max_bio_size = queue_max_hw_sectors(mdev->ldev->backing_bdev->bd_disk->queue) << 9; |
2221 | max_bio_size = min_t(int, max_bio_size, DRBD_MAX_BIO_SIZE); | 2222 | max_bio_size = min(max_bio_size, DRBD_MAX_BIO_SIZE); |
2222 | put_ldev(mdev); | 2223 | put_ldev(mdev); |
2223 | } else { | 2224 | } else { |
2224 | d_size = 0; | 2225 | d_size = 0; |
@@ -2229,7 +2230,7 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
2229 | 2230 | ||
2230 | /* Never allow old drbd (up to 8.3.7) to see more than 32KiB */ | 2231 | /* Never allow old drbd (up to 8.3.7) to see more than 32KiB */ |
2231 | if (mdev->agreed_pro_version <= 94) | 2232 | if (mdev->agreed_pro_version <= 94) |
2232 | max_bio_size = min_t(int, max_bio_size, DRBD_MAX_SIZE_H80_PACKET); | 2233 | max_bio_size = min(max_bio_size, DRBD_MAX_SIZE_H80_PACKET); |
2233 | 2234 | ||
2234 | p.d_size = cpu_to_be64(d_size); | 2235 | p.d_size = cpu_to_be64(d_size); |
2235 | p.u_size = cpu_to_be64(u_size); | 2236 | p.u_size = cpu_to_be64(u_size); |
@@ -3981,9 +3982,9 @@ int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | |||
3981 | 3982 | ||
3982 | spin_lock_irq(&mdev->req_lock); | 3983 | spin_lock_irq(&mdev->req_lock); |
3983 | if (mdev->state.conn < C_CONNECTED) { | 3984 | if (mdev->state.conn < C_CONNECTED) { |
3984 | int peer; | 3985 | unsigned int peer; |
3985 | peer = be32_to_cpu(buffer->la_peer_max_bio_size); | 3986 | peer = be32_to_cpu(buffer->la_peer_max_bio_size); |
3986 | peer = max_t(int, peer, DRBD_MAX_BIO_SIZE_SAFE); | 3987 | peer = max(peer, DRBD_MAX_BIO_SIZE_SAFE); |
3987 | mdev->peer_max_bio_size = peer; | 3988 | mdev->peer_max_bio_size = peer; |
3988 | } | 3989 | } |
3989 | spin_unlock_irq(&mdev->req_lock); | 3990 | spin_unlock_irq(&mdev->req_lock); |