[Devel] [PATCH RHEL7 COMMIT] ploop: drop bdev refcounter on freeze_bdev() failure

Konstantin Khorenko khorenko at virtuozzo.com
Sat Aug 20 02:36:23 PDT 2016


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 5ec893951ac21ab8d10b0b19e3d6edc45dff4b3a
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Sat Aug 20 13:36:22 2016 +0400

    ploop: drop bdev refcounter on freeze_bdev() failure
    
    If freeze_bdev() called in find_and_freeze_bdev() fails we should
    drop a reference counter grabbed by bdget_disk() call.
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Acked-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 drivers/block/ploop/dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 83b0e32..453d36e 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3339,7 +3339,10 @@ static struct super_block *find_and_freeze_bdev(struct gendisk *disk,
 		bdev = NULL;
 	}
 
-	*bdev_pp = bdev;
+	if (IS_ERR(sb))
+		bdput(bdev);
+	else
+		*bdev_pp = bdev;
 	return sb;
 }
 


More information about the Devel mailing list