From 292a338c21ee1c439184e4334a1e71ac7eee80c7 Mon Sep 17 00:00:00 2001 From: girish Date: Thu, 18 Dec 2008 05:09:34 +0000 Subject: [PATCH] Clear dev_rdonly flag for external journal devices (Andreas) b=18018 i=johann i=girish --- .../patches/dev_read_only-2.6-fc5.patch | 45 ++++++++++++---------- .../patches/dev_read_only-2.6-lnxi.patch | 39 ++++++++++--------- .../patches/dev_read_only-2.6-suse.patch | 24 ++++++------ .../patches/dev_read_only-2.6.18-vanilla.patch | 45 ++++++++++++---------- .../patches/dev_read_only-2.6.22-vanilla.patch | 36 ++++++++--------- 5 files changed, 99 insertions(+), 90 deletions(-) diff --git a/lustre/kernel_patches/patches/dev_read_only-2.6-fc5.patch b/lustre/kernel_patches/patches/dev_read_only-2.6-fc5.patch index 5cab63e..51c7f66 100644 --- a/lustre/kernel_patches/patches/dev_read_only-2.6-fc5.patch +++ b/lustre/kernel_patches/patches/dev_read_only-2.6-fc5.patch @@ -1,7 +1,8 @@ -diff -rup linux-2.6.16.i686.orig/block/ll_rw_blk.c linux-2.6.16.i686/block/ll_rw_blk.c ---- linux-2.6.16.i686.orig/block/ll_rw_blk.c 2007-05-29 15:24:36.000000000 +0300 -+++ linux-2.6.16.i686/block/ll_rw_blk.c 2007-05-29 15:33:50.000000000 +0300 -@@ -2940,6 +2940,8 @@ static void handle_bad_sector(struct bio +Index: linux-2.6.16.i686/block/ll_rw_blk.c +=================================================================== +--- linux-2.6.16.i686.orig/block/ll_rw_blk.c ++++ linux-2.6.16.i686/block/ll_rw_blk.c +@@ -2989,6 +2989,8 @@ static void handle_bad_sector(struct bio set_bit(BIO_EOF, &bio->bi_flags); } @@ -10,7 +11,7 @@ diff -rup linux-2.6.16.i686.orig/block/ll_rw_blk.c linux-2.6.16.i686/block/ll_rw /** * generic_make_request: hand a buffer to its device driver for I/O * @bio: The bio describing the location in memory and on the device. -@@ -3020,6 +3022,12 @@ end_io: +@@ -3075,6 +3077,12 @@ end_io: if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) goto end_io; @@ -23,7 +24,7 @@ diff -rup linux-2.6.16.i686.orig/block/ll_rw_blk.c linux-2.6.16.i686/block/ll_rw /* * If this device has partitions, remap block n -@@ -3593,6 +3601,91 @@ void swap_io_context(struct io_context * +@@ -3697,6 +3705,91 @@ void swap_io_context(struct io_context * *ioc2 = temp; } EXPORT_SYMBOL(swap_io_context); @@ -115,21 +116,23 @@ diff -rup linux-2.6.16.i686.orig/block/ll_rw_blk.c linux-2.6.16.i686/block/ll_rw /* * sysfs parts below -diff -rup linux-2.6.16.i686.orig/fs/block_dev.c linux-2.6.16.i686/fs/block_dev.c ---- linux-2.6.16.i686.orig/fs/block_dev.c 2006-03-20 07:53:29.000000000 +0200 -+++ linux-2.6.16.i686/fs/block_dev.c 2007-05-29 15:35:00.000000000 +0300 -@@ -60,6 +60,7 @@ static void kill_bdev(struct block_devic - { - invalidate_bdev(bdev, 1); - truncate_inode_pages(bdev->bd_inode->i_mapping, 0); -+ dev_clear_rdonly(bdev); - } - - int set_blocksize(struct block_device *bdev, int size) -diff -rup linux-2.6.16.i686.orig/include/linux/fs.h linux-2.6.16.i686/include/linux/fs.h ---- linux-2.6.16.i686.orig/include/linux/fs.h 2007-05-29 15:24:38.000000000 +0300 -+++ linux-2.6.16.i686/include/linux/fs.h 2007-05-29 15:33:50.000000000 +0300 -@@ -1541,6 +1541,10 @@ extern void file_kill(struct file *f); +Index: linux-2.6.16.i686/fs/block_dev.c +=================================================================== +--- linux-2.6.16.i686.orig/fs/block_dev.c ++++ linux-2.6.16.i686/fs/block_dev.c +@@ -763,6 +763,7 @@ int blkdev_put(struct block_device *bdev + blkdev_put(bdev->bd_contains); + } + bdev->bd_contains = NULL; ++ dev_clear_rdonly(bdev); + } + unlock_kernel(); + up(&bdev->bd_sem); +Index: linux-2.6.16.i686/include/linux/fs.h +=================================================================== +--- linux-2.6.16.i686.orig/include/linux/fs.h ++++ linux-2.6.16.i686/include/linux/fs.h +@@ -1595,6 +1595,10 @@ extern void file_kill(struct file *f); struct bio; extern void submit_bio(int, struct bio *); extern int bdev_read_only(struct block_device *); diff --git a/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch b/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch index c6b38ab..097e604 100644 --- a/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch +++ b/lustre/kernel_patches/patches/dev_read_only-2.6-lnxi.patch @@ -1,7 +1,8 @@ -diff -ur linux-2.6.5-lnxi.orig/drivers/block/ll_rw_blk.c linux-2.6.5-lnxi/drivers/block/ll_rw_blk.c ---- linux-2.6.5-lnxi.orig/drivers/block/ll_rw_blk.c 2004-11-11 07:28:51.000000000 -0800 -+++ linux-2.6.5-lnxi/drivers/block/ll_rw_blk.c 2005-04-11 09:42:22.750936924 -0700 -@@ -2458,7 +2458,7 @@ static inline void blk_partition_remap(s +Index: linux-2.6.5-lnxi/drivers/block/ll_rw_blk.c +=================================================================== +--- linux-2.6.5-lnxi.orig/drivers/block/ll_rw_blk.c ++++ linux-2.6.5-lnxi/drivers/block/ll_rw_blk.c +@@ -2718,7 +2718,7 @@ static inline void blk_partition_remap(s } } @@ -10,7 +11,7 @@ diff -ur linux-2.6.5-lnxi.orig/drivers/block/ll_rw_blk.c linux-2.6.5-lnxi/driver /** * generic_make_request: hand a buffer to its device driver for I/O -@@ -2550,7 +2550,7 @@ end_io: +@@ -2810,7 +2810,7 @@ end_io: /* this is cfs's dev_rdonly check */ if (bio->bi_rw == WRITE && @@ -19,7 +20,7 @@ diff -ur linux-2.6.5-lnxi.orig/drivers/block/ll_rw_blk.c linux-2.6.5-lnxi/driver bio_endio(bio, bio->bi_size, 0); break; } -@@ -3086,53 +3086,86 @@ void swap_io_context(struct io_context * +@@ -3395,53 +3395,86 @@ void swap_io_context(struct io_context * *ioc2 = temp; } @@ -140,21 +141,23 @@ diff -ur linux-2.6.5-lnxi.orig/drivers/block/ll_rw_blk.c linux-2.6.5-lnxi/driver } EXPORT_SYMBOL(dev_set_rdonly); -diff -ur linux-2.6.5-lnxi.orig/fs/block_dev.c linux-2.6.5-lnxi/fs/block_dev.c ---- linux-2.6.5-lnxi.orig/fs/block_dev.c 2004-11-11 07:28:30.000000000 -0800 -+++ linux-2.6.5-lnxi/fs/block_dev.c 2005-04-11 09:49:01.891407856 -0700 -@@ -739,6 +739,7 @@ int blkdev_put(struct block_device *bdev +Index: linux-2.6.5-lnxi/fs/block_dev.c +=================================================================== +--- linux-2.6.5-lnxi.orig/fs/block_dev.c ++++ linux-2.6.5-lnxi/fs/block_dev.c +@@ -767,6 +767,7 @@ int blkdev_put(struct block_device *bdev + blkdev_put(bdev->bd_contains); + } + bdev->bd_contains = NULL; ++ dev_clear_rdonly(bdev); } unlock_kernel(); up(&bdev->bd_sem); -+ dev_clear_rdonly(bdev); - bdput(bdev); - return ret; - } -diff -ur linux-2.6.5-lnxi.orig/include/linux/fs.h linux-2.6.5-lnxi/include/linux/fs.h ---- linux-2.6.5-lnxi.orig/include/linux/fs.h 2004-11-11 07:28:45.000000000 -0800 -+++ linux-2.6.5-lnxi/include/linux/fs.h 2005-04-11 09:43:27.423116140 -0700 -@@ -1385,6 +1385,10 @@ extern void file_kill(struct file *f); +Index: linux-2.6.5-lnxi/include/linux/fs.h +=================================================================== +--- linux-2.6.5-lnxi.orig/include/linux/fs.h ++++ linux-2.6.5-lnxi/include/linux/fs.h +@@ -1424,6 +1424,10 @@ extern void file_kill(struct file *f); struct bio; extern int submit_bio(int, struct bio *); extern int bdev_read_only(struct block_device *); diff --git a/lustre/kernel_patches/patches/dev_read_only-2.6-suse.patch b/lustre/kernel_patches/patches/dev_read_only-2.6-suse.patch index e486944..a93ffa5 100644 --- a/lustre/kernel_patches/patches/dev_read_only-2.6-suse.patch +++ b/lustre/kernel_patches/patches/dev_read_only-2.6-suse.patch @@ -2,7 +2,7 @@ Index: linux-2.6.9/drivers/block/ll_rw_blk.c =================================================================== --- linux-2.6.9.orig/drivers/block/ll_rw_blk.c +++ linux-2.6.9/drivers/block/ll_rw_blk.c -@@ -2326,6 +2326,8 @@ static inline int attempt_front_merge(re +@@ -2331,6 +2331,8 @@ static inline int attempt_front_merge(re return 0; } @@ -11,7 +11,7 @@ Index: linux-2.6.9/drivers/block/ll_rw_blk.c /** * blk_attempt_remerge - attempt to remerge active head with next request * @q: The &request_queue_t belonging to the device -@@ -2631,6 +2633,13 @@ end_io: +@@ -2636,6 +2638,13 @@ end_io: if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) goto end_io; @@ -25,7 +25,7 @@ Index: linux-2.6.9/drivers/block/ll_rw_blk.c /* * If this device has partitions, remap block n * of partition p to block n+start(p) of the disk. -@@ -3180,6 +3189,92 @@ void swap_io_context(struct io_context * +@@ -3185,6 +3194,92 @@ void swap_io_context(struct io_context * /* @@ -122,19 +122,19 @@ Index: linux-2.6.9/fs/block_dev.c =================================================================== --- linux-2.6.9.orig/fs/block_dev.c +++ linux-2.6.9/fs/block_dev.c -@@ -60,6 +60,7 @@ static void kill_bdev(struct block_devic - { - invalidate_bdev(bdev, 1); - truncate_inode_pages(bdev->bd_inode->i_mapping, 0); -+ dev_clear_rdonly(bdev); - } - - int set_blocksize(struct block_device *bdev, int size) +@@ -744,6 +744,7 @@ int blkdev_put(struct block_device *bdev + blkdev_put(bdev->bd_contains); + } + bdev->bd_contains = NULL; ++ dev_clear_rdonly(bdev); + } + unlock_kernel(); + up(&bdev->bd_sem); Index: linux-2.6.9/include/linux/fs.h =================================================================== --- linux-2.6.9.orig/include/linux/fs.h +++ linux-2.6.9/include/linux/fs.h -@@ -1492,6 +1492,10 @@ extern void file_kill(struct file *f); +@@ -1479,6 +1479,10 @@ extern void file_kill(struct file *f); struct bio; extern void submit_bio(int, struct bio *); extern int bdev_read_only(struct block_device *); diff --git a/lustre/kernel_patches/patches/dev_read_only-2.6.18-vanilla.patch b/lustre/kernel_patches/patches/dev_read_only-2.6.18-vanilla.patch index ff6cf91..b4704a5 100644 --- a/lustre/kernel_patches/patches/dev_read_only-2.6.18-vanilla.patch +++ b/lustre/kernel_patches/patches/dev_read_only-2.6.18-vanilla.patch @@ -1,7 +1,8 @@ -diff -urp linux-2.6.18.1.orig/block/ll_rw_blk.c linux-2.6.18.1/block/ll_rw_blk.c ---- linux-2.6.18.1.orig/block/ll_rw_blk.c 2006-10-14 06:34:03.000000000 +0300 -+++ linux-2.6.18.1/block/ll_rw_blk.c 2007-05-29 14:50:46.000000000 +0300 -@@ -2993,6 +2993,8 @@ static void handle_bad_sector(struct bio +Index: linux-2.6.18.1/block/ll_rw_blk.c +=================================================================== +--- linux-2.6.18.1.orig/block/ll_rw_blk.c ++++ linux-2.6.18.1/block/ll_rw_blk.c +@@ -3067,6 +3067,8 @@ static void handle_bad_sector(struct bio set_bit(BIO_EOF, &bio->bi_flags); } @@ -10,7 +11,7 @@ diff -urp linux-2.6.18.1.orig/block/ll_rw_blk.c linux-2.6.18.1/block/ll_rw_blk.c /** * generic_make_request: hand a buffer to its device driver for I/O * @bio: The bio describing the location in memory and on the device. -@@ -3076,6 +3078,12 @@ end_io: +@@ -3151,6 +3153,12 @@ end_io: if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) goto end_io; @@ -23,7 +24,7 @@ diff -urp linux-2.6.18.1.orig/block/ll_rw_blk.c linux-2.6.18.1/block/ll_rw_blk.c /* * If this device has partitions, remap block n -@@ -3675,6 +3683,91 @@ void swap_io_context(struct io_context * +@@ -3765,6 +3773,91 @@ void swap_io_context(struct io_context * *ioc2 = temp; } EXPORT_SYMBOL(swap_io_context); @@ -115,21 +116,23 @@ diff -urp linux-2.6.18.1.orig/block/ll_rw_blk.c linux-2.6.18.1/block/ll_rw_blk.c /* * sysfs parts below -diff -urp linux-2.6.18.1.orig/fs/block_dev.c linux-2.6.18.1/fs/block_dev.c ---- linux-2.6.18.1.orig/fs/block_dev.c 2006-10-14 06:34:03.000000000 +0300 -+++ linux-2.6.18.1/fs/block_dev.c 2007-05-29 14:53:38.000000000 +0300 -@@ -58,6 +58,7 @@ static void kill_bdev(struct block_devic - { - invalidate_bdev(bdev, 1); - truncate_inode_pages(bdev->bd_inode->i_mapping, 0); -+ dev_clear_rdonly(bdev); - } - - int set_blocksize(struct block_device *bdev, int size) -diff -urp linux-2.6.18.1.orig/include/linux/fs.h linux-2.6.18.1/include/linux/fs.h ---- linux-2.6.18.1.orig/include/linux/fs.h 2006-10-14 06:34:03.000000000 +0300 -+++ linux-2.6.18.1/include/linux/fs.h 2007-05-29 14:50:46.000000000 +0300 -@@ -1632,6 +1632,10 @@ extern void file_kill(struct file *f); +Index: linux-2.6.18.1/fs/block_dev.c +=================================================================== +--- linux-2.6.18.1.orig/fs/block_dev.c ++++ linux-2.6.18.1/fs/block_dev.c +@@ -1059,6 +1059,7 @@ static int __blkdev_put(struct block_dev + if (bdev != bdev->bd_contains) + victim = bdev->bd_contains; + bdev->bd_contains = NULL; ++ dev_clear_rdonly(bdev); + } + unlock_kernel(); + mutex_unlock(&bdev->bd_mutex); +Index: linux-2.6.18.1/include/linux/fs.h +=================================================================== +--- linux-2.6.18.1.orig/include/linux/fs.h ++++ linux-2.6.18.1/include/linux/fs.h +@@ -1685,6 +1685,10 @@ extern void file_kill(struct file *f); struct bio; extern void submit_bio(int, struct bio *); extern int bdev_read_only(struct block_device *); diff --git a/lustre/kernel_patches/patches/dev_read_only-2.6.22-vanilla.patch b/lustre/kernel_patches/patches/dev_read_only-2.6.22-vanilla.patch index 8d144d6..8a46dc5 100644 --- a/lustre/kernel_patches/patches/dev_read_only-2.6.22-vanilla.patch +++ b/lustre/kernel_patches/patches/dev_read_only-2.6.22-vanilla.patch @@ -1,8 +1,8 @@ Index: linux-2.6.22.5/block/ll_rw_blk.c =================================================================== ---- linux-2.6.22.5.orig/block/ll_rw_blk.c 2007-08-22 17:23:54.000000000 -0600 -+++ linux-2.6.22.5/block/ll_rw_blk.c 2008-02-21 01:07:16.000000000 -0700 -@@ -3101,6 +3101,8 @@ +--- linux-2.6.22.5.orig/block/ll_rw_blk.c ++++ linux-2.6.22.5/block/ll_rw_blk.c +@@ -3101,6 +3101,8 @@ static inline int should_fail_request(st #endif /* CONFIG_FAIL_MAKE_REQUEST */ @@ -11,7 +11,7 @@ Index: linux-2.6.22.5/block/ll_rw_blk.c /** * generic_make_request: hand a buffer to its device driver for I/O * @bio: The bio describing the location in memory and on the device. -@@ -3185,6 +3187,12 @@ +@@ -3185,6 +3187,12 @@ end_io: if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) goto end_io; @@ -24,7 +24,7 @@ Index: linux-2.6.22.5/block/ll_rw_blk.c if (should_fail_request(bio)) goto end_io; -@@ -3850,6 +3858,91 @@ +@@ -3850,6 +3858,91 @@ void swap_io_context(struct io_context * *ioc2 = temp; } EXPORT_SYMBOL(swap_io_context); @@ -118,21 +118,21 @@ Index: linux-2.6.22.5/block/ll_rw_blk.c * sysfs parts below Index: linux-2.6.22.5/fs/block_dev.c =================================================================== ---- linux-2.6.22.5.orig/fs/block_dev.c 2007-08-22 17:23:54.000000000 -0600 -+++ linux-2.6.22.5/fs/block_dev.c 2008-02-21 01:07:16.000000000 -0700 -@@ -63,6 +63,7 @@ - return; - invalidate_bh_lrus(); - truncate_inode_pages(bdev->bd_inode->i_mapping, 0); -+ dev_clear_rdonly(bdev); - } - - int set_blocksize(struct block_device *bdev, int size) +--- linux-2.6.22.5.orig/fs/block_dev.c ++++ linux-2.6.22.5/fs/block_dev.c +@@ -1294,6 +1294,7 @@ static int __blkdev_put(struct block_dev + if (bdev != bdev->bd_contains) + victim = bdev->bd_contains; + bdev->bd_contains = NULL; ++ dev_clear_rdonly(bdev); + } + unlock_kernel(); + mutex_unlock(&bdev->bd_mutex); Index: linux-2.6.22.5/include/linux/fs.h =================================================================== ---- linux-2.6.22.5.orig/include/linux/fs.h 2008-02-21 00:58:18.000000000 -0700 -+++ linux-2.6.22.5/include/linux/fs.h 2008-02-21 01:07:16.000000000 -0700 -@@ -1744,6 +1744,10 @@ +--- linux-2.6.22.5.orig/include/linux/fs.h ++++ linux-2.6.22.5/include/linux/fs.h +@@ -1744,6 +1744,10 @@ struct bio; extern void submit_bio(int, struct bio *); extern int bdev_read_only(struct block_device *); #endif -- 1.8.3.1