drbd: bm_page_async_io: properly initialize page->private
authorLars Ellenberg <lars.ellenberg@linbit.com>
Mon, 7 May 2012 11:04:03 +0000 (13:04 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:58:28 +0000 (16:58 +0100)
If bm_page_async_io is advised to use a new page for I/O
(BM_AIO_COPY_PAGES is set), it will get it from a mempool.
Once the mempool has to dip into its reserves the page is
not reinitialized, i.e. page->private contains garbage, which
will lead to various problems once the I/O completes (dereferences
of NULL pointers, the submitting thread getting stuck in D-state,
 ...).

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_bitmap.c

index ddd2977..65c55ec 100644 (file)
@@ -200,7 +200,7 @@ void drbd_bm_unlock(struct drbd_conf *mdev)
 static void bm_store_page_idx(struct page *page, unsigned long idx)
 {
        BUG_ON(0 != (idx & ~BM_PAGE_IDX_MASK));
-       page_private(page) |= idx;
+       set_page_private(page, idx);
 }
 
 static unsigned long bm_page_to_idx(struct page *page)