Re: [PATCH v9] dm snapshot: allow live exception store handover between tables

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

 




On Thu, 19 Nov 2009, Mike Snitzer wrote:

> Permit in-use snapshot exception data to be 'handed over' from one
> snapshot instance to another.  This is a pre-requisite for patches
> that allow the changes made in a snapshot device to be merged back into
> its origin device and also allows device resizing.
> 
> The basic call sequence is:
> 
>   dmsetup load new_snapshot (referencing the existing in-use cow device)
>      - the ctr code detects that the cow is already in use and allows the
>        two snapshot target instances to be linked together
>   dmsetup suspend original_snapshot
>   dmsetup resume new_snapshot
>      - the new_snapshot becomes live, and if anything now tries to access
>        the original one it will receive -EIO
>   dmsetup remove original_snapshot
> 
> (There can only be two snapshot targets referencing the same cow device
> simultaneously.)
> 
> Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx>

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
Acked-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

> +	down_read(&_origins_lock);
> +	(void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest);
> +	if (snap_src && snap_dest) {
> +		down_write_nested(&snap_src->lock, SINGLE_DEPTH_NESTING);
> +		down_write(&snap_dest->lock);

I'd suggest to use the "_nested" version for the nested lock, it is a 
convention.

down_write(&snap_src->lock);
down_write_nested(&snap_dest->lock, SINGLE_DEPTH_NESTING);

Mikulas

> +		__handover_exceptions(snap_src, snap_dest);
> +		up_write(&snap_dest->lock);
> +		up_write(&snap_src->lock);
> +	}
> +	up_read(&_origins_lock);

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux