[linux-lvm] Re: Snapshot - Commit and Rollback

Stuart D. Gathman stuart at bmsi.com
Fri Jan 18 16:53:24 UTC 2008


On Fri, 18 Jan 2008, Rahul Sahadevan wrote:

>      I have posted this mail regarding the SNAPSHOT operations in LVM2.
> If anyone has any clue or comments please put forward. I am deliberately
> waiting for a reply from this group. 

COMMIT and ROLLBACK features are not currently implemented.  They are
certainly possible using device-mapper.

Here is an idea about ROLLBACK.  Assume a primary LV 'P' and a snapshot
'S'.  Any writes to 'P' copies the cluster to 'S' first.  Any reads
from 'S' get the data from 'P' unless it was copied to 'S'.

Now, for a rollback, create a new snapshot 'R' (in case we change our
minds!).  In addition, reads from 'P' fetch clusters from 'S' that were
copied there, until that cluster is written on 'P'.  'P' now depends on 'S'.

To eventually get rid of 'S', we also have reads from 'P' that are mapped
to 'S' also copy the cluster from 'S' back to 'P' (after copying from 'P'
to 'R' of course).  So simply by reading all of 'P', the clusters mapped
to 'S' (the percentage displayed in lvs) can be reduced to 0, and 'S' can then
be deleted.  

This works even if 'S' is rw, but isn't a true rollback, of course, unless 'S'
is ro.  If 'S' is rw, we can call the above operation a 'COMMIT', and if we
change our minds and revert to 'R', *that* is the 'ROLLBACK'.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list