Patchwork [06/29] block: Don't let locked flag prevent medium load

login
register
mail settings
Submitter Kevin Wolf
Date Aug. 3, 2011, 2:14 p.m.
Message ID <1312380864-15605-7-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/108236/
State New
Headers show

Comments

Kevin Wolf - Aug. 3, 2011, 2:14 p.m.
From: Markus Armbruster <armbru@redhat.com>

Commit aea2a33c made bdrv_eject() obey the locked flag.  Correct for
medium eject (eject_flag set), incorrect for medium load (eject_flag
clear).  See MMC-5 Table 341 "Actions for Lock/Unlock/Eject".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/block.c b/block.c
index 7c25fe4..8859f9b 100644
--- a/block.c
+++ b/block.c
@@ -2771,7 +2771,7 @@  int bdrv_eject(BlockDriverState *bs, int eject_flag)
 {
     BlockDriver *drv = bs->drv;
 
-    if (bs->locked) {
+    if (eject_flag && bs->locked) {
         return -EBUSY;
     }