Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drbd: always set BLK_FEAT_STABLE_WRITES

DRBD requires stable pages because it may read the same bio data
multiple times for local disk I/O and network transmission, and in
some cases for calculating checksums.

The BLK_FEAT_STABLE_WRITES flag is set when the device is first
created, but blk_set_stacking_limits() clears it whenever a
backing device is attached. In some cases the flag may be
inherited from the backing device, but we want it to be enabled
at all times.

Unconditionally re-enable BLK_FEAT_STABLE_WRITES in
drbd_reconsider_queue_parameters() after the queue parameter
negotiations.

Also, document why we want this flag enabled in the first place.

Fixes: 1a02f3a73f8c ("block: move the stable_writes flag to queue_limits")
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Böhmwalder and committed by
Jens Axboe
2ebc8d60 192c0159

+19 -4
-3
drivers/block/drbd/drbd_main.c
··· 2659 2659 * connect. 2660 2660 */ 2661 2661 .max_hw_sectors = DRBD_MAX_BIO_SIZE_SAFE >> 8, 2662 - .features = BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA | 2663 - BLK_FEAT_ROTATIONAL | 2664 - BLK_FEAT_STABLE_WRITES, 2665 2662 }; 2666 2663 2667 2664 device = minor_to_device(minor);
+19 -1
drivers/block/drbd/drbd_nl.c
··· 1296 1296 lim.max_segments = drbd_backing_dev_max_segments(device); 1297 1297 } else { 1298 1298 lim.max_segments = BLK_MAX_SEGMENTS; 1299 + lim.features = BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA | 1300 + BLK_FEAT_ROTATIONAL | BLK_FEAT_STABLE_WRITES; 1299 1301 } 1300 1302 1301 1303 lim.max_hw_sectors = new >> SECTOR_SHIFT; ··· 1320 1318 lim.max_hw_discard_sectors = 0; 1321 1319 } 1322 1320 1323 - if (bdev) 1321 + if (bdev) { 1324 1322 blk_stack_limits(&lim, &b->limits, 0); 1323 + /* 1324 + * blk_set_stacking_limits() cleared the features, and 1325 + * blk_stack_limits() may or may not have inherited 1326 + * BLK_FEAT_STABLE_WRITES from the backing device. 1327 + * 1328 + * DRBD always requires stable writes because: 1329 + * 1. The same bio data is read for both local disk I/O and 1330 + * network transmission. If the page changes mid-flight, 1331 + * the local and remote copies could diverge. 1332 + * 2. When data integrity is enabled, DRBD calculates a 1333 + * checksum before sending the data. If the page changes 1334 + * between checksum calculation and transmission, the 1335 + * receiver will detect a checksum mismatch. 1336 + */ 1337 + lim.features |= BLK_FEAT_STABLE_WRITES; 1338 + } 1325 1339 1326 1340 /* 1327 1341 * If we can handle "zeroes" efficiently on the protocol, we want to do