]> git.karo-electronics.de Git - mv-sheeva.git/log
mv-sheeva.git
17 years agoSUNRPC client: add interface for binding to a local address
Frank van Maarseveen [Mon, 9 Jul 2007 20:23:35 +0000 (22:23 +0200)]
SUNRPC client: add interface for binding to a local address

In addition to binding to a local privileged port the NFS client should
allow binding to a specific local address. This is used by the server
for callbacks. The patch adds the necessary interface.

Signed-off-by: Frank van Maarseveen <frankvm@frankvm.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC server: record the destination address of a request
Frank van Maarseveen [Mon, 9 Jul 2007 20:21:39 +0000 (22:21 +0200)]
SUNRPC server: record the destination address of a request

Save the destination address of an incoming request over TCP like is
done already for UDP. It is necessary later for callbacks by the server.

Signed-off-by: Frank van Maarseveen <frankvm@frankvm.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: cleanup transport creation argument passing
Frank van Maarseveen [Sun, 8 Jul 2007 11:08:54 +0000 (13:08 +0200)]
SUNRPC: cleanup transport creation argument passing

Cleanup argument passing to functions for creating an RPC transport.

Signed-off-by: Frank van Maarseveen <frankvm@frankvm.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Make the NFS state model work with the nosharedcache mount option
Trond Myklebust [Fri, 6 Jul 2007 14:53:21 +0000 (10:53 -0400)]
NFSv4: Make the NFS state model work with the nosharedcache mount option

Consider the case where the user has mounted the remote filesystem
server:/foo on the two local directories /bar and /baz using the
nosharedcache mount option. The files /bar/file and /baz/file are
represented by different inodes in the local namespace, but refer to the
same file /foo/file on the server.
Consider the case where a process opens both /bar/file and /baz/file, then
closes /bar/file: because the nfs4_state is not shared between /bar/file
and /baz/file, the kernel will see that the nfs4_state for /bar/file is no
longer referenced, so it will send off a CLOSE rpc call. Unless the
open_owners differ, then that CLOSE call will invalidate the open state on
/baz/file too.

Conclusion: we cannot share open state owners between two different
non-shared mount instances of the same filesystem.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Error when mounting the same filesystem with different options
Trond Myklebust [Wed, 16 May 2007 20:53:28 +0000 (16:53 -0400)]
NFS: Error when mounting the same filesystem with different options

Unless the user sets the NFS_MOUNT_NOSHAREDCACHE mount flag, we should
return EBUSY if the filesystem is already mounted on a superblock that
has set conflicting mount options.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Add the mount option "nosharecache"
Trond Myklebust [Wed, 16 May 2007 20:53:28 +0000 (16:53 -0400)]
NFS: Add the mount option "nosharecache"

Prior to David Howell's mount changes in 2.6.18, users who mounted
different directories which happened to be from the same filesystem on the
server would get different super blocks, and hence could choose different
mount options. As long as there were no hard linked files that crossed from
one subtree to another, this was quite safe.
Post the changes, if the two directories are on the same filesystem (have
the same 'fsid'), they will share the same super block, and hence the same
mount options.

Add a flag to allow users to elect not to share the NFS super block with
another mount point, even if the fsids are the same. This will allow
users to set different mount options for the two different super blocks, as
was previously possible. It is still up to the user to ensure that there
are no cache coherency issues when doing this, however the default
behaviour will be to share super blocks whenever two paths result in
the same fsid.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Add support for mounting NFSv4 file systems with string options
Chuck Lever [Sun, 1 Jul 2007 16:13:59 +0000 (12:13 -0400)]
NFS: Add support for mounting NFSv4 file systems with string options

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Add final pieces to support in-kernel mount option parsing
Chuck Lever [Sun, 1 Jul 2007 16:13:54 +0000 (12:13 -0400)]
NFS: Add final pieces to support in-kernel mount option parsing

Hook in final components required for supporting in-kernel mount option
parsing for NFSv2 and NFSv3 mounts.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Introduce generic mount client API
Chuck Lever [Sun, 1 Jul 2007 16:13:49 +0000 (12:13 -0400)]
NFS: Introduce generic mount client API

