Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 276636
b: refs/heads/master
c: 81e759f
h: refs/heads/master
v: v3
  • Loading branch information
Josh Durgin authored and Sage Weil committed Dec 7, 2011
1 parent 640a524 commit a04c46c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2151937d7ce491bfbe269a1ae742c6686904474c
refs/heads/master: 81e759fbf7715514c32e563789db1d9d47fd55fb
11 changes: 10 additions & 1 deletion trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ static int rbd_header_from_disk(struct rbd_image_header *header,
u32 snap_count = le32_to_cpu(ondisk->snap_count);
int ret = -ENOMEM;

if (memcmp(ondisk, RBD_HEADER_TEXT, sizeof(RBD_HEADER_TEXT))) {
return -ENXIO;
}

init_rwsem(&header->snap_rwsem);
header->snap_names_len = le64_to_cpu(ondisk->snap_names_len);
header->snapc = kmalloc(sizeof(struct ceph_snap_context) +
Expand Down Expand Up @@ -1610,8 +1614,13 @@ static int rbd_read_header(struct rbd_device *rbd_dev,
goto out_dh;

rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL);
if (rc < 0)
if (rc < 0) {
if (rc == -ENXIO) {
pr_warning("unrecognized header format"
" for image %s", rbd_dev->obj);
}
goto out_dh;
}

if (snap_count != header->total_snaps) {
snap_count = header->total_snaps;
Expand Down

0 comments on commit a04c46c

Please sign in to comment.