> The readdir POSIX api is not thread safe.  This presents problems in
 > multithreaded programs that use the libibverbs APIs.

So as discussed this is not true ... as far as I can see libibverbs only
calls readdir inside a mutex and so on all platforms where libibverbs
has even a chance of being applicable, the current code works fine.  The
real issue is that corosync defines a new environment where readdir is
not allowed.

I'm really not sure about this patch one way or another.  With alloca,
it ends up looking pretty clean, but we do introduce the tiny
possibility of buffer overrun (since readdir_r uses a user-supplied
buffer of poorly-specified size); the benefit is that we work within
corosync's constraints.  I honestly don't have a good feeling whether
the benefit exceeds the cost.

Jason, any opinion one way or another?

 > +#if HAVE_ALLOCA_H
 > +#include <alloca.h>
 > +#endif

Elsewhere we just include alloca.h unconditionally, and in fact I don't
see anything that would define HAVE_ALLOCA_H in the libibverbs tree.
Does this actually work?

 - R.
-- 
Roland Dreier <rola...@cisco.com> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to