drbd: a few more GFP_KERNEL -> GFP_NOIO
authorLars Ellenberg <lars.ellenberg@linbit.com>
Thu, 20 Sep 2012 12:24:20 +0000 (14:24 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Oct 2012 07:39:18 +0000 (08:39 +0100)
This has not yet been observed, but conceivably, when using GFP_KERNEL
allocations from drbd_md_sync(), drbd_flush_after_epoch() or
receive_SyncParam(), we could trigger additional IO to our own device,
or an other device in a criss-cross setup, and end up in a local
deadlock, or potentially a distributed deadlock in a criss-cross setup
involving the peer blocked in a similar way waiting for us to make
progress.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_receiver.c

index 3b37812..557dd5a 100644 (file)
@@ -2497,7 +2497,7 @@ static inline void drbd_md_flush(struct drbd_conf *mdev)
        if (test_bit(MD_NO_FUA, &mdev->flags))
                return;
 
-       r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_KERNEL, NULL);
+       r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_NOIO, NULL);
        if (r) {
                set_bit(MD_NO_FUA, &mdev->flags);
                dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r);
index 264ea25..c44eaa0 100644 (file)
@@ -957,7 +957,7 @@ static void drbd_flush(struct drbd_conf *mdev)
        int rv;
 
        if (mdev->write_ordering >= WO_bdev_flush && get_ldev(mdev)) {
-               rv = blkdev_issue_flush(mdev->ldev->backing_bdev, GFP_KERNEL,
+               rv = blkdev_issue_flush(mdev->ldev->backing_bdev, GFP_NOIO,
                                        NULL);
                if (rv) {
                        dev_info(DEV, "local disk flush failed with status %d\n", rv);
@@ -2907,7 +2907,7 @@ static int receive_SyncParam(struct drbd_conf *mdev, enum drbd_packets cmd, unsi
 
                        fifo_size = (mdev->sync_conf.c_plan_ahead * 10 * SLEEP_TIME) / HZ;
                        if (fifo_size != mdev->rs_plan_s.size && fifo_size > 0) {
-                               rs_plan_s   = kzalloc(sizeof(int) * fifo_size, GFP_KERNEL);
+                               rs_plan_s   = kzalloc(sizeof(int) * fifo_size, GFP_NOIO);
                                if (!rs_plan_s) {
                                        dev_err(DEV, "kmalloc of fifo_buffer failed");
                                        goto disconnect;