For NFSv2 and v3 mounts, the first step is to contact the server's MOUNTD
and request the file handle for the root of the mounted share.  Add a
function to the NFS client that handles this operation.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Add enums and match tables for mount option parsing
Chuck Lever [Sun, 1 Jul 2007 16:13:44 +0000 (12:13 -0400)]
NFS: Add enums and match tables for mount option parsing

This generic infrastructure works for both NFS and NFSv4 mounts.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Improve debugging output in NFS in-kernel mount client
Chuck Lever [Sun, 1 Jul 2007 16:13:38 +0000 (12:13 -0400)]
NFS: Improve debugging output in NFS in-kernel mount client

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean up in-kernel NFS mount
Chuck Lever [Sun, 1 Jul 2007 16:13:33 +0000 (12:13 -0400)]
NFS: Clean up in-kernel NFS mount

Clean up white space and coding conventions.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Remake nfsroot_mount as a permanent part of NFS client
Chuck Lever [Sun, 1 Jul 2007 16:13:27 +0000 (12:13 -0400)]
NFS: Remake nfsroot_mount as a permanent part of NFS client

In preparation for supporting NFSv2 and NFSv3 mount option handling in the
kernel NFS client, convert mount_clnt.c to be a permanent part of the NFS
client, instead of built only when CONFIG_ROOT_NFS is enabled.

In addition, we also replace the "struct sockaddr_in *" argument with
something more generic, to help support IPv6 at some later point.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Add a convenient default for the hostname when calling rpc_create()
Chuck Lever [Sun, 1 Jul 2007 16:13:22 +0000 (12:13 -0400)]
SUNRPC: Add a convenient default for the hostname when calling rpc_create()

A couple of callers just use a stringified IP address for the rpc client's
hostname.  Move the logic for constructing this into rpc_create(), so it can
be shared.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Rename rpcb_getport to be consistent with new rpcb_getport_sync name
Chuck Lever [Sun, 1 Jul 2007 16:13:17 +0000 (12:13 -0400)]
SUNRPC: Rename rpcb_getport to be consistent with new rpcb_getport_sync name

Clean up, for consistency.  Rename rpcb_getport as rpcb_getport_async, to
match the naming scheme of rpcb_getport_sync.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Rename rpcb_getport_external routine
Chuck Lever [Sun, 1 Jul 2007 16:13:12 +0000 (12:13 -0400)]
SUNRPC: Rename rpcb_getport_external routine

In preparation for handling NFS mount option parsing in the kernel,
rename rpcb_getport_external as rpcb_get_port_sync, and make it available
always (instead of only when CONFIG_ROOT_NFS is enabled).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Allow rpcbind requests to be interrupted by a signal.
Chuck Lever [Sun, 1 Jul 2007 16:13:07 +0000 (12:13 -0400)]
SUNRPC: Allow rpcbind requests to be interrupted by a signal.

This allows NFS mount requests and RPC re-binding to be interruptible if the
server isn't responding.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Introduce nfs4_validate_mount_options
Chuck Lever [Sun, 1 Jul 2007 16:13:01 +0000 (12:13 -0400)]
NFS: Introduce nfs4_validate_mount_options

Refactor NFSv4 mount processing to break out mount data validation
in the same way it's broken out in the NFSv2/v3 mount path.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean up nfs_validate_mount_data
Chuck Lever [Sun, 1 Jul 2007 16:12:56 +0000 (12:12 -0400)]
NFS: Clean up nfs_validate_mount_data

Move error handling code out of the main code path.  The switch statement
was also improperly indented, according to Documentation/CodingStyle.  This
prepares nfs_validate_mount_data for the addition of option string parsing.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Add a new NFS debugging flag just for mount processing
Chuck Lever [Sun, 1 Jul 2007 16:12:51 +0000 (12:12 -0400)]
NFS: Add a new NFS debugging flag just for mount processing

Note to self: fix up /usr/sbin/rpcdebug too

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean-up: Refactor IP address sanity checks in NFS client
Chuck Lever [Sun, 1 Jul 2007 16:12:46 +0000 (12:12 -0400)]
NFS: Clean-up: Refactor IP address sanity checks in NFS client

