qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

locking option doesn't work as expected


From: Masayoshi Mizuma
Subject: locking option doesn't work as expected
Date: Wed, 4 Nov 2020 11:35:56 -0500

Hello,

It seems that locking option doesn't work as expected.
When I run qemu as following options, then I got an error and failed to
boot the guest:

  qemu-system-x86_64 \
    -machine pc \
    -enable-kvm \
    -cpu host \
    -smp 1 -m 4G \
    -nographic \
    -serial telnet::1235,server,nowait \
    -blockdev 
driver=qcow2,node-name=disk,file.driver=file,file.filename=/mnt/guest.qcow2,file.locking=auto
 \
    -device virtio-blk-pci,scsi=off,drive=disk,id=virtio-disk0,bootindex=1

  qemu-system-x86_64: -blockdev 
driver=qcow2,node-name=disk,file.driver=file,file.filename=/mnt/guest.qcow2,file.locking=auto:
 Failed to lock byte 100

The error happens when the filesystem doesn't support OFD lock.
qemu_probe_lock_ops() judges whether qemu can use OFD lock or not with doing
fcntl(F_OFD_GETLK) to /dev/null, so the error happens if /dev/null supports OFD 
lock,
but the filesystem doesn't support the lock.

I'm thinking how to fix the error. My idea is to add locking=posix option to 
use posix
lock to the file, but I'm not sure the idea is good way to fix the error...

I would appreciate it if you could give me some advises to fix the error.

BTW, locking=off may be useful for the workaround so far, however, locking=off
doesn't work on the splitting blockdev configs as followings...
I split the blockdev option as libvirt doing.

   -blockdev 
driver=file,filename=/mnt/guest.qcow2,node-name=storage,auto-read-only=on,locking=off
 \
   -blockdev node-name=format,read-only=off,driver=qcow2,file=storage \

Thanks,
Masa



reply via email to

[Prev in Thread] Current Thread [Next in Thread]