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.32-rhel6.patch
index 71e6359..54b51cb 100644 (file)
@@ -1,3 +1,8 @@
+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
@@ -14,9 +19,6 @@ 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.
 
-Initial efforts to remove this patch are under way in bug 20776.
-Once this work comes to fruition this patch can be dropped.
-
 Index: linux-2.6.32-131.0.15.el6.x86_64/block/blk-core.c
 ===================================================================
 --- linux-2.6.32-131.0.15.el6.x86_64.orig/block/blk-core.c     2011-05-10 21:38:33.000000000 +0300
@@ -30,31 +32,20 @@ Index: linux-2.6.32-131.0.15.el6.x86_64/block/blk-core.c
  /*
   * Check whether this bio extends beyond the end of the device.
   */
-@@ -1517,6 +1519,23 @@ static inline void __generic_make_reques
+@@ -1517,6 +1519,12 @@ static inline void __generic_make_reques
                if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
                        goto end_io;
  
-+               /* this is cfs's dev_rdonly check */
-+               if (bio_rw(bio) == 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);
-+                       bio_endio(bio, 0);
-+                       clear_bit(BIO_RDONLY, &bio->bi_flags);
-+                       break;
-+               }
++              /* this is cfs's dev_rdonly check */
++              if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
++                      err = 0;
++                      goto end_io;
++              }
 +
                if (should_fail_request(bio))
                        goto end_io;
  
-@@ -2628,6 +2647,99 @@ int kblockd_schedule_work(struct request
+@@ -2619,6 +2638,99 @@ int kblockd_schedule_work(struct request
  }
  EXPORT_SYMBOL(kblockd_schedule_work);
  
@@ -166,18 +157,6 @@ Index: linux-2.6.32-131.0.15.el6.x86_64/fs/block_dev.c
        }
        unlock_kernel();
        mutex_unlock(&bdev->bd_mutex);
-Index: linux-2.6.32-131.0.15.el6.x86_64/include/linux/blk_types.h
-===================================================================
---- linux-2.6.32-131.0.15.el6.x86_64.orig/include/linux/blk_types.h    2011-05-10 21:37:58.000000000 +0300
-+++ linux-2.6.32-131.0.15.el6.x86_64/include/linux/blk_types.h 2011-05-19 21:03:42.000000000 +0300
-@@ -24,6 +24,7 @@
- #define BIO_NULL_MAPPED 9     /* contains invalid user pages */
- #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)))
- /*
 Index: linux-2.6.32-131.0.15.el6.x86_64/include/linux/fs.h
 ===================================================================
 --- linux-2.6.32-131.0.15.el6.x86_64.orig/include/linux/fs.h   2011-05-10 21:38:29.000000000 +0300