diff options
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 65cc424359b0..a828c6a276a8 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -461,6 +461,10 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
461 | u32 snap_count = le32_to_cpu(ondisk->snap_count); | 461 | u32 snap_count = le32_to_cpu(ondisk->snap_count); |
462 | int ret = -ENOMEM; | 462 | int ret = -ENOMEM; |
463 | 463 | ||
464 | if (memcmp(ondisk, RBD_HEADER_TEXT, sizeof(RBD_HEADER_TEXT))) { | ||
465 | return -ENXIO; | ||
466 | } | ||
467 | |||
464 | init_rwsem(&header->snap_rwsem); | 468 | init_rwsem(&header->snap_rwsem); |
465 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); | 469 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); |
466 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + | 470 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + |
@@ -1610,8 +1614,13 @@ static int rbd_read_header(struct rbd_device *rbd_dev, | |||
1610 | goto out_dh; | 1614 | goto out_dh; |
1611 | 1615 | ||
1612 | rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL); | 1616 | rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL); |
1613 | if (rc < 0) | 1617 | if (rc < 0) { |
1618 | if (rc == -ENXIO) { | ||
1619 | pr_warning("unrecognized header format" | ||
1620 | " for image %s", rbd_dev->obj); | ||
1621 | } | ||
1614 | goto out_dh; | 1622 | goto out_dh; |
1623 | } | ||
1615 | 1624 | ||
1616 | if (snap_count != header->total_snaps) { | 1625 | if (snap_count != header->total_snaps) { |
1617 | snap_count = header->total_snaps; | 1626 | snap_count = header->total_snaps; |