NFS and NFSv4 mounts can now share server address sanity checking.  And, it
provides an easy mechanism for adding IPv6 address checking at some later
point.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean-up: fix a compiler warning in fs/nfs/super.c
Chuck Lever [Sun, 1 Jul 2007 16:12:40 +0000 (12:12 -0400)]
NFS: Clean-up: fix a compiler warning in fs/nfs/super.c

/home/cel/linux/fs/nfs/super.c: In function 'nfs_pseudoflavour_to_name':
/home/cel/linux/fs/nfs/super.c:270: warning: comparison between signed and unsigned

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean up error handling in nfs_get_sb
Chuck Lever [Sun, 1 Jul 2007 16:12:35 +0000 (12:12 -0400)]
NFS: Clean up error handling in nfs_get_sb

The error return logic in nfs_get_sb now matches nfs4_get_sb, and is more maintainable.
A subsequent patch will take advantage of this simplification.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean-up: Replace nfs_copy_user_string with strndup_user
Chuck Lever [Sun, 1 Jul 2007 16:12:30 +0000 (12:12 -0400)]
NFS: Clean-up: Replace nfs_copy_user_string with strndup_user

The new string utility function strndup_user can be used instead of
nfs_copy_user_string, eliminating an unnecessary duplication of function.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean-up: Define macros for maximum host and export path name lengths
Chuck Lever [Sun, 1 Jul 2007 16:12:24 +0000 (12:12 -0400)]
NFS: Clean-up: Define macros for maximum host and export path name lengths

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean-up: use correct type when converting NFS blocks to local blocks
Chuck Lever [Sun, 1 Jul 2007 16:12:19 +0000 (12:12 -0400)]
NFS: Clean-up: use correct type when converting NFS blocks to local blocks

inode->i_blocks is a blkcnt_t these days, which can be a u64 or unsigned
long, depending on the setting of CONFIG_LSF.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Clean up nfs_size_to_loff_t()
Chuck Lever [Sun, 1 Jul 2007 16:12:14 +0000 (12:12 -0400)]
NFS: Clean up nfs_size_to_loff_t()

Use the same file size limit that lockd uses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix up stateid locking...
Trond Myklebust [Mon, 9 Jul 2007 14:45:42 +0000 (10:45 -0400)]
NFSv4: Fix up stateid locking...

We really don't need to grab both the state->so_owner and the
inode->i_lock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Clean up the callers of nfs4_open_recover_helper()
Trond Myklebust [Mon, 9 Jul 2007 01:04:15 +0000 (21:04 -0400)]
NFSv4: Clean up the callers of nfs4_open_recover_helper()

Rely on nfs4_try_open_cached() when appropriate.

Also fix an RCU violation in _nfs4_do_open_reclaim()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Don't call OPEN if we already have an open stateid for a file
Trond Myklebust [Sun, 8 Jul 2007 18:11:36 +0000 (14:11 -0400)]
NFSv4: Don't call OPEN if we already have an open stateid for a file

If we already have a stateid with the correct open mode for a given file,
then we can reuse that stateid instead of re-issuing an OPEN call without
violating the close-to-open caching semantics.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Check for the existence of a delegation in nfs4_open_prepare()
Trond Myklebust [Thu, 5 Jul 2007 23:02:21 +0000 (19:02 -0400)]
NFSv4: Check for the existence of a delegation in nfs4_open_prepare()

We should not be calling open() on an inode that has a delegation unless
we're doing a reclaim.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Clean up _nfs4_proc_open()
Trond Myklebust [Sat, 7 Jul 2007 17:19:59 +0000 (13:19 -0400)]
NFSv4: Clean up _nfs4_proc_open()

