Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320352
b: refs/heads/master
c: 8e94af8
h: refs/heads/master
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed Jul 31, 2012
1 parent 1414831 commit 2b1dc0b
Show file tree
Hide file tree
Showing 2 changed files with 8 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: aa711ee3402ad10ffd5b70ce0417fadc9a95cccf
refs/heads/master: 8e94af8e2b582e5915abc171a28130881d1c26e4
8 changes: 7 additions & 1 deletion trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ static void rbd_coll_release(struct kref *kref)
kfree(coll);
}

static bool rbd_dev_ondisk_valid(struct rbd_image_header_ondisk *ondisk)
{
return !memcmp(&ondisk->text,
RBD_HEADER_TEXT, sizeof (RBD_HEADER_TEXT));
}

/*
* Create a new header structure, translate header format from the on-disk
* header.
Expand All @@ -492,7 +498,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header,
{
u32 i, snap_count;

if (memcmp(ondisk, RBD_HEADER_TEXT, sizeof(RBD_HEADER_TEXT)))
if (!rbd_dev_ondisk_valid(ondisk))
return -ENXIO;

snap_count = le32_to_cpu(ondisk->snap_count);
Expand Down

0 comments on commit 2b1dc0b

Please sign in to comment.