summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authormajianpeng <majianpeng@gmail.com>2013-08-02 18:14:48 +0800
committerSage Weil <sage@inktank.com>2013-08-09 17:55:21 -0700
commit2fbcbff1d6b9243ef71c64a8ab993bc3c7bb7af1 (patch)
treed06fed7336af28fc14bca3b2c988320ce880e717 /fs/ceph
parent7ab9b3807097fcb87b0e85a9ad82b12322d9cc63 (diff)
ceph: Add check returned value on func ceph_calc_ceph_pg.
Func ceph_calc_ceph_pg maybe failed.So add check for returned value. Signed-off-by: Jianpeng Ma <majianpeng@gmail.com> Reviewed-by: Sage Weil <sage@inktank.com> Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/ioctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index a5ce62eb780..669622fd1ae 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -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) {