Skip to contentSkip to conversation

rbd: add new snapshots at the tail

PATCH In review Alex Elder 2 participants 2 messages Sep 4, 2012

Subsystems (2)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 rbd: add new snapshots at the tail

This fixes a bug that went in with this commit:

commit f6e0c99092cca7be00fca4080cfc7081739ca544
Author: Alex Elder <[email protected]>
Date: Thu Aug 2 11:29:46 2012 -0500
rbd: simplify __rbd_init_snaps_header()

The problem is that a new rbd snapshot needs to go either after an existing snapshot entry, or at the *end* of an rbd device's snapshot list. As originally coded, it is placed at the beginning. This was based on the assumption the list would be empty (so it wouldn't matter), but in fact if multiple new snapshots are added to an empty list in one shot the list will be non-empty after the first one is added.

This addresses http://tracker.newdream.net/issues/3063

---
 drivers/block/rbd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rbd.c +0 -0
index 8e6e29e..fd51f9d 100644
@@ -2187,7 +2187,7 @@ static int __rbd_init_snaps_header(struct

rbd_device *rbd_dev)
if (snap)
list_add_tail(&new_snap->node, &snap->node);
else
- list_add(&new_snap->node, head);
+ list_add_tail(&new_snap->node, head);
} else {
/* Already have this one */

Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 36 lines · Alex Elder

This fixes a bug that went in with this commit:

commit f6e0c99092cca7be00fca4080cfc7081739ca544
Author: Alex Elder <[email protected]>
Date: Thu Aug 2 11:29:46 2012 -0500
rbd: simplify __rbd_init_snaps_header()

The problem is that a new rbd snapshot needs to go either after an existing snapshot entry, or at the *end* of an rbd device's snapshot list. As originally coded, it is placed at the beginning. This was based on the assumption the list would be empty (so it wouldn't matter), but in fact if multiple new snapshots are added to an empty list in one shot the list will be non-empty after the first one is added.

This addresses http://tracker.newdream.net/issues/3063

---
  drivers/block/rbd.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rbd.c +1 -1
index 8e6e29e..fd51f9d 100644
@@ -2187,7 +2187,7 @@ static int __rbd_init_snaps_header(struct
 rbd_device *rbd_dev)
  			if (snap)
  				list_add_tail(&new_snap->node, &snap->node);
  			else
-				list_add(&new_snap->node, head);
+				list_add_tail(&new_snap->node, head);
  		} else {
  			/* Already have this one */