Skip to contentSkip to conversation

blkfront: don't put bdev right after getting it

PATCH In review Andrew Jones 3 participants 4 messages Feb 16, 2012 – Feb 21, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blkfront: don't put bdev right after getting it

We should hang onto bdev until we're done with it.

---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 2f22874..5d45688 100644
@@ -1410,7 +1410,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
 	mutex_lock(&blkfront_mutex);
 
 	bdev = bdget_disk(disk, 0);
-	bdput(bdev);
 
 	if (bdev->bd_openers)
 		goto out;
@@ -1441,6 +1440,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
 	}
 
 out:
+	bdput(bdev);
 	mutex_unlock(&blkfront_mutex);
 	return 0;
 }
Signature · 1 line
1.7.7.5
#1 lore raw
Quoted 1 line · Andrew Jones

We should hang onto bdev until we're done with it.

Looks ok. Is there a BZ that sparked this? Thanks.

Quoted 34 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 2f22874..5d45688 100644
@@ -1410,7 +1410,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
 	mutex_lock(&blkfront_mutex);
 
 	bdev = bdget_disk(disk, 0);
-	bdput(bdev);
 
 	if (bdev->bd_openers)
 		goto out;
@@ -1441,6 +1440,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
 	}
 
 out:
+	bdput(bdev);
 	mutex_unlock(&blkfront_mutex);
 	return 0;
 }
Signature · 7 lines
1.7.7.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#2 lore raw

----- Original Message -----

Quoted 4 lines · Andrew Jones
Quoted 1 line

We should hang onto bdev until we're done with it.

Looks ok. Is there a BZ that sparked this? Thanks.

Nope. Just came across it while I was looking at the code.

Drew

Quoted 38 lines
Quoted 37 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +0 -1
index 2f22874..5d45688 100644
@@ -1410,7 +1410,6 @@ static int blkif_release(struct gendisk
 *disk, fmode_t mode)
 	mutex_lock(&blkfront_mutex);
 
 	bdev = bdget_disk(disk, 0);
-	bdput(bdev);
 
 	if (bdev->bd_openers)
drivers/block/xen-blkfront.c +1 -0
 		goto out;
@@ -1441,6 +1440,7 @@ static int blkif_release(struct gendisk
 *disk, fmode_t mode)
 	}
 
 out:
+	bdput(bdev);
 	mutex_unlock(&blkfront_mutex);
 	return 0;

}
--
1.7.7.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
In reply to Andrew Jones
Quoted 1 line · Andrew Jones

We should hang onto bdev until we're done with it.

applied in #testing

Quoted 28 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 2f22874..5d45688 100644
@@ -1410,7 +1410,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
 	mutex_lock(&blkfront_mutex);
 
 	bdev = bdget_disk(disk, 0);
-	bdput(bdev);
 
 	if (bdev->bd_openers)
 		goto out;
@@ -1441,6 +1440,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
 	}
 
 out:
+	bdput(bdev);
 	mutex_unlock(&blkfront_mutex);
 	return 0;
 }
Signature · 1 line
1.7.7.5