-Index: linux-2.6.16.i686/fs/block_dev.c
-===================================================================
---- linux-2.6.16.i686.orig/fs/block_dev.c 2006-03-20 13:53:29.000000000 +0800
-+++ linux-2.6.16.i686/fs/block_dev.c 2006-05-30 21:15:22.000000000 +0800
-@@ -747,6 +747,7 @@
- }
- unlock_kernel();
- up(&bdev->bd_sem);
-+ dev_clear_rdonly(bdev);
- bdput(bdev);
- return ret;
- }
Index: linux-2.6.16.i686/block/ll_rw_blk.c
===================================================================
---- linux-2.6.16.i686.orig/block/ll_rw_blk.c 2006-05-30 15:47:03.000000000 +0800
-+++ linux-2.6.16.i686/block/ll_rw_blk.c 2006-05-30 21:18:49.000000000 +0800
-@@ -2940,6 +2940,8 @@
+--- 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);
}
/**
* 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 @@
+@@ -3075,6 +3077,12 @@ end_io:
if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
goto end_io;
/*
* If this device has partitions, remap block n
-@@ -3593,6 +3601,91 @@
+@@ -3697,6 +3705,91 @@ void swap_io_context(struct io_context *
*ioc2 = temp;
}
EXPORT_SYMBOL(swap_io_context);
/*
* sysfs parts below
+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 2006-05-30 21:12:27.000000000 +0800
-+++ linux-2.6.16.i686/include/linux/fs.h 2006-05-30 21:15:22.000000000 +0800
-@@ -1558,6 +1558,10 @@
- struct bio;
- extern void submit_bio(int, struct bio *);
- extern int bdev_read_only(struct block_device *);
+--- linux-2.6.16.i686.orig/include/linux/blkdev.h
++++ linux-2.6.16.i686/include/linux/blkdev.h
+@@ -1595,6 +1595,11 @@ extern void file_kill(struct file *f);
+ } \
+ )
+ #endif
++
+#define HAVE_CLEAR_RDONLY_ON_PUT
+void dev_set_rdonly(struct block_device *bdev);
+int dev_check_rdonly(struct block_device *bdev);
+void dev_clear_rdonly(struct block_device *bdev);
- extern int set_blocksize(struct block_device *, int);
- extern int sb_set_blocksize(struct super_block *, int);
- extern int sb_min_blocksize(struct super_block *, int);
+
+ #define MODULE_ALIAS_BLOCKDEV(major,minor) \
+ MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))