qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* locking option doesn't work as expected
@ 2020-11-04 16:35 Masayoshi Mizuma
  2020-11-04 16:48 ` Daniel P. Berrangé
  0 siblings, 1 reply; 3+ messages in thread
From: Masayoshi Mizuma @ 2020-11-04 16:35 UTC (permalink / raw)
  To: qemu-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-04 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-04 16:35 locking option doesn't work as expected Masayoshi Mizuma
2020-11-04 16:48 ` Daniel P. Berrangé
2020-11-04 23:19   ` Masayoshi Mizuma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).