summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_node.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-08-20 05:15:39 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-08-20 05:15:39 +0000
commit5958e39b3f98528cbe9a8ae8d98a457db9039179 (patch)
tree5cf283cbe3d760f80bdac48499bda688045a1951 /sys/nfsclient/nfs_node.c
parent89f466d2b24eb304fba1cca7584fbd61aa0a8c94 (diff)
downloadFreeBSD-src-5958e39b3f98528cbe9a8ae8d98a457db9039179.zip
FreeBSD-src-5958e39b3f98528cbe9a8ae8d98a457db9039179.tar.gz
In current implementation, thread cancellation is done in signal handler,
which does not know what is the state of interrupted system call, for example, open() system call opened a file and the thread is still cancelled, result is descriptor leak, there are other problems which can cause resource leak or undeterminable side effect when a thread is cancelled. However, this is no longer true in new implementation. In defering mode, a thread is canceled if cancellation request is pending and later the thread enters a cancellation point, otherwise, a later pthread_cancel() just causes SIGCANCEL to be sent to the target thread, and causes target thread to abort system call, userland code in libthr then checks cancellation state, and cancels the thread if needed. For example, the cancellation point open(), the thread may be canceled at start, but later, if it opened a file descriptor, it is not canceled, this avoids file handle leak. Another example is read(), a thread may be canceled at start of the function, but later, if it read some bytes from a socket, the thread is not canceled, the caller then can decide if it should still enable cancelling or disable it and continue reading data until it thinks it has read all bytes of a packet, and keeps a protocol stream in health state, if user ignores partly reading of a packet without disabling cancellation, then second iteration of read loop cause the thread to be cancelled. An exception is that the close() cancellation point always closes a file handle despite whether the thread is cancelled or not. The old mechanism is still kept, for a functions which is not so easily to fix a cancellation problem, the rough mechanism is used. Reviewed by: kib@
Diffstat (limited to 'sys/nfsclient/nfs_node.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud