diff options
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 5 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 32a9ab67a5f6..057ffed6eb7e 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -2318,6 +2318,11 @@ static inline void drbd_md_flush(struct drbd_conf *mdev) | |||
2318 | { | 2318 | { |
2319 | int r; | 2319 | int r; |
2320 | 2320 | ||
2321 | if (mdev->ldev == NULL) { | ||
2322 | dev_warn(DEV, "mdev->ldev == NULL in drbd_md_flush\n"); | ||
2323 | return; | ||
2324 | } | ||
2325 | |||
2321 | if (test_bit(MD_NO_FUA, &mdev->flags)) | 2326 | if (test_bit(MD_NO_FUA, &mdev->flags)) |
2322 | return; | 2327 | return; |
2323 | 2328 | ||
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 0f73e157dee0..be4f58277124 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -3235,8 +3235,12 @@ static int w_go_diskless(struct drbd_work *w, int unused) | |||
3235 | * (Do we want a specific meta data flag for this?) | 3235 | * (Do we want a specific meta data flag for this?) |
3236 | * | 3236 | * |
3237 | * If that does not make it to stable storage either, | 3237 | * If that does not make it to stable storage either, |
3238 | * we cannot do anything about that anymore. */ | 3238 | * we cannot do anything about that anymore. |
3239 | if (mdev->bitmap) { | 3239 | * |
3240 | * We still need to check if both bitmap and ldev are present, we may | ||
3241 | * end up here after a failed attach, before ldev was even assigned. | ||
3242 | */ | ||
3243 | if (mdev->bitmap && mdev->ldev) { | ||
3240 | if (drbd_bitmap_io_from_worker(mdev, drbd_bm_write, | 3244 | if (drbd_bitmap_io_from_worker(mdev, drbd_bm_write, |
3241 | "detach", BM_LOCKED_MASK)) { | 3245 | "detach", BM_LOCKED_MASK)) { |
3242 | if (test_bit(WAS_READ_ERROR, &mdev->flags)) { | 3246 | if (test_bit(WAS_READ_ERROR, &mdev->flags)) { |