Skip to content

Commit

Permalink
ceph: Add check returned value on func ceph_calc_ceph_pg.
Browse files Browse the repository at this point in the history
Func ceph_calc_ceph_pg maybe failed.So add check for returned value.

Signed-off-by: Jianpeng Ma <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
majianpeng authored and Sage Weil committed Aug 10, 2013
1 parent 7ab9b38 commit 2fbcbff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/ceph/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx",
ceph_ino(inode), dl.object_no);

ceph_calc_ceph_pg(&pgid, dl.object_name, osdc->osdmap,
ceph_file_layout_pg_pool(ci->i_layout));
r = ceph_calc_ceph_pg(&pgid, dl.object_name, osdc->osdmap,
ceph_file_layout_pg_pool(ci->i_layout));
if (r < 0) {
up_read(&osdc->map_sem);
return r;
}

dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid);
if (dl.osd >= 0) {
Expand Down

0 comments on commit 2fbcbff

Please sign in to comment.