[PATCH] ceph: Add check returned value on func ceph_calc_ceph_pg.

2013-08-02 Thread majianpeng
Func ceph_calc_ceph_pg maybe failed.So add check for returned value.

Signed-off-by: Jianpeng Ma 
---
 fs/ceph/ioctl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index e0b4ef3..8c463dd 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -209,8 +209,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) {
-- 
1.8.1.2


Thanks!
Jianpeng MaN�Р骒r��yb�X�肚�v�^�)藓{.n�+���z�]z鳐�{ay��,j��f"�h���z��wア�
⒎�j:+v���w�j�m��赙zZ+�茛j"��!�i

Re: [PATCH] ceph: Add check returned value on func ceph_calc_ceph_pg.

2013-08-02 Thread Sage Weil
Applied, thanks!

On Fri, 2 Aug 2013, majianpeng wrote:

> Func ceph_calc_ceph_pg maybe failed.So add check for returned value.
> 
> Signed-off-by: Jianpeng Ma 
> ---
>  fs/ceph/ioctl.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
> index e0b4ef3..8c463dd 100644
> --- a/fs/ceph/ioctl.c
> +++ b/fs/ceph/ioctl.c
> @@ -209,8 +209,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) {
> -- 
> 1.8.1.2
> 
> 
> Thanks!
> Jianpeng Ma
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html