[lvm-devel] Re: Deactivating volume with mounted snapshot

Mikulas Patocka mpatocka at redhat.com
Fri May 16 14:42:04 UTC 2008


> I put a printk points at ctr/dtr/suspend/resume functions into origin and 
> snapshot and observed their calls when activating/deactivating, 
> adding/removing a snapshot and adding/removing the first/last snapshot.
>
> Because "active" variable was never reset to zero, it had effect only between 
> snapshot ctr (set to 0) and snapshot resume (set to 1). When it was set to 0, 
> the snapshot didn't allocate exceptions. After the patch, the snapshot always 
> allocates exceptions (between snapshot ctr and snapshot dtr calls).
>
> The change in the patch is safe because when someone is creating snapshot and 
> simultaneously writing to the origin device, it is unspecified, which write 
> requests trigger reallocations in the snapshot and which not.

Milan said that there is xfs freeze called between that (it is called just 
before origin suspend) --- and it's fact that dropping an "active" 
variable would make unclean snapshot on xfs.

So I'll change it so that no exceptions are reallocated if active is zero 
and the exception store is empty. That will make both xfs freeze and 
snapshot merging safe.

Mikulas

> I found another problem --- the lvchange -an is currently safe, but it is 
> unsafe with snapshot merging. Ideally it should suspend all the devices first 
> and then call destructors on the snapshots. I'll look at it.
>
> Mikulas

> lvchange -ay:
> origin ctr: 254:4
> snapshot ctr 254:4 254:6
> snapshot ctr 254:4 254:8
> origin resume: 254:4 254:6
> origin resume: 254:4 254:8
> origin resume: 254:4
>
> lvchange -an:
> origin suspend: 254:4
> origin dtr: 254:4
> snapshot suspend: 254:4 254:6
> snapshot dtr 254:4 254:6
> snapshot suspend: 254:4 254:8
> snapshot dtr 254:4 254:8
>
> lvcreate snapshot:
> snapshot ctr 254:4 254:11
> origin suspend: 254:4
> snapshot suspend: 254:4 254:6
> snapshot suspend: 254:4 254:8
> snapshot resume: 254:4 254:6
> snapshot resume: 254:4 254:8
> snapshot resume: 254:4 254:11
> origin resume: 254:4
>
> lvremove snapshot:
> snapshot suspend: 254:4 254:11
> snapshot dtr 254:4 254:11
>
> lvcreate, adding the first snapshot:
> origin ctr: 254:12
> snapshot ctr 254:12 254:13
> snapshot resume: 254:12 254:13
> origin resume: 254:12
>
> lvremove, removing the last snapshot:
> snapshot suspend: 254:12 254:13
> snapshot dtr 254:12 254:13
> origin suspend: 254:12
> origin dtr: 254:12
>
>




More information about the lvm-devel mailing list