[Devel,RHEL7,COMMIT] ploop: keep frozen block device pointer instead of super_block pointer

Submitted by Konstantin Khorenko on Aug. 20, 2016, 9:36 a.m.

Details

Message ID 201608200936.u7K9aOEA000757@finist_cl7.x64_64.work.ct
State New
Series "ploop: add support for dm-crypted ploops"
Headers show

Commit Message

Konstantin Khorenko Aug. 20, 2016, 9:36 a.m.
The commit is pushed to "branch-rh7-3.10.0-327.28.2.vz7.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.28.2.vz7.17.2
------>
commit 6c62c6b86c51d90dabb27f3dd21710415f9f8306
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Sat Aug 20 13:36:23 2016 +0400

    ploop: keep frozen block device pointer instead of super_block pointer
    
    For encrypted ploop we will need to know what block_device was frozen
    in ploop_freeze(), so we could thaw() it. We don't need to store super_block,
    because we sould be able to get it from frozen block device.
    
    https://jira.sw.ru/browse/PSBM-50858
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Acked-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 drivers/block/ploop/dev.c   | 13 +++++++------
 include/linux/ploop/ploop.h |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 453d36e..8ed402f 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4918,7 +4918,7 @@  static int ploop_push_backup_stop(struct ploop_device *plo, unsigned long arg)
 
 static int ploop_freeze(struct ploop_device *plo, struct block_device *bdev)
 {
-	struct super_block *sb = plo->sb;
+	struct super_block *sb;
 
 	if (!test_bit(PLOOP_S_RUNNING, &plo->state))
 		return -EINVAL;
@@ -4933,14 +4933,15 @@  static int ploop_freeze(struct ploop_device *plo, struct block_device *bdev)
 	if (sb && IS_ERR(sb))
 		return PTR_ERR(sb);
 
-	plo->sb = sb;
+	plo->frozen_bdev = bdev;
 	plo->freeze_state = PLOOP_F_FROZEN;
 	return 0;
 }
 
-static int ploop_thaw(struct ploop_device *plo, struct block_device *bdev)
+static int ploop_thaw(struct ploop_device *plo)
 {
-	struct super_block *sb = plo->sb;
+	struct block_device *bdev = plo->frozen_bdev;
+	struct super_block *sb = bdev->bd_super;
 	int err;
 
 	if (!test_bit(PLOOP_S_RUNNING, &plo->state))
@@ -4952,7 +4953,7 @@  static int ploop_thaw(struct ploop_device *plo, struct block_device *bdev)
 	if (plo->freeze_state == PLOOP_F_THAWING)
 		return -EBUSY;
 
-	plo->sb = NULL;
+	plo->frozen_bdev = NULL;
 	plo->freeze_state = PLOOP_F_THAWING;
 
 	mutex_unlock(&plo->ctl_mutex);
@@ -5086,7 +5087,7 @@  static int ploop_ioctl(struct block_device *bdev, fmode_t fmode, unsigned int cm
 		err = ploop_freeze(plo, bdev);
 		break;
 	case PLOOP_IOC_THAW:
-		err = ploop_thaw(plo, bdev);
+		err = ploop_thaw(plo);
 		break;
 	default:
 		err = -EINVAL;
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index b2ef6bd..8262a50 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -419,7 +419,7 @@  struct ploop_device
 	struct block_device	*bdev;
 	struct request_queue	*queue;
 	struct task_struct	*thread;
-	struct super_block	*sb;
+	struct block_device	*frozen_bdev;
 	int			freeze_state;
 	struct rb_node		link;