Whamcloud - gitweb
LU-354 test: Change dev_set_rdonly() check to warning
[fs/lustre-release.git] / lustre / kernel_patches / patches / dev_read_only-2.6.27-vanilla.patch
index 399f04d..8e465e2 100644 (file)
@@ -1,3 +1,24 @@
+This patch is no longer needed for Lustre.  It is only included
+for testing and ease of using the same kernel with older Lustre
+versions.  This testing functionality was replaced in Linux 3.0
+by the dm-flakey driver.
+
+This functionality is mainly used during testing, in order to
+simulate a server crash for ldiskfs by discarding all of the
+writes to the filesystem.  For recovery testing we could simulate
+this by using a special loopback or DM device that also discards
+writes to the device.
+
+This functionality is also used by target "failback" in order
+to speed up service shutdown and takeover by the other node
+during controlled operation.  However, it would also be possible
+to do this by simply allowing all of the in-flight requests to
+complete and then waiting for the service to stop.  This will
+also be needed by the DMU-OSD, because discarding of writes on
+a DMU-based target is not safe as it could trigger a storage
+failure if the data is ever read from disk again and the
+checksum does not match that expected by the block pointer.
+
 Index: linux-2.6.27.21-0.1/block/blk-core.c
 ===================================================================
 --- linux-2.6.27.21-0.1.orig/block/blk-core.c  2009-04-23 02:12:51.000000000 -0600
@@ -11,31 +32,20 @@ Index: linux-2.6.27.21-0.1/block/blk-core.c
  /*
   * Check whether this bio extends beyond the end of the device.
   */
-@@ -1436,6 +1438,23 @@
+@@ -1436,6 +1438,12 @@
  
                if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
                        goto end_io;
 
 +               /* this is cfs's dev_rdonly check */
-+               if (bio->bi_rw == WRITE && dev_check_rdonly(bio->bi_bdev)) {
-+                       struct block_device *bdev = bio->bi_bdev;
-+
-+                       printk(KERN_WARNING "Write to readonly device %s (%#x) "
-+                              "bi_flags: %lx, bi_vcnt: %d, bi_idx: %d, "
-+                              "bi->size: %d, bi_cnt: %d, bi_private: %p\n",
-+                              bdev->bd_disk ? bdev->bd_disk->disk_name : "",
-+                              bdev->bd_dev, bio->bi_flags, bio->bi_vcnt,
-+                              bio->bi_idx, bio->bi_size,
-+                              atomic_read(&bio->bi_cnt), bio->bi_private);
-+                       set_bit(BIO_RDONLY, &bio->bi_flags);
++               if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
 +                       bio_endio(bio, bio->bi_size, 0);
-+                       clear_bit(BIO_RDONLY, &bio->bi_flags);
 +                       break;
 +               }
 +
                if (should_fail_request(bio))
                        goto end_io;
-@@ -2189,6 +2208,91 @@
+@@ -2189,6 +2197,91 @@
  }
  EXPORT_SYMBOL(kblockd_flush_work);
  
@@ -154,15 +164,3 @@ Index: linux-2.6.27.21-0.1/include/linux/fs.h
  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);
-Index: linux-2.6.27.21-0.1/include/linux/bio.h
-===================================================================
---- linux-2.6.27.21-0.1.orig/include/linux/bio.h 2009-05-22 08:38:00.000000000 -0600
-+++ linux-2.6.27.21-0.1/include/linux/bio.h     2009-05-22 08:38:02.000000000 -0600
-@@ -117,6 +117,7 @@
- #define BIO_CPU_AFFINE        8       /* complete bio on same CPU as submitted */
- #define BIO_FS_INTEGRITY 10   /* fs owns integrity data, not block layer */
- #define BIO_QUIET     11      /* Make BIO Quiet */
-+#define BIO_RDONLY    31      /* device is readonly */
- #define bio_flagged(bio, flag)        ((bio)->bi_flags & (1 << (flag)))
- /*