[Devel] [PATCH RH8 7/7] ploop: Add ignore_signature_disk_in_use parameter

Kirill Tkhai ktkhai at virtuozzo.com
Tue May 4 16:05:34 MSK 2021


Normally, userspace sets this parameter. But during development
it's usable to mount ploop directly (say, via bash script).
Introduce this parameter to ignore that signature is not set.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-bat.c    |    2 +-
 drivers/md/dm-ploop-target.c |    5 +++++
 drivers/md/dm-ploop.h        |    1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index ee7150f5ae80..8226411c2dc8 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -255,7 +255,7 @@ int ploop_read_metadata(struct dm_target *ti, struct ploop *ploop)
 
 	ret = -ENOLCK;
 	if (m_hdr->m_DiskInUse != cpu_to_le32(SIGNATURE_DISK_IN_USE) &&
-	    !ploop_is_ro(ploop))
+	    !ploop_is_ro(ploop) && !ignore_signature_disk_in_use)
 		goto out;
 
 	ret = -EINVAL;
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 5581e2722e0b..37e581f2997f 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -13,6 +13,11 @@
 
 #define DM_MSG_PREFIX "ploop"
 
+bool ignore_signature_disk_in_use = false; /* For development purposes */
+module_param(ignore_signature_disk_in_use, bool, 0444);
+MODULE_PARM_DESC(ignore_signature_disk_in_use,
+                "Does not check for SIGNATURE_DISK_IN_USE");
+
 struct kmem_cache *piocb_cache;
 struct kmem_cache *cow_cache;
 
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 1741a2075fb2..54baa1aa0229 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -274,6 +274,7 @@ struct ploop_cow {
 	void *data; /* Second argument of end_fn */
 };
 
+extern bool ignore_signature_disk_in_use;
 extern struct kmem_cache *piocb_cache;
 extern struct kmem_cache *cow_cache;
 




More information about the Devel mailing list