diff options
author | majianpeng <majianpeng@gmail.com> | 2013-08-02 06:14:48 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-09 20:55:21 -0400 |
commit | 2fbcbff1d6b9243ef71c64a8ab993bc3c7bb7af1 (patch) | |
tree | d06fed7336af28fc14bca3b2c988320ce880e717 /fs/ceph/ioctl.c | |
parent | 7ab9b3807097fcb87b0e85a9ad82b12322d9cc63 (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/ioctl.c')
-rw-r--r-- | fs/ceph/ioctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index a5ce62eb7806..669622fd1ae3 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) | |||
211 | snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx", | 211 | snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx", |
212 | ceph_ino(inode), dl.object_no); | 212 | ceph_ino(inode), dl.object_no); |
213 | 213 | ||
214 | ceph_calc_ceph_pg(&pgid, dl.object_name, osdc->osdmap, | 214 | r = ceph_calc_ceph_pg(&pgid, dl.object_name, osdc->osdmap, |
215 | ceph_file_layout_pg_pool(ci->i_layout)); | 215 | ceph_file_layout_pg_pool(ci->i_layout)); |
216 | if (r < 0) { | ||
217 | up_read(&osdc->map_sem); | ||
218 | return r; | ||
219 | } | ||
216 | 220 | ||
217 | dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid); | 221 | dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid); |
218 | if (dl.osd >= 0) { | 222 | if (dl.osd >= 0) { |