[sheepdog] [PATCH v3 3/3] sheep: look up whole range of bitmap

FUKUMOTO Yoshifumi fukumoto.yoshifumi at lab.ntt.co.jp
Fri Feb 27 10:20:13 CET 2015


On 2015/02/27 13:46, Hitoshi Mitake wrote:
> Older sheepdog didn't have a functionality of recycling VID, so the
> get_vdi_bitmap_range() can detect correct range of bitmap. But newer
> sheepdog recycles VID. It can produce situations like below:
>
> The first state of VID bitmap:
> 0 0 1* 1* 1 0 0 0
> 1 is a VID bit of working VDI, 1* is a bit of snapshot. Assume the
> above 1 and 1* are used for VDI named "A" and its snapshots.
>
> Then, a user tries to create VDI "B". sd_hash_vdi() returns VID which
> conflicts with existing bits for A.
> 0 0 1* 1* 1 0 0 0
>         ^
>         |
>         sd_hash_vdi() returns VID which conflicts with the
>         above bit.
>
> So B acquires the left most free bit
> 0 0 1* 1* 1 1 0 0
>              ^
>              |
>              B acquires this bit.
>
> Then, the user deletes A and its snapshots. All of the family members
> are deleted. The bitmap becomes like below
> 0 0 0 0 0 1 0 0
>        ^
>        |
>        B's original VID sd_hash_vdi() calculates.

Thank you for updating the patch set.
I tried tests for recycling VIDs.
I found a situation that creating snapshot failed but it is unsure of an exact 
cause.

The situation can be reproduced with the below sequence:
  $ dog vdi create 00808bf8 16M   (0x000001 (original is 0x000001))
  $ dog vdi snapshot 00808bf8     (0x000002)
  $ dog vdi snapshot 00808bf8     (0x000003)
  $ dog vdi snapshot 00808bf8     (0x000004)
  $ dog vdi create 00f42e27 16M   (0x000005 (original is 0x000001))
  $ dog vdi create 011d7928 16M   (0x000006 (original is 0x000001))
  $ dog vdi delete 00808bf8
  $ dog vdi delete -s 3 00808bf8
  $ dog vdi delete -s 2 00808bf8
  $ dog vdi delete -s 1 00808bf8
($ dog vdi list)                 (now 0x000005 & 0x000006 are remaning)
  $ dog vdi snapshot 00f42e27     (reuse 0x000001)
  $ dog vdi snapshot 011d7928
  Failed to create snapshot for 011d7928: No VDI found

Thanks,
Yoshifumi

> Now sheep fails to lookup VID of B, because the VID calculated by
> sd_hash_vdi() is zero.
>
> This is the reason of the looking up whole range of bitmap. Of course
> it is ugly and costly. But its cost is equal or less than "dog vdi
> list"'s one.





More information about the sheepdog mailing list