Use a flag instead of the 'data->rpc_status = -ENOMEM hack.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Allow nfs4_opendata_to_nfs4_state to return errors.
Trond Myklebust [Sat, 7 Jul 2007 12:04:47 +0000 (08:04 -0400)]
NFSv4: Allow nfs4_opendata_to_nfs4_state to return errors.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Improve the debugging of bad sequence id errors...
Trond Myklebust [Sun, 8 Jul 2007 20:49:11 +0000 (16:49 -0400)]
NFSv4: Improve the debugging of bad sequence id errors...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Always use the delegation if we have one
Trond Myklebust [Thu, 5 Jul 2007 22:07:55 +0000 (18:07 -0400)]
NFSv4: Always use the delegation if we have one

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Clean up confirmation of sequence ids...
Trond Myklebust [Sun, 8 Jul 2007 20:19:56 +0000 (16:19 -0400)]
NFSv4: Clean up confirmation of sequence ids...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Defer inode revalidation when setting up a delegation
Trond Myklebust [Tue, 3 Jul 2007 20:10:55 +0000 (16:10 -0400)]
NFSv4: Defer inode revalidation when setting up a delegation

Currently we force a synchronous call to __nfs_revalidate_inode() in
nfs_inode_set_delegation(). This not only ensures that we cannot call
nfs_inode_set_delegation from an asynchronous context, but it also slows
down any call to open().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Use RCU to protect delegations
Trond Myklebust [Fri, 6 Jul 2007 19:12:04 +0000 (15:12 -0400)]
NFSv4: Use RCU to protect delegations

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Support recalling delegations by stateid part 2
Trond Myklebust [Fri, 6 Jul 2007 19:10:43 +0000 (15:10 -0400)]
NFSv4: Support recalling delegations by stateid part 2

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Support recalling delegations by stateid
Trond Myklebust [Thu, 5 Jul 2007 18:55:18 +0000 (14:55 -0400)]
NFSv4: Support recalling delegations by stateid

There appear to be some rogue servers out there that issue multiple
delegations with different stateids for the same file. Ensure that when we
return delegations, we do so on a per-stateid basis rather than a per-file
basis.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix up a bug in nfs4_open_recover()
Trond Myklebust [Wed, 4 Jul 2007 03:48:13 +0000 (23:48 -0400)]
NFSv4: Fix up a bug in nfs4_open_recover()

Don't clobber the delegation info...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: set the delegation in nfs4_opendata_to_nfs4_state
Trond Myklebust [Tue, 3 Jul 2007 20:42:45 +0000 (16:42 -0400)]
NFSv4: set the delegation in nfs4_opendata_to_nfs4_state

This ensures that nfs4_open_release() and nfs4_open_confirm_release()
can now handle an eventual delegation that was returned with out open.
As such, it fixes a delegation "leak" when the user breaks out of an open
call.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix a bug in __nfs4_find_state_byowner
Trond Myklebust [Tue, 3 Jul 2007 18:41:19 +0000 (14:41 -0400)]
NFSv4: Fix a bug in __nfs4_find_state_byowner

The test for state->state == 0 does not tell you that the stateid is in the
process of being freed. It really tells you that the stateid is not yet
initialised...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix atomic open for execute...
Trond Myklebust [Tue, 3 Jul 2007 17:04:56 +0000 (13:04 -0400)]
NFSv4: Fix atomic open for execute...

Currently we do not check for the FMODE_EXEC flag as we should. For that
particular case, we need to perform an ACCESS call to the server in order
to check that the file is executable.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Reduce the chances of an open_owner identifier collision
Trond Myklebust [Mon, 2 Jul 2007 17:58:33 +0000 (13:58 -0400)]
NFSv4: Reduce the chances of an open_owner identifier collision

Currently we just use a 32-bit counter.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: nfs_increment_open_seqid should not return a value
Trond Myklebust [Mon, 2 Jul 2007 18:03:03 +0000 (14:03 -0400)]
NFSv4: nfs_increment_open_seqid should not return a value

It is a void function...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix underestimate of NFSv4 lookup request size
Trond Myklebust [Mon, 2 Jul 2007 17:58:30 +0000 (13:58 -0400)]
NFSv4: Fix underestimate of NFSv4 lookup request size

Also fix up the underestimate of fs_locations

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix the underestimate of NFSv4 open request size
Trond Myklebust [Mon, 2 Jul 2007 17:57:28 +0000 (13:57 -0400)]
NFSv4: Fix the underestimate of NFSv4 open request size

The maximum size depends on the filename size and a number of other
elements which are currently not being counted.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix the NFSv4 owner and owner_group size estimates
Trond Myklebust [Sun, 8 Jul 2007 22:38:23 +0000 (18:38 -0400)]
NFSv4: Fix the NFSv4 owner and owner_group size estimates

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Don't reuse expired nfs4_state_owner structs
Trond Myklebust [Mon, 2 Jul 2007 16:49:23 +0000 (12:49 -0400)]
NFSv4: Don't reuse expired nfs4_state_owner structs

That just confuses certain NFSv4 servers.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Fix a credential reference leak in nfs4_get_state_owner()
Trond Myklebust [Mon, 2 Jul 2007 14:24:56 +0000 (10:24 -0400)]
NFSv4: Fix a credential reference leak in nfs4_get_state_owner()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Replace NFS_I(inode)->req_lock with inode->i_lock
Trond Myklebust [Mon, 2 Jul 2007 13:57:54 +0000 (09:57 -0400)]
NFS: Replace NFS_I(inode)->req_lock with inode->i_lock

There is no justification for keeping a special spinlock for the exclusive
use of the NFS writeback code.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Clean up _nfs4_proc_lookup() vs _nfs4_proc_lookupfh()
Trond Myklebust [Sun, 1 Jul 2007 22:13:52 +0000 (18:13 -0400)]
NFSv4: Clean up _nfs4_proc_lookup() vs _nfs4_proc_lookupfh()

They differ only slightly in the arguments they take. Why have they not
been merged?

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Suppress some noisy and unnecessary printk() calls in call_verify()
Trond Myklebust [Wed, 27 Jun 2007 22:30:26 +0000 (18:30 -0400)]
SUNRPC: Suppress some noisy and unnecessary printk() calls in call_verify()

Convert them into dprintk() calls.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Ensure RPCSEC_GSS destroys the security context when freeing a cred
Trond Myklebust [Tue, 26 Jun 2007 21:04:57 +0000 (17:04 -0400)]
SUNRPC: Ensure RPCSEC_GSS destroys the security context when freeing a cred

Do so by set the gc_proc field to RPC_GSS_PROC_DESTROY, and then sending a
NULL RPC call.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Ensure that the struct gss_auth lifetime exceeds the credential's
Trond Myklebust [Wed, 27 Jun 2007 18:29:12 +0000 (14:29 -0400)]
SUNRPC: Ensure that the struct gss_auth lifetime exceeds the credential's

Add a refcount in order to ensure that the gss_auth doesn't disappear from
underneath us while we're freeing up GSS contexts.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Remove the tk_auth macro...
Trond Myklebust [Wed, 27 Jun 2007 18:29:04 +0000 (14:29 -0400)]
SUNRPC: Remove the tk_auth macro...

We should almost always be deferencing the rpc_auth struct by means of the
credential's cr_auth field instead of the rpc_clnt->cl_auth anyway. Fix up
that historical mistake, and remove the macro that propagated it.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Allow rpc_auth to run clean up before the rpc_client is destroyed
Trond Myklebust [Tue, 26 Jun 2007 20:57:41 +0000 (16:57 -0400)]
SUNRPC: Allow rpc_auth to run clean up before the rpc_client is destroyed

RPCSEC_GSS needs to be able to send NULL RPC calls to the server in order
to free up any remaining GSS contexts.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Convert gss_ctx_lock to an RCU lock
Trond Myklebust [Tue, 26 Jun 2007 23:18:38 +0000 (19:18 -0400)]
SUNRPC: Convert gss_ctx_lock to an RCU lock

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Convert the credential garbage collector into a shrinker callback
Trond Myklebust [Mon, 25 Jun 2007 21:11:20 +0000 (17:11 -0400)]
SUNRPC: Convert the credential garbage collector into a shrinker callback

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Give credential cache a local spinlock
Trond Myklebust [Sun, 24 Jun 2007 19:57:57 +0000 (15:57 -0400)]
SUNRPC: Give credential cache a local spinlock

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Convert the credcache lookup code to use RCU
Trond Myklebust [Sun, 24 Jun 2007 19:55:26 +0000 (15:55 -0400)]
SUNRPC: Convert the credcache lookup code to use RCU

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: cleanup rpc credential cache garbage collection
Trond Myklebust [Sat, 23 Jun 2007 23:45:36 +0000 (19:45 -0400)]
SUNRPC: cleanup rpc credential cache garbage collection

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Enforce atomic updates of rpc_cred->cr_flags
Trond Myklebust [Mon, 25 Jun 2007 14:15:15 +0000 (10:15 -0400)]
SUNRPC: Enforce atomic updates of rpc_cred->cr_flags

Convert to the use of atomic bitops...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: replace casts in auth_unix.c with container_of()
Trond Myklebust [Mon, 25 Jun 2007 13:48:25 +0000 (09:48 -0400)]
SUNRPC: replace casts in auth_unix.c with container_of()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Clean up rpc credential initialisation
Trond Myklebust [Sat, 23 Jun 2007 23:55:31 +0000 (19:55 -0400)]
SUNRPC: Clean up rpc credential initialisation

Add a helper rpc_cred_init()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Mark auth and cred operation tables as constant.
Trond Myklebust [Sun, 24 Jun 2007 00:17:58 +0000 (20:17 -0400)]
SUNRPC: Mark auth and cred operation tables as constant.

Also do the same for gss_api operation tables.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Rename rpcauth_destroy() to rpcauth_release()
Trond Myklebust [Sat, 23 Jun 2007 14:46:47 +0000 (10:46 -0400)]
SUNRPC: Rename rpcauth_destroy() to rpcauth_release()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Add the helper function 'rpc_call_null()'
Trond Myklebust [Sat, 23 Jun 2007 14:17:16 +0000 (10:17 -0400)]
SUNRPC: Add the helper function 'rpc_call_null()'

Does a NULL RPC call and returns a pointer to the resulting rpc_task. The
call may be either synchronous or asynchronous.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Make rpc_ping() static
Trond Myklebust [Sat, 23 Jun 2007 14:17:16 +0000 (10:17 -0400)]
SUNRPC: Make rpc_ping() static

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Fix races in rpcauth_create
Trond Myklebust [Sat, 9 Jun 2007 20:15:46 +0000 (16:15 -0400)]
SUNRPC: Fix races in rpcauth_create

See the FIXME: auth_flavors[] really needs a lock and module refcounting.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Fix a memory leak in gss_create()
Trond Myklebust [Sat, 9 Jun 2007 19:42:01 +0000 (15:42 -0400)]
SUNRPC: Fix a memory leak in gss_create()

Fix a memory leak in gss_create() whereby the rpc credcache was not being
freed if the rpc_mkpipe() call failed.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Fix a typo in unx_create()
Trond Myklebust [Sun, 24 Jun 2007 19:24:29 +0000 (15:24 -0400)]
SUNRPC: Fix a typo in unx_create()

We want to set the unix_cred_cache.nextgc on the first call to
unx_create(), which should be when unix_auth.au_count === 1

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Fix a memory leak in the auth credcache code
Trond Myklebust [Sat, 9 Jun 2007 19:41:42 +0000 (15:41 -0400)]
SUNRPC: Fix a memory leak in the auth credcache code

The leak only affects the RPCSEC_GSS caches, since they are the only ones
that are dynamically allocated...
Rename the existing rpcauth_free_credcache() to rpcauth_clear_credcache()
in order to better describe its role, then add a new function
rpcauth_destroy_credcache() that actually frees the cache in addition to
clearing it out.

Also move the call to destroy the credcache in gss_destroy() to come before
the rpc upcall pipe is unlinked.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Add a field to track the number of kernel users of an rpc_pipe
Trond Myklebust [Fri, 8 Jun 2007 18:14:53 +0000 (14:14 -0400)]
SUNRPC: Add a field to track the number of kernel users of an rpc_pipe

This allows us to correctly deduce when we need to remove the pipe.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Clean up rpc_pipefs.
Trond Myklebust [Fri, 8 Jun 2007 18:14:46 +0000 (14:14 -0400)]
SUNRPC: Clean up rpc_pipefs.

Add a dentry_ops with a d_delete() method in order to ensure that dentries
are removed as soon as the last reference is gone.

