qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Disk image shared and exclusive locks.


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] Disk image shared and exclusive locks.
Date: Mon, 07 Dec 2009 08:53:14 -0600
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

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




reply via email to

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