Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1526634
| From | Sagi Grimberg <sagi@grimberg.me> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 5/9] IB/isert: Replace semaphore sem with completion |
| Date | 2016-11-21 13:40 +0100 |
| Message-ID | <sFW38-1bK-13@gated-at.bofh.it> (permalink) |
| References | <sFPXI-5Q1-7@gated-at.bofh.it> <sFQ7n-5VC-25@gated-at.bofh.it> <sFRmO-6Ce-9@gated-at.bofh.it> <sFU1k-8p7-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
>>> diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
>>> index 6dd43f6..de80f56 100644
>>> --- a/drivers/infiniband/ulp/isert/ib_isert.c
>>> +++ b/drivers/infiniband/ulp/isert/ib_isert.c
>>> @@ -619,7 +619,7 @@
>>> mutex_unlock(&isert_np->mutex);
>>>
>>> isert_info("np %p: Allow accept_np to continue\n", isert_np);
>>> - up(&isert_np->sem);
>>> + complete(&isert_np->comp);
>>> }
>>>
>>> static void
>>> @@ -2311,7 +2311,7 @@ struct rdma_cm_id *
>>> isert_err("Unable to allocate struct isert_np\n");
>>> return -ENOMEM;
>>> }
>>> - sema_init(&isert_np->sem, 0);
>>> + init_completion(&isert_np->comp);
>>
>> This is still racy, a connect event can complete just before we
>> init the completion and *will* get lost...
>>
>> This code started off with a waitqueue which exposes the same
>> problem, see:
>> 531b7bf4bd79 Target/iser: Fix iscsit_accept_np and rdma_cm racy flow
>>
>> So, still NAK from me...
>
> I don't see what you mean here. The code using a waitqueue had no
> counter but the completion does.
The problem here is that init_completion sets the counter to zero
and between this thread wakes up and until it initializes comp->done
we might have another connect event completing it and I fail to
see how this is handled correctly.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 0/9] infiniband: Remove semaphores Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:10 +0100
[PATCH v5 7/9] IB/mthca: Replace counting semaphore event_sem with wait_event Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:10 +0100
[PATCH v5 6/9] IB/hns: Replace counting semaphore event_sem with wait_event Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:10 +0100
[PATCH v5 3/9] IB/hns: Replace semaphore poll_sem with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:10 +0100
[PATCH v5 8/9] IB/mlx5: Add helper mlx5_ib_post_send_wait Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:10 +0100
[PATCH v5 1/9] IB/core: iwpm_nlmsg_request: Replace semaphore with completion Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:10 +0100
[PATCH v5 9/9] IB/mlx5: Replace semaphore umr_common:sem with wait_event Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:20 +0100
[PATCH v5 4/9] IB/mthca: Replace semaphore poll_sem with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:20 +0100
[PATCH v5 5/9] IB/isert: Replace semaphore sem with completion Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:20 +0100
Re: [PATCH v5 5/9] IB/isert: Replace semaphore sem with completion Sagi Grimberg <sagi@grimberg.me> - 2016-11-21 08:40 +0100
Re: [PATCH v5 5/9] IB/isert: Replace semaphore sem with completion Arnd Bergmann <arnd@arndb.de> - 2016-11-21 11:30 +0100
Re: [PATCH v5 5/9] IB/isert: Replace semaphore sem with completion Sagi Grimberg <sagi@grimberg.me> - 2016-11-21 13:40 +0100
Re: [PATCH v5 5/9] IB/isert: Replace semaphore sem with completion Arnd Bergmann <arnd@arndb.de> - 2016-11-21 16:00 +0100
[PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait Binoy Jayan <binoy.jayan@linaro.org> - 2016-11-21 07:20 +0100
Re: [PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait Christoph Hellwig <hch@infradead.org> - 2016-11-21 18:00 +0100
Re: [PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait Arnd Bergmann <arnd@arndb.de> - 2016-11-21 18:00 +0100
Re: [PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait Linus Torvalds <torvalds@linux-foundation.org> - 2016-11-21 19:00 +0100
Re: [PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait Arnd Bergmann <arnd@arndb.de> - 2016-11-22 00:00 +0100
csiph-web