Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1317755
| From | "Yan, Zheng" <zyan@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [patch] ceph: checking for IS_ERR instead of NULL |
| Date | 2016-01-26 12:20 +0100 |
| Message-ID | <qV9Pc-3ib-27@gated-at.bofh.it> (permalink) |
| References | <qV86K-23v-15@gated-at.bofh.it> <qV9ct-2Od-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> On Jan 26, 2016, at 18:30, Ilya Dryomov <idryomov@gmail.com> wrote:
>
> On Tue, Jan 26, 2016 at 10:24 AM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
>> ceph_osdc_alloc_request() returns NULL on error, it never returns error
>> pointers.
>>
>> Fixes: 5be0389dac66 ('ceph: re-send AIO write request when getting -EOLDSNAP error')
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
>> index d37efdd..a52cf9b 100644
>> --- a/fs/ceph/file.c
>> +++ b/fs/ceph/file.c
>> @@ -698,8 +698,8 @@ static void ceph_aio_retry_work(struct work_struct *work)
>>
>> req = ceph_osdc_alloc_request(orig_req->r_osdc, snapc, 2,
>> false, GFP_NOFS);
>> - if (IS_ERR(req)) {
>> - ret = PTR_ERR(req);
>> + if (!req) {
>> + ret = -ENOMEM;
>> req = orig_req;
>> goto out;
>> }
>
> Applied, thanks Dan.
>
> Zheng, I have an related concern: where do you put snapc (refcount is
> bumped a few lines above) if ceph_osdc_alloc_request() fails? It looks
> like it's leaked to me.
>
> The BUG_ON(ret == -EOLDSNAPC) also seems a bit bogus, given that ret is
> either -ENOMEM or ceph_osdc_start_request() retval.
ceph_aio_complete_req treats -EOLDSNAP distinguishingly. Purpose of this BUG_ON is detect potential infinite loop.
Regards
Yan, Zheng
>
> Ilya
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch] ceph: checking for IS_ERR instead of NULL Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-26 10:30 +0100
Re: [patch] ceph: checking for IS_ERR instead of NULL Ilya Dryomov <idryomov@gmail.com> - 2016-01-26 11:40 +0100
Re: [patch] ceph: checking for IS_ERR instead of NULL "Yan, Zheng" <zyan@redhat.com> - 2016-01-26 12:20 +0100
Re: [patch] ceph: checking for IS_ERR instead of NULL Ilya Dryomov <idryomov@gmail.com> - 2016-01-26 12:50 +0100
Re: [patch] ceph: checking for IS_ERR instead of NULL "Yan, Zheng" <zyan@redhat.com> - 2016-01-26 13:00 +0100
Re: [patch] ceph: checking for IS_ERR instead of NULL Ilya Dryomov <idryomov@gmail.com> - 2016-01-26 15:10 +0100
Re: [patch] ceph: checking for IS_ERR instead of NULL Ilya Dryomov <idryomov@gmail.com> - 2016-01-26 16:30 +0100
csiph-web