]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drbd: Improve compatibility with drbd's older than 8.3.7
authorPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 30 Jun 2011 13:43:06 +0000 (15:43 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Wed, 9 May 2012 08:08:57 +0000 (10:08 +0200)
Regression introduced with 8.3.11 commit:
drbd: Take a more conservative approach when deciding max_bio_size

Never ever tell an older drbd, that we support more than 32KiB
in a single data request (packet).
Never believe an older drbd, that is supports more than 32KiB
in a single data request (packet)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_nl.c

index 8e83a402ed5cf5efcbffdac7dbee34f0493583ec..a15135b9b60aafbbea18aed00ea965fb7cf90e24 100644 (file)
@@ -2112,6 +2112,10 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl
                max_bio_size = DRBD_MAX_BIO_SIZE; /* ... multiple BIOs per peer_request */
        }
 
+       /* Never allow old drbd (up to 8.3.7) to see more than 32KiB */
+       if (mdev->agreed_pro_version <= 94)
+               max_bio_size = min_t(int, max_bio_size, DRBD_MAX_SIZE_H80_PACKET);
+
        p.d_size = cpu_to_be64(d_size);
        p.u_size = cpu_to_be64(u_size);
        p.c_size = cpu_to_be64(trigger_reply ? 0 : drbd_get_capacity(mdev->this_bdev));
index f7b5f7e86a57cc16d0bae6603e528c3e553ed794..cabad39f908c719d8c9cbdad8b81ecc25aa12721 100644 (file)
@@ -845,9 +845,10 @@ void drbd_reconsider_max_bio_size(struct drbd_conf *mdev)
           Because new from 8.3.8 onwards the peer can use multiple
           BIOs for a single peer_request */
        if (mdev->state.conn >= C_CONNECTED) {
-               if (mdev->agreed_pro_version < 94)
-                       peer = mdev->peer_max_bio_size;
-               else if (mdev->agreed_pro_version == 94)
+               if (mdev->agreed_pro_version < 94) {
+                       peer = min_t(int, mdev->peer_max_bio_size, DRBD_MAX_SIZE_H80_PACKET);
+                       /* Correct old drbd (up to 8.3.7) if it believes it can do more than 32KiB */
+               } else if (mdev->agreed_pro_version == 94)
                        peer = DRBD_MAX_SIZE_H80_PACKET;
                else /* drbd 8.3.8 onwards */
                        peer = DRBD_MAX_BIO_SIZE;