Daniel P. Berrange wrote:
It is safe if you assume that no one else has tried to modify the disk
since you opened it, otherwise you'd be commiting changes against a
base state which no longer exists.
1) first user opens cow1.qcow, acquires F_WRLCK
2) first user opens base.qcow, acquires F_RDLCK
3) second user opens cow2.qcow, acquires F_WRLCK
4) second user opens base.qcow, acquires F_RDLCK
5) second user attempts to commit cow2.qcow to base.qcow, tries to
acquire F_WRLCK. Calling F_SETLK with F_WRLCK will drop the F_RDLCK and
upgrade to F_WRLCK.
6) F_SETLK fails because another process is holding F_RDLCK, error is
printed to user
Now assume that there is only one user and commit succeeded, then we'd
drop back down to F_RDLCK (after an fsync) which means that afterwards,
people could open up the image again.
Regards,
Anthony Liguori