Clean up rpc_depopulate() so that it only removes files that were created
via rpc_populate().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Enable non-exclusive create in rpc_mkpipe()
Trond Myklebust [Thu, 7 Jun 2007 22:28:02 +0000 (18:28 -0400)]
SUNRPC: Enable non-exclusive create in rpc_mkpipe()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Add a downcall queue to struct rpc_inode
Trond Myklebust [Thu, 7 Jun 2007 19:31:36 +0000 (15:31 -0400)]
SUNRPC: Add a downcall queue to struct rpc_inode

Currently, the downcall queue is tied to the struct gss_auth, which means
that different RPCSEC_GSS pseudoflavours must use different upcall pipes.
Add a list to struct rpc_inode that can be used instead.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Always match an upcall message in gss_pipe_downcall()
Trond Myklebust [Thu, 7 Jun 2007 14:14:15 +0000 (10:14 -0400)]
SUNRPC: Always match an upcall message in gss_pipe_downcall()

It used to be possible for an rpc.gssd daemon to stuff the RPC credential
cache for any rpc client simply by creating RPCSEC_GSS contexts and then
doing downcalls. In practice, no daemons ever made use of this feature.

Remove this feature now, since it will be impossible to figure out which
mechanism a given context actually matches if we enable more
than one gss mechanism to use the same upcall pipe.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Remove the gss_auth spinlock
Trond Myklebust [Thu, 7 Jun 2007 14:14:14 +0000 (10:14 -0400)]
SUNRPC: Remove the gss_auth spinlock

We're just as well off using the inode spinlock instead.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Add a backpointer from the struct rpc_cred to the rpc_auth
Trond Myklebust [Thu, 7 Jun 2007 14:14:14 +0000 (10:14 -0400)]
SUNRPC: Add a backpointer from the struct rpc_cred to the rpc_auth

Cleans up an issue whereby rpcsec_gss uses the rpc_clnt->cl_auth. If we want
to be able to add several rpc_auths to a single rpc_clnt, then this abuse
must go.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: fix hang due to eventd deadlock...
Trond Myklebust [Thu, 14 Jun 2007 22:00:42 +0000 (18:00 -0400)]
SUNRPC: fix hang due to eventd deadlock...

Brian Behlendorf writes:

