From 170869446c6dc87be40d0d63c278323228e52d26 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Thu, 26 Jul 2012 23:37:15 -0500 Subject: [PATCH] --- yaml --- r: 331631 b: refs/heads/master c: 28cb775de1bd1bcc62c43f767ab81b7b9cfb6678 h: refs/heads/master i: 331629: b0b28d20b941e3123c6747a776652eb6bc9e7ee4 331627: f2add33d049a281b4cde1f6b717004393b1bb9b2 331623: fc943449929a0e8dd2415f392f009e13cd67e7dc 331615: 96a7865545194d650ae549ada261f1d8a9c46950 v: v3 --- [refs] | 2 +- trunk/drivers/block/rbd.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index df44f0c43f55..0462f96c211b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6a52325f61760c6a7d7f3ea9736029bc9f63e7f3 +refs/heads/master: 28cb775de1bd1bcc62c43f767ab81b7b9cfb6678 diff --git a/trunk/drivers/block/rbd.c b/trunk/drivers/block/rbd.c index c9de0f8e808e..aff4e8a01ea5 100644 --- a/trunk/drivers/block/rbd.c +++ b/trunk/drivers/block/rbd.c @@ -540,7 +540,14 @@ static int rbd_header_from_disk(struct rbd_image_header *header, header->comp_type = ondisk->options.comp_type; header->total_snaps = snap_count; - /* Set up the snapshot context */ + /* + * If the number of snapshot ids provided by the caller + * doesn't match the number in the entire context there's + * no point in going further. Caller will try again after + * getting an updated snapshot context from the server. + */ + if (allocated_snaps != snap_count) + return 0; size = sizeof (struct ceph_snap_context); size += snap_count * sizeof (header->snapc->snaps[0]); @@ -552,8 +559,10 @@ static int rbd_header_from_disk(struct rbd_image_header *header, header->snapc->seq = le64_to_cpu(ondisk->snap_seq); header->snapc->num_snaps = snap_count; - if (snap_count && allocated_snaps == snap_count) { - int i; + /* Fill in the snapshot information */ + + if (snap_count) { + u32 i; for (i = 0; i < snap_count; i++) { header->snapc->snaps[i] =