On Fri, Nov 20 2009 at 1:00pm -0500, Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote: > > > 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); OK, I've tested this to work fine. Thanks for spotting this. Alasdair, are you OK with editing v9 of this patch to include Mikulas' change? And also add his 'Signed-off-by'? Or should I send v10? Mike -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel