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.18-vanilla.patch
index ff6cf91..a12fb3f 100644 (file)
@@ -1,7 +1,29 @@
-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
+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.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,20 +32,20 @@ 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;
-+              /* this is cfs's dev_rdonly check */
-+              if (bio->bi_rw == WRITE &&
-+                              dev_check_rdonly(bio->bi_bdev)) {
-+                      bio_endio(bio, bio->bi_size, 0);
-+                      break;
-+              }
+
++               /* this is cfs's dev_rdonly check */
++               if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
++                       bio_endio(bio, bio->bi_size, 0);
++                       break;
++               }
++
                /*
                 * 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 +137,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 *);