The root cause of the NFS hang we were observing appears to be a rare
deadlock between the kernel provided usermodehelper API and the linux NFS
client.  The deadlock can arise because both of these services use the
generic linux work queues.  The usermodehelper API run the specified user
application in the context of the work queue.  And NFS submits both cleanup
and reconnect work to the generic work queue for handling.  Normally this
is fine but a deadlock can result in the following situation.

  - NFS client is in a disconnected state
  - [events/0] runs a usermodehelper app with an NFS dependent operation,
    this triggers an NFS reconnect.
  - NFS reconnect happens to be submitted to [events/0] work queue.
  - Deadlock, the [events/0] work queue will never process the
    reconnect because it is blocked on the previous NFS dependent
    operation which will not complete.`

The solution is simply to run reconnect requests on rpciod.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: clean up rpc_call_async/rpc_call_sync/rpc_run_task
Trond Myklebust [Tue, 12 Jun 2007 14:02:37 +0000 (10:02 -0400)]
SUNRPC: clean up rpc_call_async/rpc_call_sync/rpc_run_task

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Move rpc_register_client and friends into net/sunrpc/clnt.c
Trond Myklebust [Sat, 16 Jun 2007 18:18:40 +0000 (14:18 -0400)]
SUNRPC: Move rpc_register_client and friends into net/sunrpc/clnt.c

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Remove redundant calls to rpciod_up()/rpciod_down()
Trond Myklebust [Thu, 14 Jun 2007 21:31:58 +0000 (17:31 -0400)]
SUNRPC: Remove redundant calls to rpciod_up()/rpciod_down()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Make create_client() take a reference to the rpciod workqueue
Trond Myklebust [Thu, 14 Jun 2007 21:26:17 +0000 (17:26 -0400)]
SUNRPC: Make create_client() take a reference to the rpciod workqueue

Ensures that an rpc_client always has the possibility to send asynchronous
RPC calls.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Optimise rpciod_up()
Trond Myklebust [Thu, 14 Jun 2007 21:08:36 +0000 (17:08 -0400)]
SUNRPC: Optimise rpciod_up()

Instead of taking the mutex every time we just need to increment/decrement
rpciod_users, we can optmise by using atomic_inc_not_zero and
atomic_dec_and_test.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Don't create an rpc_pipefs directory before rpc_clone is initialised
Trond Myklebust [Sun, 17 Jun 2007 21:07:54 +0000 (17:07 -0400)]
SUNRPC: Don't create an rpc_pipefs directory before rpc_clone is initialised

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Remove rpc_clnt->cl_count
Trond Myklebust [Thu, 14 Jun 2007 20:40:32 +0000 (16:40 -0400)]
SUNRPC: Remove rpc_clnt->cl_count

The kref now does most of what cl_count + cl_user used to do. The only
remaining role for cl_count is to tell us if we are in a 'shutdown'
phase. We can provide that information using a single bit field instead
of a full atomic counter.

Also rename rpc_destroy_client() to rpc_close_client(), which reflects
better what its role is these days.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Make rpc_clone take a reference instead of using cl_count
Trond Myklebust [Thu, 14 Jun 2007 20:40:32 +0000 (16:40 -0400)]
SUNRPC: Make rpc_clone take a reference instead of using cl_count

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Kill rpc_clnt->cl_oneshot
Trond Myklebust [Sat, 9 Jun 2007 23:49:36 +0000 (19:49 -0400)]
SUNRPC: Kill rpc_clnt->cl_oneshot

Replace it with explicit calls to rpc_shutdown_client() or
rpc_destroy_client() (for the case of asynchronous calls).

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Kill rpc_clnt->cl_dead
Trond Myklebust [Sat, 9 Jun 2007 23:39:12 +0000 (19:39 -0400)]
SUNRPC: Kill rpc_clnt->cl_dead

Its use is at best racy, and there is only one user (lockd), which has
additional locking that makes the whole thing redundant.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Convert rpc_clnt->cl_users to a kref
Trond Myklebust [Thu, 14 Jun 2007 20:40:31 +0000 (16:40 -0400)]
SUNRPC: Convert rpc_clnt->cl_users to a kref

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Clean up tk_pid allocation and make it lockless
Trond Myklebust [Sat, 16 Jun 2007 18:17:01 +0000 (14:17 -0400)]
SUNRPC: Clean up tk_pid allocation and make it lockless

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Add a per-rpc_clnt spinlock
Trond Myklebust [Sat, 16 Jun 2007 18:17:01 +0000 (14:17 -0400)]
SUNRPC: Add a per-rpc_clnt spinlock

Use that to protect the rpc_clnt->cl_tasks list instead of using a global
lock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoSUNRPC: Move rpc_task->tk_task list into struct rpc_clnt
Trond Myklebust [Thu, 14 Jun 2007 20:40:14 +0000 (16:40 -0400)]
SUNRPC: Move rpc_task->tk_task list into struct rpc_clnt

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFSv4: Convert struct nfs4_opendata to use struct kref
Trond Myklebust [Sun, 17 Jun 2007 20:02:44 +0000 (16:02 -0400)]
NFSv4: Convert struct nfs4_opendata to use struct kref

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Convert struct nfs_open_context to use a kref
Trond Myklebust [Sun, 17 Jun 2007 20:02:44 +0000 (16:02 -0400)]
NFS: Convert struct nfs_open_context to use a kref

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: reduce latency by using conditional rescheduling in nfs_scan_list
Trond Myklebust [Sun, 17 Jun 2007 20:02:34 +0000 (16:02 -0400)]
NFS: reduce latency by using conditional rescheduling in nfs_scan_list

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 years agoNFS: Prevent integer overflow in nfs_scan_list()
Trond Myklebust [Sun, 17 Jun 2007 19:47:53 +0000 (15:47 -0400)]
NFS: Prevent integer overflow in nfs_scan_list()

Also ensure that nfs_inode ncommit and npages are large enough to represent
all possible values for the number of pages.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>