ceph: checking for IS_ERR instead of NULL
Subsystems (2)
PATCH 1/1 ceph: checking for IS_ERR instead of NULL
ceph_osdc_alloc_request() returns NULL on error, it never returns error pointers.
fs/ceph/file.c +2 -2
@@ -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; }
Quoted 11 lines · Dan Carpenter
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 <[email protected]>fs/ceph/file.c +0
-0
fs/ceph/file.c static void ceph_aio_retry_work(struct work_struct *work) · line 705
Quoted 10 lines
fs/ceph/file.c +2
-2@@ -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.
Ilya
Quoted 29 lines · Ilya Dryomov
Quoted 11 lines · Dan Carpenter
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 <[email protected]>fs/ceph/file.c +0
-0fs/ceph/file.c static void ceph_aio_retry_work(struct work_struct *work) · line 705
Quoted 10 lines
fs/ceph/file.c +2
-2@@ -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.
Quoted 6 lines
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-ENOMEMorceph_osdc_start_request()retval.
ceph_aio_complete_req treats -EOLDSNAP distinguishingly. Purpose of this BUG_ON is detect potential infinite loop.
Regards
Yan, Zheng
Quoted 2 lines
Ilya
Ilya Dryomov
maintainerQuoted 29 lines · Zheng
Quoted 29 lines · Ilya Dryomov
Quoted 11 lines · Dan Carpenter
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 <[email protected]>fs/ceph/file.c +0
-0fs/ceph/file.c static void ceph_aio_retry_work(struct work_struct *work) · line 705
Quoted 10 lines
fs/ceph/file.c +2
-2@@ -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.
Quoted 8 lines
Quoted 6 lines
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-ENOMEMorceph_osdc_start_request()retval.
ceph_aio_complete_reqtreats-EOLDSNAPdistinguishingly. Purpose of thisBUG_ONis detect potential infinite loop.
Did you miss the part about the snap context?
I get the purpose of -EOLDSNAPC assert in ceph_direct_read_write(), where you can actually get it from ceph_osdc_wait_request() - it's a server-side error code. Asserting it in ceph_aio_retry_work(), in which only client helpers are called and the only two possible error codes are -ENOMEM and -EIO doesn't make much sense to me.
Thanks,
Ilya
Quoted 42 lines · Ilya Dryomov
Quoted 29 lines · Zheng
Quoted 29 lines · Ilya Dryomov
Quoted 11 lines · Dan Carpenter
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 <[email protected]>fs/ceph/file.c +0
-0fs/ceph/file.c static void ceph_aio_retry_work(struct work_struct *work) · line 705
Quoted 10 lines
fs/ceph/file.c +2
-2@@ -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.
Quoted 8 lines
Quoted 6 lines
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-ENOMEMorceph_osdc_start_request()retval.
ceph_aio_complete_reqtreats-EOLDSNAPdistinguishingly. Purpose of thisBUG_ONis detect potential infinite loop.
Quoted 8 lines
Did you miss the part about the snap context?
I get the purpose of
-EOLDSNAPCassert inceph_direct_read_write(), where you can actually get it fromceph_osdc_wait_request()- it's a server-side error code. Asserting it inceph_aio_retry_work(), in which only client helpers are called and the only two possible error codes are-ENOMEMand-EIOdoesn't make much sense to me.
Yeah, removing that BUG_ON is completely OK.
Regards,
Yan, Zheng
Quoted 3 lines
Thanks,
Ilya
Ilya Dryomov
maintainerQuoted 44 lines · Zheng
Quoted 44 lines · Ilya Dryomov
Quoted 29 lines · Zheng
Quoted 29 lines · Ilya Dryomov
Quoted 11 lines · Dan Carpenter
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 <[email protected]>fs/ceph/file.c +0
-0fs/ceph/file.c static void ceph_aio_retry_work(struct work_struct *work) · line 705
Quoted 10 lines
fs/ceph/file.c +2
-2@@ -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.
Quoted 8 lines
Quoted 6 lines
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-ENOMEMorceph_osdc_start_request()retval.
ceph_aio_complete_reqtreats-EOLDSNAPdistinguishingly. Purpose of thisBUG_ONis detect potential infinite loop.Did you miss the part about the snap context?
Quoted 8 lines
Quoted 6 lines
I get the purpose of
-EOLDSNAPCassert inceph_direct_read_write(), where you can actually get it fromceph_osdc_wait_request()- it's a server-side error code. Asserting it inceph_aio_retry_work(), in which only client helpers are called and the only two possible error codes are-ENOMEMand-EIOdoesn't make much sense to me.Yeah, removing that
BUG_ONis completely OK.
I still want to know where snapc is put ;)
Thanks,
Ilya
Ilya Dryomov
maintainerQuoted 55 lines · Zheng
Quoted 55 lines · Ilya Dryomov
Quoted 51 lines · Zheng
Quoted 50 lines · Ilya Dryomov
Quoted 29 lines · Zheng
Quoted 29 lines · Ilya Dryomov
Quoted 11 lines · Dan Carpenter
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 <[email protected]>fs/ceph/file.c +0
-0fs/ceph/file.c static void ceph_aio_retry_work(struct work_struct *work) · line 705
Quoted 10 lines
fs/ceph/file.c +2
-2@@ -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.
Quoted 8 lines
Quoted 6 lines
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-ENOMEMorceph_osdc_start_request()retval.
ceph_aio_complete_reqtreats-EOLDSNAPdistinguishingly. Purpose of thisBUG_ONis detect potential infinite loop.Did you miss the part about the snap context?
I get the purpose of
-EOLDSNAPCassert inceph_direct_read_write(), where you can actually get it fromceph_osdc_wait_request()- it's a server-side error code. Asserting it inceph_aio_retry_work(), in which only client helpers are called and the only two possible error codes are-ENOMEMand-EIOdoesn't make much sense to me.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Yeah, removing that
BUG_ONis completely OK.I still want to know where snapc is put ;)
you are right. I missed that
Great, you can remove that BUG_ON in the same commit then.
Thanks,
Ilya