提交 8ed75463 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] md: Make sure rdev->size gets set for version-1 superblocks

Sometimes it doesn't so make the code more like the version-0 code which
works.
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 29fc7e3e
...@@ -1024,7 +1024,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) ...@@ -1024,7 +1024,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
rdev-> sb_size = (rdev->sb_size | bmask)+1; rdev-> sb_size = (rdev->sb_size | bmask)+1;
if (refdev == 0) if (refdev == 0)
return 1; ret = 1;
else { else {
__u64 ev1, ev2; __u64 ev1, ev2;
struct mdp_superblock_1 *refsb = struct mdp_superblock_1 *refsb =
...@@ -1044,7 +1044,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) ...@@ -1044,7 +1044,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
ev2 = le64_to_cpu(refsb->events); ev2 = le64_to_cpu(refsb->events);
if (ev1 > ev2) if (ev1 > ev2)
return 1; ret = 1;
else
ret = 0;
} }
if (minor_version) if (minor_version)
rdev->size = ((rdev->bdev->bd_inode->i_size>>9) - le64_to_cpu(sb->data_offset)) / 2; rdev->size = ((rdev->bdev->bd_inode->i_size>>9) - le64_to_cpu(sb->data_offset)) / 2;
...@@ -1058,7 +1060,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) ...@@ -1058,7 +1060,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
if (le32_to_cpu(sb->size) > rdev->size*2) if (le32_to_cpu(sb->size) > rdev->size*2)
return -EINVAL; return -EINVAL;
return 0; return ret;
} }
static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册