[vbox-dev] closemedium and hot unplug gives "is locked for writing by another task"

Geoff Nordli geoffn at gnaa.net
Thu Oct 27 05:47:33 GMT 2011

Maybe I am doing this wrong or it is a bug,  but I am trying to hot unplug a 

Host OS:  OpenIndiana 151a.
Virtualbox 4.1.4r74291

I attached the disk using:

VBoxManage storageattach mail1 --storagectl "SATA Controller" --port 3 --
device 0 --type hdd --medium iscsi --server localhost --target 
iqn.1986-03.com.sun:02:869b1f8e-3a4f-c93e-faa2-99812bf1553a --lun 3

Inside the guest, I was able to mount the disk, then I unmounted the disk

Remove it from inside the guest: 

echo 1 > /sys/block/sdc/device/delete

which triggers the removal of the disk:

ct 21 13:18:21 mail1 kernel: [ 5748.141436] sd 3:0:0:0: [sdc] Synchronizing 
SCSI cache
Oct 21 13:18:21 mail1 kernel: [ 5748.142413] sd 3:0:0:0: [sdc] Stopping disk
Oct 21 13:18:21 mail1 kernel: [ 5748.143572] ata4.00: disabled

Now, i remove the disk from the VM:

VBoxManage storageattach mail1 --storagectl "SATA Controller" --port 3 --
device 0 --type hdd --medium none

It shows as not being connected to any VM:

UUID:                 8c91b41f-3b79-4820-853b-6dad69c08a33
Accessible:           yes
Logical size:         102400 MBytes
Current size on disk: 102400 MBytes
Type:                 normal (base)
Storage format:       iSCSI
Format variant:       fixed default
Location:             localhost|iqn.1986-03.com.sun:02:869b1f8e-3a4f-c93e-

Now I try to close the medium:

VBoxManage closemedium disk 8c91b41f-3b79-4820-853b-6dad69c08a33
VBoxManage: error: Medium 'localhost|iqn.1986-03.com.sun:02:869b1f8e-3a4f-
c93e-faa2-99812bf1553a|3' is locked for writing by another task
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), 
component Medium, interface IMedium, callee nsISupports
Context: "Close()" at line 1194 of file VBoxManageDisk.cpp

Am I missing something or is this a bug.



More information about the vbox-dev mailing list