SUNRPC: check RPC inode's pipe reference before dereferencing
authorStanislav Kinsbursky <skinsbursky@parallels.com>
Mon, 27 Feb 2012 18:05:45 +0000 (22:05 +0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 27 Feb 2012 18:37:09 +0000 (13:37 -0500)
commit2c9030eef9dbd0d737a7f55646da70d217fd6255
tree69f1eafced52fef9d3939d8e1246d5063d14649a
parente9dbca8d732e20b8d31a3094a8669c014e7ee262
SUNRPC: check RPC inode's pipe reference before dereferencing

There are 2 tightly bound objects: pipe data (created for kernel needs, has
reference to dentry, which depends on PipeFS mount/umount) and PipeFS
dentry/inode pair (created on mount for user-space needs). They both
independently may have or have not a valid reference to each other.
This means, that we have to make sure, that pipe->dentry reference is valid on
upcalls, and dentry->pipe reference is valid on downcalls. The latter check is
absent - my fault.
IOW, PipeFS dentry can be opened by some process (rpc.idmapd for example), but
it's pipe data can belong to NFS mount, which was unmounted already and thus
pipe data was destroyed.
To fix this, pipe reference have to be set to NULL on rpc_unlink() and checked
on PipeFS file operations instead of pipe->dentry check.

Note: PipeFS "poll" file operation will be updated in next patch, because it's
logic is more complicated.

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