Concurrent nfs_service() call and nfs_lstat64_async() calls

53 views
Skip to first unread message

haihon...@rubrik.com

unread,
May 4, 2018, 3:25:06 PM5/4/18
to libnfs
I wonder if libnfs is safe if I have code like this: one thread is doing poll()/nfs_service() to process NFS responses, another thread calls nfs_lstat64_async() simultaneously. Is there threading issue with this model?

ronnie sahlberg

unread,
May 5, 2018, 3:45:41 AM5/5/18
to lib...@googlegroups.com
It is not safe since when you call nfs_lstat64_async() as it will
modify the nfs_context linked list of pointers for the queue of
outgoing PDUs.
That same list is also read and modified in nfs_service() when it
writes a queued PDU to the wire.


You need to wrap these calls inside a mutex. That should not harm
performance much/any-at-all in modern linux which uses futex-es as the
mutex primitive.
As nfs_lstat64_async is guaranteed to be non-blocking and thus will
return almost instantly, there will not be much/any-at-all impact of
the serialization that this futex would incur.
> --
> You received this message because you are subscribed to the Google Groups
> "libnfs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to libnfs+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages