__remove_osd() vs lingering requests
cover __remove_osd() vs lingering requests
Hello,
These are fixes for the problem I found while trying to reproduce recently reopened http://tracker.ceph.com/issues/5429. I'm pretty sure this is what was reported in http://tracker.ceph.com/issues/8568 too. The exact BUG_ON() it points to is no longer there, but I checked with an older kernel and the reproducer I have for this triggered it.
Thanks,
Ilya
Ilya Dryomov (3):
libceph: unlink from o_linger_requests when clearing r_osd
libceph: clear r_req_lru_item in __unregister_linger_request()
libceph: change from BUG to WARN for __remove_osd() asserts
net/ceph/osd_client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/3 libceph: unlink from o_linger_requests when clearing r_osd
Requests have to be unlinked from both osd->o_requests (normal requests) and osd->o_linger_requests (linger requests) lists when clearing req->r_osd. Otherwise __unregister_linger_request() gets confused and we trip over a !list_empty(&osd->o_linger_requests) assert in __remove_osd().
Reproducer, MON=1 OSD=1:
# cat remove-osd.sh
#!/bin/bash
rbd create --size 1 test
DEV=$(rbd map test)
ceph osd out 0
sleep 3
rbd map bar/b # obtain a new osdmap as a side effect
rbd unmap $DEV & # will block
sleep 3
ceph osd in 0--- net/ceph/osd_client.c | 1 + 1 file changed, 1 insertion(+)
net/ceph/osd_client.c +1 -0
@@ -1395,6 +1395,7 @@ static int __map_request(struct ceph_osd_client *osdc,if (req->r_osd) {__cancel_request (req);list_del_init (&req->r_osd_item); +list_del_init (&req->r_linger_osd_item); req->r_osd =NULL ; }
Signature · 1 line
1.7.10.4
PATCH 2/3 libceph: clear r_req_lru_item in __unregister_linger_request()
In reply to Ilya Dryomovkick_requests() can put linger requests on the notarget list. This means we need to clear the much-overloaded req->r_req_lru_item in __unregister_linger_request() as well, or we get an assertion failure in ceph_osdc_release_request() - !list_empty(&req->r_req_lru_item).
AFAICT the assumption was that registered linger requests cannot be on any of req->r_req_lru_item lists, but that's clearly not the case.
--- net/ceph/osd_client.c | 2 ++ 1 file changed, 2 insertions(+)
net/ceph/osd_client.c +2 -0
@@ -1254,6 +1254,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,if (list_empty (&req->r_osd_item)) req->r_osd =NULL ; } + +list_del_init (&req->r_req_lru_item);/* can be on notarget */ ceph_osdc_put_request (req); }
Signature · 1 line
1.7.10.4
PATCH 3/3 libceph: change from BUG to WARN for __remove_osd() asserts
In reply to Ilya DryomovNo reason to use BUG_ON for osd request list assertions.
--- net/ceph/osd_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +2 -2
@@ -1007,8 +1007,8 @@ static void put_osd(struct ceph_osd *osd)static void __remove_osd (struct ceph_osd_client *osdc,struct ceph_osd *osd) {dout ("__remove_osd %p\n" , osd); -BUG_ON (!list_empty (&osd->o_requests)); -BUG_ON (!list_empty (&osd->o_linger_requests)); +WARN_ON (!list_empty (&osd->o_requests)); +WARN_ON (!list_empty (&osd->o_linger_requests));rb_erase (&osd->o_node, &osdc->osds);list_del_init (&osd->o_osd_lru);
Signature · 1 line
1.7.10.4
Quoted 11 lines · Ilya Dryomov
Hello,
These are fixes for the problem I found while trying to reproduce recently reopened http://tracker.ceph.com/issues/5429. I'm pretty sure this is what was reported in http://tracker.ceph.com/issues/8568 too. The exact
BUG_ON()it points to is no longer there, but I checked with an older kernel and the reproducer I have for this triggered it.Thanks,
Ilya
All three of these look good to me. The interactions with these lists has always been a bit too tricky; you've done a lot to make sense of them.
And I'm sure there are other BUG_ON() (or rbd_assert()) calls that can be tamed--either removed, changed to warnings, or changed to simply return errors where possible.
Quoted 10 lines
Ilya Dryomov (3):
libceph: unlink fromo_linger_requestswhen clearingr_osd
libceph: clearr_req_lru_itemin__unregister_linger_request()
libceph: change from BUG to WARN for__remove_osd()assertsnet/ceph/osd_client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Quoted 17 lines · Alex Elder
Quoted 11 lines · Ilya Dryomov
Hello,
These are fixes for the problem I found while trying to reproduce recently reopened http://tracker.ceph.com/issues/5429. I'm pretty sure this is what was reported in http://tracker.ceph.com/issues/8568 too. The exact
BUG_ON()it points to is no longer there, but I checked with an older kernel and the reproducer I have for this triggered it.Thanks,
Ilya
All three of these look good to me. The interactions with these lists has always been a bit too tricky; you've done a lot to make sense of them.
Quoted 5 lines
And I'm sure there are other
BUG_ON()(orrbd_assert()) calls that can be tamed--either removed, changed to warnings, or changed to simply return errors where possible.Reviewed-by Alex Elder <[email protected]>
Thanks for the review, Alex!
Ilya