Whamcloud - gitweb
b=22456 Remove files for unsupported kernels
[fs/lustre-release.git] / lustre / kernel_patches / patches / dev_read_only-2.6-fc5.patch
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
deleted file mode 100644 (file)
index 19cfce6..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-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);
- }
-+int dev_check_rdonly(struct block_device *bdev);
-+
- /**
-  * 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.
-@@ -3075,6 +3077,23 @@ end_io:
-               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, bio->bi_size, 0);
-+                       clear_bit(BIO_RDONLY, &bio->bi_flags);
-+                       break;
-+               }
-+
-               /*
-                * If this device has partitions, remap block n
-@@ -3697,6 +3716,91 @@ void swap_io_context(struct io_context *
-       *ioc2 = temp;
- }
- EXPORT_SYMBOL(swap_io_context);
-+ /*
-+ * Debug code for turning block devices "read-only" (will discard writes
-+ * silently).  This is for filesystem crash/recovery testing.
-+ */
-+struct deventry {
-+      dev_t dev;
-+      struct deventry *next;
-+};
-+
-+static struct deventry *devlist = NULL;
-+static spinlock_t devlock = SPIN_LOCK_UNLOCKED; 
-+
-+int dev_check_rdonly(struct block_device *bdev) 
-+{
-+      struct deventry *cur;
-+      if (!bdev) return 0;
-+      spin_lock(&devlock);
-+      cur = devlist;
-+      while(cur) {
-+              if (bdev->bd_dev == cur->dev) {
-+                      spin_unlock(&devlock);
-+                      return 1;
-+      }
-+              cur = cur->next;
-+      }
-+      spin_unlock(&devlock);
-+      return 0;
-+}
-+
-+void dev_set_rdonly(struct block_device *bdev)
-+{
-+      struct deventry *newdev, *cur;
-+
-+      if (!bdev) 
-+              return;
-+      newdev = kmalloc(sizeof(struct deventry), GFP_KERNEL);
-+      if (!newdev) 
-+              return;
-+      
-+      spin_lock(&devlock);
-+      cur = devlist;
-+      while(cur) {
-+              if (bdev->bd_dev == cur->dev) {
-+                      spin_unlock(&devlock);
-+                      kfree(newdev);
-+                      return;
-+              }
-+              cur = cur->next;
-+      }
-+      newdev->dev = bdev->bd_dev;
-+      newdev->next = devlist;
-+      devlist = newdev;
-+      spin_unlock(&devlock);
-+      printk(KERN_WARNING "Turning device %s (%#x) read-only\n",
-+             bdev->bd_disk ? bdev->bd_disk->disk_name : "", bdev->bd_dev);
-+}
-+
-+void dev_clear_rdonly(struct block_device *bdev) 
-+{
-+      struct deventry *cur, *last = NULL;
-+      if (!bdev) return;
-+      spin_lock(&devlock);
-+      cur = devlist;
-+      while(cur) {
-+              if (bdev->bd_dev == cur->dev) {
-+                      if (last) 
-+                              last->next = cur->next;
-+                      else
-+                              devlist = cur->next;
-+                      spin_unlock(&devlock);
-+                      kfree(cur);
-+                      printk(KERN_WARNING "Removing read-only on %s (%#x)\n",
-+                             bdev->bd_disk ? bdev->bd_disk->disk_name :
-+                                             "unknown block", bdev->bd_dev);
-+                      return;
-+              }
-+              last = cur;
-+              cur = cur->next;
-+      }
-+      spin_unlock(&devlock);
-+}
-+
-+EXPORT_SYMBOL(dev_set_rdonly);
-+EXPORT_SYMBOL(dev_clear_rdonly);
-+EXPORT_SYMBOL(dev_check_rdonly);
- /*
-  * 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/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);
- #define MODULE_ALIAS_BLOCKDEV(major,minor) \
-       MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
-Index: linux-2.6.16.i686/include/linux/bio.h
-===================================================================
---- linux-2.6.16.i686.orig/include/linux/bio.h
-+++ linux-2.6.16.i686/include/linux/bio.h
-@@ -124,6 +124,7 @@ struct bio {
- #define BIO_BOUNCED   5       /* bio is a bounce bio */
- #define BIO_USER_MAPPED 6     /* contains user pages */
- #define BIO_EOPNOTSUPP        7       /* not supported */
-+#define BIO_RDONLY    31      /* device is readonly */
- #define bio_flagged(bio, flag)        ((bio)->bi_flags & (1 << (flag)))
- /*