SUNRPC: move waitq from RPC pipe to RPC inode
authorStanislav Kinsbursky <skinsbursky@parallels.com>
Mon, 27 Feb 2012 18:05:54 +0000 (22:05 +0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 27 Feb 2012 18:37:48 +0000 (13:37 -0500)
commit591ad7feaec5417681b4112f8df52fc43bb7c92e
tree0555df9d98236f6a63ca109632a277c4458842e3
parent2c9030eef9dbd0d737a7f55646da70d217fd6255
SUNRPC: move waitq from RPC pipe to RPC inode

Currently, wait queue, used for polling of RPC pipe changes from user-space,
is a part of RPC pipe. But the pipe data itself can be released on NFS umount
prior to dentry-inode pair, connected to it (is case of this pair is open by
some process).
This is not a problem for almost all pipe users, because all PipeFS file
operations checks pipe reference prior to using it.
Except evenfd. This thing registers itself with "poll" file operation and thus
has a reference to pipe wait queue. This leads to oopses on destroying eventfd
after NFS umount (like rpc_idmapd do) since not pipe data left to the point
already.
The solution is to wait queue from pipe data to internal RPC inode data. This
looks more logical, because this wiat queue used only for user-space processes,
which already holds inode reference.

Note: upcalls have to get pipe->dentry prior to dereferecing wait queue to make
sure, that mount point won't disappear from underneath us.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/sunrpc/rpc_pipe_fs.h
net/sunrpc/rpc_pipe.c