From: James Simmons Date: Wed, 25 Mar 2020 15:13:18 +0000 (-0400) Subject: LU-12477 kernel: remove dev_read_only handling X-Git-Tag: 2.13.54~198 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=20553c985a518ebc1d5da2a1ddf44c4eec3db044;p=fs%2Flustre-release.git LU-12477 kernel: remove dev_read_only handling To test disk failures Lustre developed a method for ldiskfs to make the backend block device appears to have failed. Modern kernels offer the same thing with dm-flakey. Lustre has moved to dm-flakey for some time so the old dev_read_only can now be removed. Change-Id: I3d5887ab8c0daf1c94c9069bcdd58786b2819ac0 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/38070 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev --- diff --git a/lustre/kernel_patches/patches/dev_read_only-3.7.patch b/lustre/kernel_patches/patches/dev_read_only-3.7.patch deleted file mode 100644 index 150093e..0000000 --- a/lustre/kernel_patches/patches/dev_read_only-3.7.patch +++ /dev/null @@ -1,174 +0,0 @@ -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); diff --git a/lustre/kernel_patches/patches/dev_read_only-3.8.patch b/lustre/kernel_patches/patches/dev_read_only-3.8.patch deleted file mode 100644 index b5683f2..0000000 --- a/lustre/kernel_patches/patches/dev_read_only-3.8.patch +++ /dev/null @@ -1,174 +0,0 @@ -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); diff --git a/lustre/kernel_patches/patches/dev_read_only-3.9.patch b/lustre/kernel_patches/patches/dev_read_only-3.9.patch deleted file mode 100644 index 9e88df6..0000000 --- a/lustre/kernel_patches/patches/dev_read_only-3.9.patch +++ /dev/null @@ -1,174 +0,0 @@ -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); diff --git a/lustre/kernel_patches/series/3.10-rhel7.5.series b/lustre/kernel_patches/series/3.10-rhel7.5.series deleted file mode 100644 index 880e819..0000000 --- a/lustre/kernel_patches/series/3.10-rhel7.5.series +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/lustre/kernel_patches/series/3.10-rhel7.6.series b/lustre/kernel_patches/series/3.10-rhel7.6.series index 92b320b..9109c9b 100644 --- a/lustre/kernel_patches/series/3.10-rhel7.6.series +++ b/lustre/kernel_patches/series/3.10-rhel7.6.series @@ -1,5 +1,4 @@ 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 diff --git a/lustre/kernel_patches/series/3.10-rhel7.7.series b/lustre/kernel_patches/series/3.10-rhel7.7.series index 92b320b..9109c9b 100644 --- a/lustre/kernel_patches/series/3.10-rhel7.7.series +++ b/lustre/kernel_patches/series/3.10-rhel7.7.series @@ -1,5 +1,4 @@ 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 diff --git a/lustre/kernel_patches/series/3.12-sles12.series b/lustre/kernel_patches/series/3.12-sles12.series index f6a5ddc..3f349dd 100644 --- a/lustre/kernel_patches/series/3.12-sles12.series +++ b/lustre/kernel_patches/series/3.12-sles12.series @@ -1,4 +1,3 @@ raid5-mmp-unplug-dev-sles12.patch -dev_read_only-3.7.patch blkdev_tunables-3.7.patch bh_lru_size_increase.patch diff --git a/lustre/kernel_patches/series/3.x-fc18.series b/lustre/kernel_patches/series/3.x-fc18.series deleted file mode 100644 index b19b544..0000000 --- a/lustre/kernel_patches/series/3.x-fc18.series +++ /dev/null @@ -1,4 +0,0 @@ -raid5-mmp-unplug-dev-3.7.patch -dev_read_only-3.7.patch -blkdev_tunables-3.7.patch -bh_lru_size_increase.patch diff --git a/lustre/kernel_patches/series/4.4-sles12.series b/lustre/kernel_patches/series/4.4-sles12.series index fae3175..ac055f7 100644 --- a/lustre/kernel_patches/series/4.4-sles12.series +++ b/lustre/kernel_patches/series/4.4-sles12.series @@ -1,3 +1,2 @@ raid5-mmp-unplug-dev-sles12sp2.patch -dev_read_only-3.8.patch blkdev_tunables-3.8-sles12.patch diff --git a/lustre/kernel_patches/series/4.4-sles12sp3.series b/lustre/kernel_patches/series/4.4-sles12sp3.series index 04d11e7..c15eaed 100644 --- a/lustre/kernel_patches/series/4.4-sles12sp3.series +++ b/lustre/kernel_patches/series/4.4-sles12sp3.series @@ -1,2 +1 @@ raid5-mmp-unplug-dev-sles12sp3.patch -dev_read_only-3.9.patch diff --git a/lustre/kernel_patches/series/4.4-ubuntu14+16.series b/lustre/kernel_patches/series/4.4-ubuntu14+16.series deleted file mode 100644 index 87b5590..0000000 --- a/lustre/kernel_patches/series/4.4-ubuntu14+16.series +++ /dev/null @@ -1 +0,0 @@ -dev_read_only-3.8.patch diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 4c3bfd6..e0c1337 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2424,10 +2424,6 @@ static int osd_commit_async(const struct lu_env *env, 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) @@ -2448,35 +2444,8 @@ static int osd_ro(const struct lu_env *env, struct dt_device *d) 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); } @@ -7676,23 +7645,10 @@ static int osd_mount(const struct lu_env *env, } 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)) { @@ -8212,9 +8168,6 @@ static int __init osd_init(void) #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,