diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2009-11-13 16:07:50 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2009-11-16 00:41:32 -0800 | 
| commit | d67322fdfa27746f82fb6e37ffe57efde9bfa021 (patch) | |
| tree | 3b489c6fee499daca7e7bcb470707124b691d368 /transport/ib-verbs/src/ib-verbs.h | |
| parent | 63e966d8c466599f84affb55fbedfb39e2a0068f (diff) | |
transport/ib-verbs: synchronize ib_verbs_recv_completion_proc with ib_verbs_receive so that the former doesn't overwrite the pointer from which latter reads.
- There can be a condition wherein,
    1. the thread executing ib_verbs_recv_completion_proc (thr 1) stores the
       buffer pointer and notifies the upper translators about a POLLIN event.
    2. the thread waiting for events on socket (thr 2) calls transport_receive,
       but in ib_verbs_receive it has not still read the data.
    3. thr 1 receives work completion event for another work request and
       overwrites the buffer pointer.
    4. thr 2 reads from the new pointer there by missing the data stored in
       buffer pointed by pointer which got overwritten.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 382 (Data can be lost before it is read in ib_verbs_receive.)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=382
Diffstat (limited to 'transport/ib-verbs/src/ib-verbs.h')
| -rw-r--r-- | transport/ib-verbs/src/ib-verbs.h | 1 | 
1 files changed, 1 insertions, 0 deletions
diff --git a/transport/ib-verbs/src/ib-verbs.h b/transport/ib-verbs/src/ib-verbs.h index 348c673fa72..ea016c34d99 100644 --- a/transport/ib-verbs/src/ib-verbs.h +++ b/transport/ib-verbs/src/ib-verbs.h @@ -202,6 +202,7 @@ struct _ib_verbs_private {          char handshake_ret;          pthread_mutex_t recv_mutex; +        pthread_cond_t  recv_cond;          /* used during ib_verbs_handshake */          struct {  | 
