+++ /dev/null
-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-3.10.0-123.8.1.el7.x86_64/block/blk-core.c
-===================================================================
---- linux-3.10.0-123.8.1.el7.x86_64.orig/block/blk-core.c
-+++ linux-3.10.0-123.8.1.el7.x86_64/block/blk-core.c
-@@ -1667,6 +1667,8 @@ static inline bool should_fail_request(s
-
- #endif /* CONFIG_FAIL_MAKE_REQUEST */
-
-+int dev_check_rdonly(struct block_device *bdev);
-+
- /*
- * Check whether this bio extends beyond the end of the device.
- */
-@@ -1729,6 +1731,12 @@ generic_make_request_checks(struct bio *
- goto end_io;
- }
-
-+ /* this is cfs's dev_rdonly check */
-+ if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
-+ err = 0;
-+ goto end_io;
-+ }
-+
- part = bio->bi_bdev->bd_part;
- if (should_fail_request(part, bio->bi_size) ||
- should_fail_request(&part_to_disk(part)->part0,
-@@ -3240,6 +3248,99 @@ void blk_post_runtime_resume(struct requ
- EXPORT_SYMBOL(blk_post_runtime_resume);
- #endif
-
-+/*
-+ * 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(devlock);
-+
-+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);
-+
- int __init blk_dev_init(void)
- {
- BUILD_BUG_ON(__REQ_NR_BITS > 8 *
-Index: linux-3.10.0-123.8.1.el7.x86_64/fs/block_dev.c
-===================================================================
---- linux-3.10.0-123.8.1.el7.x86_64.orig/fs/block_dev.c
-+++ linux-3.10.0-123.8.1.el7.x86_64/fs/block_dev.c
-@@ -1441,6 +1441,7 @@ static void __blkdev_put(struct block_de
- if (bdev != bdev->bd_contains)
- victim = bdev->bd_contains;
- bdev->bd_contains = NULL;
-+ dev_clear_rdonly(bdev);
-
- put_disk(disk);
- module_put(owner);
-Index: linux-3.10.0-123.8.1.el7.x86_64/include/linux/fs.h
-===================================================================
---- linux-3.10.0-123.8.1.el7.x86_64.orig/include/linux/fs.h
-+++ linux-3.10.0-123.8.1.el7.x86_64/include/linux/fs.h
-@@ -2440,6 +2440,10 @@ extern void inode_sb_list_add(struct ino
- extern void submit_bio(int, struct bio *);
- extern int bdev_read_only(struct block_device *);
- #endif
-+#define HAVE_CLEAR_RDONLY_ON_PUT
-+extern void dev_set_rdonly(struct block_device *bdev);
-+extern int dev_check_rdonly(struct block_device *bdev);
-+extern 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);
+++ /dev/null
-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-4.4.21-64/block/blk-core.c
-===================================================================
---- linux-4.4.21-64.orig/block/blk-core.c
-+++ linux-4.4.21-64/block/blk-core.c
-@@ -1893,6 +1893,8 @@ static inline bool should_fail_request(s
-
- #endif /* CONFIG_FAIL_MAKE_REQUEST */
-
-+int dev_check_rdonly(struct block_device *bdev);
-+
- /*
- * Check whether this bio extends beyond the end of the device.
- */
-@@ -1946,6 +1948,12 @@ generic_make_request_checks(struct bio *
- goto end_io;
- }
-
-+ /* this is cfs's dev_rdonly check */
-+ if (bio_rw(bio) == WRITE && dev_check_rdonly(bio->bi_bdev)) {
-+ err = 0;
-+ goto end_io;
-+ }
-+
- part = bio->bi_bdev->bd_part;
- if (should_fail_request(part, bio->bi_iter.bi_size) ||
- should_fail_request(&part_to_disk(part)->part0,
-@@ -3553,6 +3561,99 @@ void blk_set_runtime_active(struct reque
- EXPORT_SYMBOL(blk_set_runtime_active);
- #endif
-
-+/*
-+ * 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(devlock);
-+
-+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);
-+
- int __init blk_dev_init(void)
- {
- BUILD_BUG_ON(__REQ_NR_BITS > 8 *
-Index: linux-4.4.21-64/fs/block_dev.c
-===================================================================
---- linux-4.4.21-64.orig/fs/block_dev.c
-+++ linux-4.4.21-64/fs/block_dev.c
-@@ -1562,6 +1562,7 @@ static void __blkdev_put(struct block_de
- if (bdev != bdev->bd_contains)
- victim = bdev->bd_contains;
- bdev->bd_contains = NULL;
-+ dev_clear_rdonly(bdev);
-
- put_disk(disk);
- module_put(owner);
-Index: linux-4.4.21-64/include/linux/fs.h
-===================================================================
---- linux-4.4.21-64.orig/include/linux/fs.h
-+++ linux-4.4.21-64/include/linux/fs.h
-@@ -2673,6 +2673,10 @@ extern void inode_sb_list_add(struct ino
- extern blk_qc_t submit_bio(int, struct bio *);
- extern int bdev_read_only(struct block_device *);
- #endif
-+#define HAVE_CLEAR_RDONLY_ON_PUT
-+extern void dev_set_rdonly(struct block_device *bdev);
-+extern int dev_check_rdonly(struct block_device *bdev);
-+extern 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);
+++ /dev/null
-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-4.4.59-1/block/blk-core.c
-===================================================================
---- linux-4.4.59-1.orig/block/blk-core.c
-+++ linux-4.4.59-1/block/blk-core.c
-@@ -1804,6 +1804,8 @@ static inline bool should_fail_request(s
-
- #endif /* CONFIG_FAIL_MAKE_REQUEST */
-
-+int dev_check_rdonly(struct block_device *bdev);
-+
- /*
- * Check whether this bio extends beyond the end of the device.
- */
-@@ -1857,6 +1859,12 @@ generic_make_request_checks(struct bio *
- goto end_io;
- }
-
-+ /* this is cfs's dev_rdonly check */
-+ if (bio_data_dir(bio) && dev_check_rdonly(bio->bi_bdev)) {
-+ err = 0;
-+ goto end_io;
-+ }
-+
- part = bio->bi_bdev->bd_part;
- if (should_fail_request(part, bio->bi_iter.bi_size) ||
- should_fail_request(&part_to_disk(part)->part0,
-@@ -3454,6 +3462,99 @@ void blk_set_runtime_active(struct reque
- EXPORT_SYMBOL(blk_set_runtime_active);
- #endif
-
-+/*
-+ * 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(devlock);
-+
-+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);
-+
- int __init blk_dev_init(void)
- {
- BUILD_BUG_ON(REQ_OP_LAST >= (1 << REQ_OP_BITS));
-Index: linux-4.4.59-1/fs/block_dev.c
-===================================================================
---- linux-4.4.59-1.orig/fs/block_dev.c
-+++ linux-4.4.59-1/fs/block_dev.c
-@@ -1914,6 +1914,7 @@ static void __blkdev_put(struct block_de
- if (bdev != bdev->bd_contains)
- victim = bdev->bd_contains;
- bdev->bd_contains = NULL;
-+ dev_clear_rdonly(bdev);
-
- put_disk(disk);
- module_put(owner);
-Index: linux-4.4.59-1/include/linux/fs.h
-===================================================================
---- linux-4.4.59-1.orig/include/linux/fs.h
-+++ linux-4.4.59-1/include/linux/fs.h
-@@ -2624,6 +2624,10 @@ extern void inode_sb_list_add(struct ino
- #ifdef CONFIG_BLOCK
- extern int bdev_read_only(struct block_device *);
- #endif
-+#define HAVE_CLEAR_RDONLY_ON_PUT
-+extern void dev_set_rdonly(struct block_device *bdev);
-+extern int dev_check_rdonly(struct block_device *bdev);
-+extern 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);
+++ /dev/null
-raid5-mmp-unplug-dev-3.9.patch
-dev_read_only-3.7.patch
-blkdev_tunables-3.9.patch
-vfs-project-quotas-rhel7.patch
-fix-integrity-verify-rhel7.patch
-fix-sd-dif-complete-rhel7.patch
-block-integrity-allow-optional-integrity-functions-rhel7.patch
-block-pass-bio-into-integrity_processing_fn-rhel7.patch
raid5-mmp-unplug-dev-rhel7.6.patch
-dev_read_only-3.7.patch
blkdev_tunables-3.9.patch
vfs-project-quotas-rhel7.patch
fix-integrity-verify-rhel7.patch
raid5-mmp-unplug-dev-rhel7.6.patch
-dev_read_only-3.7.patch
blkdev_tunables-3.9.patch
vfs-project-quotas-rhel7.patch
fix-integrity-verify-rhel7.patch
raid5-mmp-unplug-dev-sles12.patch
-dev_read_only-3.7.patch
blkdev_tunables-3.7.patch
bh_lru_size_increase.patch
+++ /dev/null
-raid5-mmp-unplug-dev-3.7.patch
-dev_read_only-3.7.patch
-blkdev_tunables-3.7.patch
-bh_lru_size_increase.patch
raid5-mmp-unplug-dev-sles12sp2.patch
-dev_read_only-3.8.patch
blkdev_tunables-3.8-sles12.patch
raid5-mmp-unplug-dev-sles12sp3.patch
-dev_read_only-3.9.patch
+++ /dev/null
-dev_read_only-3.8.patch
RETURN(rc);
}
-/* Our own copy of the set readonly functions if present, or NU if not. */
-static int (*priv_dev_set_rdonly)(struct block_device *bdev);
-static int (*priv_dev_check_rdonly)(struct block_device *bdev);
-/* static int (*priv_dev_clear_rdonly)(struct block_device *bdev); */
static int (*priv_security_file_alloc)(struct file *file);
int osd_security_file_alloc(struct file *file)
ENTRY;
- if (priv_dev_set_rdonly) {
- struct block_device *jdev = LDISKFS_SB(sb)->journal_bdev;
-
- rc = 0;
- CERROR("*** setting %s read-only ***\n",
- osd_dt_dev(d)->od_svname);
-
- if (sb->s_op->freeze_fs) {
- rc = sb->s_op->freeze_fs(sb);
- if (rc)
- goto out;
- }
-
- if (jdev && (jdev != dev)) {
- CDEBUG(D_IOCTL | D_HA, "set journal dev %lx rdonly\n",
- (long)jdev);
- priv_dev_set_rdonly(jdev);
- }
- CDEBUG(D_IOCTL | D_HA, "set dev %lx rdonly\n", (long)dev);
- priv_dev_set_rdonly(dev);
-
- if (sb->s_op->unfreeze_fs)
- sb->s_op->unfreeze_fs(sb);
- }
-
-out:
- if (rc)
- CERROR("%s: %lx CANNOT BE SET READONLY: rc = %d\n",
- osd_dt_dev(d)->od_svname, (long)dev, rc);
+ CERROR("%s: %lx CANNOT BE SET READONLY: rc = %d\n",
+ osd_dt_dev(d)->od_svname, (long)dev, rc);
RETURN(rc);
}
}
if (lmd_flags & LMD_FLG_DEV_RDONLY) {
- if (priv_dev_set_rdonly) {
- priv_dev_set_rdonly(osd_sb(o)->s_bdev);
- o->od_dt_dev.dd_rdonly = 1;
- LCONSOLE_WARN("%s: set dev_rdonly on this device\n",
- name);
- } else {
- LCONSOLE_WARN("%s: not support dev_rdonly on this device",
- name);
-
- GOTO(out_mnt, rc = -EOPNOTSUPP);
- }
- } else if (priv_dev_check_rdonly &&
- priv_dev_check_rdonly(osd_sb(o)->s_bdev)) {
- CERROR("%s: underlying device %s is marked as "
- "read-only. Setup failed\n", name, dev);
+ LCONSOLE_WARN("%s: not support dev_rdonly on this device",
+ name);
- GOTO(out_mnt, rc = -EROFS);
+ GOTO(out_mnt, rc = -EOPNOTSUPP);
}
if (!ldiskfs_has_feature_journal(o->od_mnt->mnt_sb)) {
#ifdef CONFIG_KALLSYMS
priv_security_file_alloc =
(void *)kallsyms_lookup_name("security_file_alloc");
- priv_dev_set_rdonly = (void *)kallsyms_lookup_name("dev_set_rdonly");
- priv_dev_check_rdonly =
- (void *)kallsyms_lookup_name("dev_check_rdonly");
#endif
rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,