GitHub/mt8127/android_kernel_alcatel_ttab.git
12 years agoSUNRPC: check RPC inode's pipe reference before dereferencing
Stanislav Kinsbursky [Mon, 27 Feb 2012 18:05:45 +0000 (22:05 +0400)]
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>
12 years agoNFS: release per-net clients lock before calling PipeFS dentries creation
Stanislav Kinsbursky [Mon, 27 Feb 2012 18:05:37 +0000 (22:05 +0400)]
NFS: release per-net clients lock before calling PipeFS dentries creation

v3:
1) Lookup for client is performed from the beginning of the list on each PipeFS
event handling operation.

Lockdep is sad otherwise, because inode mutex is taken on PipeFS dentry
creation, which can be called on mount notification, where this per-net client
lock is taken on clients list walk.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: release per-net clients lock before calling PipeFS dentries creation
Stanislav Kinsbursky [Mon, 27 Feb 2012 18:05:29 +0000 (22:05 +0400)]
SUNRPC: release per-net clients lock before calling PipeFS dentries creation

v3:
1) Lookup for client is performed from the beginning of the list on each PipeFS
event handling operation.

Lockdep is sad otherwise, because inode mutex is taken on PipeFS dentry
creation, which can be called on mount notification, where this per-net client
lock is taken on clients list walk.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4.1: Don't call nfs4_deviceid_purge_client() unless we're NFSv4.1
Trond Myklebust [Sun, 26 Feb 2012 22:34:22 +0000 (17:34 -0500)]
NFSv4.1: Don't call nfs4_deviceid_purge_client() unless we're NFSv4.1

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Ensure struct nfs_client holds a reference to the net namespace
Trond Myklebust [Sun, 19 Feb 2012 07:46:49 +0000 (08:46 +0100)]
NFS: Ensure struct nfs_client holds a reference to the net namespace

Otherwise we have no guarantee that the net namespace won't just
disappear from underneath us once the task that created it
is destroyed.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
12 years agoNFS: Ensure that the nfs_client 'net' field is always set
Trond Myklebust [Sun, 19 Feb 2012 07:44:07 +0000 (08:44 +0100)]
NFS: Ensure that the nfs_client 'net' field is always set

Currently, the nfs_parsed_mount_data->net field is initialised in
the nfs_parse_mount_options() function, which means that it only
gets set if we're using text based mounts. The legacy binary
mount interface is therefore broken.

Fix is to initialise the ->net field in nfs_alloc_parsed_mount_data.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
12 years agoNFS: include filelayout DS rpc stats in mountstats
Weston Andros Adamson [Fri, 17 Feb 2012 18:15:24 +0000 (13:15 -0500)]
NFS: include filelayout DS rpc stats in mountstats

Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
filelayout mounts.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4.1 set highest_used_slotid to NFS4_NO_SLOT
Andy Adamson [Fri, 17 Feb 2012 18:05:23 +0000 (13:05 -0500)]
NFSv4.1 set highest_used_slotid to NFS4_NO_SLOT

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agonfs: Clean up debugging in nfs_follow_mountpoint()
Chuck Lever [Wed, 15 Feb 2012 21:35:17 +0000 (16:35 -0500)]
nfs: Clean up debugging in nfs_follow_mountpoint()

Clean up: Fix a debugging message which had an obsolete function name
in it (nfs_follow_mountpoint).

Introduced by commit 36d43a43 "NFS: Use d_automount() rather than
abusing follow_link()" (January 14, 2011)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Use KERN_DEFAULT for debugging printk's
Chuck Lever [Wed, 15 Feb 2012 21:35:08 +0000 (16:35 -0500)]
SUNRPC: Use KERN_DEFAULT for debugging printk's

Our dprintk() debugging facility doesn't specify any verbosity level
for it's printk() calls, but it should.

The default verbosity for printk's is KERN_DEFAULT.  You might argue
that these are debugging printk's and thus the verbosity should be
KERN_DEBUG.  That would mean that to see NFS and SUNRPC debugging
output an admin would also have to boost the syslog verbosity, which
would be insufferably noisy.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: add sending,pending queue and max slot to xprt stats
Andy Adamson [Tue, 14 Feb 2012 21:19:18 +0000 (16:19 -0500)]
SUNRPC: add sending,pending queue and max slot to xprt stats

With static RPC slots, the xprt backlog queue stats were useful in showing
when the transport (TCP) was starved by lack of RPC slots. The new dynamic
RPC slot code, commit d9ba131d8f58c0d2ff5029e7002ab43f913b36f9, always
provides an RPC slot and so only uses the xprt backlog queue when the
tcp_max_slot_table_entries value has been hit or when an allocation error
occurs. All requests are now placed on the xprt sending or pending queue which
need to be monitored for debugging.

The max_slot stat shows the maximum number of dynamic RPC slots reached which is
useful when debugging performance issues.

Add the new fields at the end of the mountstats xprt stanza so that mountstats
outputs the previous correct values and ignores the new fields. Bump
NFS_IOSTATS_VERS.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: init per-net rpcbind spinlock
Stanislav Kinsbursky [Thu, 16 Feb 2012 13:42:12 +0000 (17:42 +0400)]
SUNRPC: init per-net rpcbind spinlock

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agonfs41: Verify channel's attributes accordingly to RFC v2
Vitaliy Gusev [Wed, 15 Feb 2012 15:38:25 +0000 (19:38 +0400)]
nfs41: Verify channel's attributes accordingly to RFC v2

 ca_maxoperations:

      For the backchannel, the server MUST
      NOT change the value the client offers.  For the fore channel,
      the server MAY change the requested value.

  ca_maxrequests:

       For the backchannel, the server MUST NOT change the
       value the client offers.  For the fore channel, the server MAY
       change the requested value.

Signed-off-by: Vitaliy Gusev <gusev.vitaliy@nexenta.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: dont allow minorversion= opt when vers != 4
Weston Andros Adamson [Wed, 1 Feb 2012 19:06:41 +0000 (14:06 -0500)]
NFS: dont allow minorversion= opt when vers != 4

Don't allow invalid 'vers' and 'minorversion' combinations in mount options,
such as "vers=3,minorversion=1".

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Ensure that we can trace waitqueues when !defined(CONFIG_SYSCTL)
Trond Myklebust [Thu, 9 Feb 2012 03:01:15 +0000 (22:01 -0500)]
SUNRPC: Ensure that we can trace waitqueues when !defined(CONFIG_SYSCTL)

The tracepoint code relies on the queue->name being defined in order to
be able to display the name of the waitqueue on which an RPC task is
sleeping.

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
12 years agoNFSv4: Further reduce the footprint of the idmapper
Trond Myklebust [Wed, 8 Feb 2012 18:39:15 +0000 (13:39 -0500)]
NFSv4: Further reduce the footprint of the idmapper

Don't allocate the legacy idmapper tables until we actually need
them.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
12 years agoNFSv4: The idmapper now depends on keyring functionality
Trond Myklebust [Wed, 8 Feb 2012 18:21:38 +0000 (13:21 -0500)]
NFSv4: The idmapper now depends on keyring functionality

Add the appropriate 'select KEYS' to the NFSv4 Kconfig entry.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Reduce the footprint of the idmapper
Trond Myklebust [Tue, 7 Feb 2012 19:59:05 +0000 (14:59 -0500)]
NFSv4: Reduce the footprint of the idmapper

Instead of pre-allocating the storage for all the strings, we can
significantly reduce the size of that table by doing the allocation
when we do the downcall.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
12 years agoNFS: add mount options 'v4.0' and 'v4.1'
Weston Andros Adamson [Tue, 7 Feb 2012 16:49:11 +0000 (11:49 -0500)]
NFS: add mount options 'v4.0' and 'v4.1'

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: fix nfs4_find_client_sessionid() arguments list
Stanislav Kinsbursky [Tue, 7 Feb 2012 15:53:19 +0000 (19:53 +0400)]
NFS: fix nfs4_find_client_sessionid() arguments list

It's not compilable in case of CONFIG_NFS_V4_1 is not set.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Initialise the nfs_net->nfs_client_lock
Trond Myklebust [Tue, 7 Feb 2012 05:05:11 +0000 (00:05 -0500)]
NFS: Initialise the nfs_net->nfs_client_lock

Ensure that we initialise the nfs_net->nfs_client_lock spinlock.
Also ensure that nfs_server_remove_lists() doesn't try to
dereference server->nfs_client before that is initialised.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
12 years agoLockd: shutdown NLM hosts in network namespace context
Stanislav Kinsbursky [Tue, 31 Jan 2012 11:08:29 +0000 (15:08 +0400)]
Lockd: shutdown NLM hosts in network namespace context

Lockd now managed in network namespace context. And this patch introduces
network namespace related NLM hosts shutdown in case of releasing per-net Lockd
resources.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoLockD: make NSM network namespace aware
Stanislav Kinsbursky [Tue, 31 Jan 2012 11:08:21 +0000 (15:08 +0400)]
LockD: make NSM network namespace aware

NLM host is network namespace aware now.
So NSM have to take it into account.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoLockD: make nlm hosts network namespace aware
Stanislav Kinsbursky [Tue, 31 Jan 2012 11:08:13 +0000 (15:08 +0400)]
LockD: make nlm hosts network namespace aware

This object depends on RPC client, and thus on network namespace.
So let's make it's allocation and lookup in network namespace context.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoLockd: per-net up and down routines introduced
Stanislav Kinsbursky [Tue, 31 Jan 2012 11:08:05 +0000 (15:08 +0400)]
Lockd: per-net up and down routines introduced

This patch introduces per-net Lockd initialization and destruction routines.
The logic is the same as in global Lockd up and down routines. Probably the
solution is not the best one. But at least it looks clear.
So per-net "up" routine are called only in case of lockd is running already. If
per-net resources are not allocated yet, then service is being registered with
local portmapper and lockd sockets created.
Per-net "down" routine is called on every lockd_down() call in case of global
users counter is not zero.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoLockd: pernet usage counter introduced
Stanislav Kinsbursky [Tue, 31 Jan 2012 11:07:57 +0000 (15:07 +0400)]
Lockd: pernet usage counter introduced

Lockd is going to be shared between network namespaces - i.e. going to be able
to handle lock requests from different network namespaces. This means, that
network namespace related resources have to be allocated not once (like now),
but for every network namespace context, from which service is requested to
operate.
This patch implements Lockd per-net users accounting. New per-net counter is
used to determine, when per-net resources have to be freed.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoLockd: create permanent lockd sockets in current network namespace
Stanislav Kinsbursky [Tue, 31 Jan 2012 11:07:48 +0000 (15:07 +0400)]
Lockd: create permanent lockd sockets in current network namespace

This patch parametrizes Lockd permanent sockets creation routine by network
namespace context.
It also replaces hard-coded init_net with current network namespace context in
Lockd sockets creation routines.
This approach looks safe, because Lockd is created during NFS mount (or NFS
server start) and thus socket is required exactly in current network namespace
context. But in the same time it means, that Lockd sockets inherits first Lockd
requester network namespace. This issue will be fixed in further patches of the
series.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: service shutdown function in network namespace context introduced
Stanislav Kinsbursky [Tue, 31 Jan 2012 10:09:25 +0000 (14:09 +0400)]
SUNRPC: service shutdown function in network namespace context introduced

This function is enough for releasing resources, allocated for network
namespace context, in case of sharing service between them.
IOW, each service "user" (LockD, NFSd, etc), which wants to share service
between network namespaces, have to release related resources by the function,
introduced in this patch, instead of performing service shutdown (of course in
case the service is shared already to the moment of release).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: service destruction in network namespace context
Stanislav Kinsbursky [Tue, 31 Jan 2012 10:09:17 +0000 (14:09 +0400)]
SUNRPC: service destruction in network namespace context

v2: Added comment to BUG_ON's in svc_destroy() to make code looks clearer.

This patch introduces network namespace filter for service destruction
function.
Nothing special here - just do exactly the same operations, but only for
tranports in passed networks namespace context.
BTW, BUG_ON() checks for empty service transports lists were returned into
svc_destroy() function. This is because of swithing generic svc_close_all() to
networks namespace dependable svc_close_net().

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: clear svc transports lists helper introduced
Stanislav Kinsbursky [Tue, 31 Jan 2012 10:09:08 +0000 (14:09 +0400)]
SUNRPC: clear svc transports lists helper introduced

This patch moves service transports deletion from service sockets lists to
separated function.
This is a precursor patch, which would be usefull with service shutdown in
network namespace context, introduced later in the series.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: clear svc pools lists helper introduced
Stanislav Kinsbursky [Tue, 31 Jan 2012 10:09:00 +0000 (14:09 +0400)]
SUNRPC: clear svc pools lists helper introduced

This patch moves removing of service transport from it's pools ready lists to
separated function. Also this clear is now done with list_for_each_entry_safe()
helper.
This is a precursor patch, which would be usefull with service shutdown in
network namespace context, introduced later in the series.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4.1: Add a module parameter to set the number of session slots
Trond Myklebust [Tue, 7 Feb 2012 00:50:40 +0000 (19:50 -0500)]
NFSv4.1: Add a module parameter to set the number of session slots

Add the module parameter 'max_session_slots' to set the initial number
of slots that the NFSv4.1 client will attempt to negotiate with the
server.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4.1: Convert slotid from u8 to u32
Trond Myklebust [Tue, 7 Feb 2012 00:38:51 +0000 (19:38 -0500)]
NFSv4.1: Convert slotid from u8 to u32

It is perfectly legal to negotiate up to 2^32-1 slots in the protocol,
and with 10GigE, we are already seeing that 255 slots is far too limiting.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: build fixed in case of NFS_USE_NEW_IDMAPPER is undefined
Stanislav Kinsbursky [Thu, 26 Jan 2012 11:11:41 +0000 (15:11 +0400)]
NFS: build fixed in case of NFS_USE_NEW_IDMAPPER is undefined

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: pass transport net to rpc_pton() while parse server name
Stanislav Kinsbursky [Thu, 26 Jan 2012 11:12:05 +0000 (15:12 +0400)]
NFS: pass transport net to rpc_pton() while parse server name

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: pass current net to rpc_pton() while parsing mount options
Stanislav Kinsbursky [Thu, 26 Jan 2012 11:11:57 +0000 (15:11 +0400)]
NFS: pass current net to rpc_pton() while parsing mount options

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: search for client session id in proper network namespace
Stanislav Kinsbursky [Thu, 26 Jan 2012 11:11:49 +0000 (15:11 +0400)]
NFS: search for client session id in proper network namespace

Network namespace is taken from request transport and passed as a part of
cb_process_state structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: pass proper net rpc_pton() in nfs_dns_resolve_name()
Stanislav Kinsbursky [Thu, 26 Jan 2012 11:11:33 +0000 (15:11 +0400)]
NFS: pass proper net rpc_pton() in nfs_dns_resolve_name()

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: make nfs_client_lock per net ns
Stanislav Kinsbursky [Mon, 23 Jan 2012 17:26:31 +0000 (17:26 +0000)]
NFS: make nfs_client_lock per net ns

This patch makes nfs_clients_lock allocated per network namespace. All items it
protects are already network namespace aware.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: make cb_ident_idr per net ns
Stanislav Kinsbursky [Mon, 23 Jan 2012 17:26:22 +0000 (17:26 +0000)]
NFS: make cb_ident_idr per net ns

This patch makes ID's infrastructure network namespace aware. This was done
mainly because of nfs_client_lock, which is desired to be per network
namespace, but protects NFS clients ID's.

NOTE: NFS client's net pointer have to be set prior to ID initialization,
proper assignment was moved.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: make nfs_volume_list per net ns
Stanislav Kinsbursky [Mon, 23 Jan 2012 17:26:14 +0000 (17:26 +0000)]
NFS: make nfs_volume_list per net ns

This patch splits global list of NFS servers into per-net-ns array of lists.
This looks more strict and clearer.
BTW, this patch also makes "/proc/fs/nfsfs/volumes" content depends on /proc
mount owner pid namespace. See below for details.

NOTE: few words about how was /proc/fs/nfsfs/ entries content show per network
namespace done. This is a little bit tricky and not the best is could be. But
it's cheap (proper fix for /proc conteinerization is a hard nut to crack).
The idea is simple: take proper network namespace from pid namespace
child reaper nsproxy of /proc/ mount creator.
This actually means, that if there are 2 containers with different net
namespace sharing pid namespace, then read of /proc/fs/nfsfs/ entries will
always return content, taken from net namespace of pid namespace creator task
(and thus second namespace set wil be unvisible).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: make nfs_client_list per net ns
Stanislav Kinsbursky [Mon, 23 Jan 2012 17:26:05 +0000 (17:26 +0000)]
NFS: make nfs_client_list per net ns

This patch splits global list of NFS clients into per-net-ns array of lists.
This looks more strict and clearer.
BTW, this patch also makes "/proc/fs/nfsfs/servers" entry content depends on
/proc mount owner pid namespace. See below for details.

NOTE: few words about how was /proc/fs/nfsfs/ entries content show per network
namespace done. This is a little bit tricky and not the best is could be. But
it's cheap (proper fix for /proc conteinerization is a hard nut to crack).
The idea is simple: take proper network namespace from pid namespace
child reaper nsproxy of /proc/ mount creator.
This actually means, that if there are 2 containers with different net
namespace sharing pid namespace, then read of /proc/fs/nfsfs/ entries will
always return content, taken from net namespace of pid namespace creator task
(and thus second namespace set wil be unvisible).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Update idmapper documentation
Bryan Schumaker [Thu, 26 Jan 2012 21:54:25 +0000 (16:54 -0500)]
NFS: Update idmapper documentation

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Keep idmapper include files in one place
Bryan Schumaker [Thu, 26 Jan 2012 21:54:24 +0000 (16:54 -0500)]
NFS: Keep idmapper include files in one place

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Fall back on old idmapper if request_key() fails
Bryan Schumaker [Thu, 26 Jan 2012 21:54:23 +0000 (16:54 -0500)]
NFS: Fall back on old idmapper if request_key() fails

This patch removes the CONFIG_NFS_USE_NEW_IDMAPPER compile option.
First, the idmapper will attempt to map the id using /sbin/request-key
and nfsidmap.  If this fails (if /etc/request-key.conf is not configured
properly) then the idmapper will call the legacy code to perform the
mapping.  I left a comment stating where the legacy code begins to make
it easier for somebody to remove in the future.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Fix comparison between DS address lists
Weston Andros Adamson [Fri, 3 Feb 2012 20:45:40 +0000 (15:45 -0500)]
NFS: Fix comparison between DS address lists

data_server_cache entries should only be treated as the same if the address
list hasn't changed.

A new entry will be made when an MDS changes an address list (as seen by
GETDEVINFO). The old entry will be freed once all references are gone.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: start printks w/ NFS: even if __func__ shown
Weston Andros Adamson [Thu, 26 Jan 2012 18:32:23 +0000 (13:32 -0500)]
NFS: start printks w/ NFS: even if __func__ shown

This patch addresses printks that have some context to show that they are
from fs/nfs/, but for the sake of consistency now start with NFS:

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: printks in fs/nfs/ should start with NFS:
Weston Andros Adamson [Thu, 26 Jan 2012 18:32:22 +0000 (13:32 -0500)]
NFS: printks in fs/nfs/ should start with NFS:

Messages like "Got error -10052 from the server on DESTROY_SESSION. Session
has been destroyed regardless" can be confusing to users who aren't very
familiar with NFS.

NOTE: This patch ignores any printks() that start by printing __func__ - that
will be in a separate patch.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: remove an unneeded NULL check in xprt_connect()
Dan Carpenter [Wed, 1 Feb 2012 07:46:20 +0000 (10:46 +0300)]
SUNRPC: remove an unneeded NULL check in xprt_connect()

We check "task->tk_rqstp" and then we dereference it without checking on
the next line.  The only caller is call_connect() and that has a check
which prevents it from calling xprt_connect() with a NULL.

                if (task->tk_status < 0)
                        return;

If "task->tk_rqstp" were NULL then "tk_status" would be -EAGAIN.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Call test_stateid() and free_stateid() with correct stateids
Bryan Schumaker [Tue, 31 Jan 2012 15:39:30 +0000 (10:39 -0500)]
NFS: Call test_stateid() and free_stateid() with correct stateids

I noticed that test_stateid() was always using the same stateid for open
and lock recovery.  After poking around a bit, I discovered that it was
always testing with a delegation stateid (even if there was no
delegation present).  I figured this wasn't correct, so now delegation
and open stateids are tested during open_expired() and lock stateids are
tested during lock_expired().

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Pass a stateid to test_stateid() and free_stateid()
Bryan Schumaker [Tue, 31 Jan 2012 15:39:29 +0000 (10:39 -0500)]
NFS: Pass a stateid to test_stateid() and free_stateid()

This takes the guesswork out of what stateid to use.  The caller is
expected to figure this out and pass in the correct one.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Change the default limit to the number of TCP slots
Trond Myklebust [Mon, 6 Feb 2012 20:18:48 +0000 (15:18 -0500)]
SUNRPC: Change the default limit to the number of TCP slots

Since the scheme of limiting the number of TCP slots to whatever will
fit in the current TCP window seems to be working well (Andy reports
getting within 20% of the 'iperf' send performance on a 10GigE link)
we should just let that be the default mode of operation.

Users may still set their own limits using the tcp_max_slot_table_entries
parameter if they need to.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Adding status trace points
Steve Dickson [Mon, 6 Feb 2012 15:08:08 +0000 (10:08 -0500)]
SUNRPC: Adding status trace points

This patch adds three trace points to the status routines
in the sunrpc state machine.

The goal of these trace points is to give an Admin
the ability to check on binding status or connection
status to see if there is a potential problem.

Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Fix up sunrpc trace events
Trond Myklebust [Mon, 6 Feb 2012 15:31:35 +0000 (10:31 -0500)]
SUNRPC: Fix up sunrpc trace events

The reporting of the RPC queue name needs to use the __string()
event interface.

Reported-by: Neil Horman <nhorman@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: ACCESS validation doesn't require a full attribute refresh
Trond Myklebust [Mon, 30 Jan 2012 20:43:56 +0000 (15:43 -0500)]
NFSv4: ACCESS validation doesn't require a full attribute refresh

We only really need to check the change attribute, so let's just use the
server->cache_consistency_bitmask.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Don't decode fs_locations if we didn't ask for them...
Trond Myklebust [Mon, 30 Jan 2012 20:43:56 +0000 (15:43 -0500)]
NFSv4: Don't decode fs_locations if we didn't ask for them...

Currently, the server can potentially cause us to Oops by returning an
fs_locations request that we didn't actually request.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agonfs: remove unneeded NULL pointer check in nfs4_remote_mount
Jeff Layton [Tue, 24 Jan 2012 16:35:00 +0000 (16:35 +0000)]
nfs: remove unneeded NULL pointer check in nfs4_remote_mount

"data" is never NULL here.

Reported-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: fixup for namespace changes
Trond Myklebust [Mon, 23 Jan 2012 18:22:45 +0000 (13:22 -0500)]
SUNRPC: fixup for namespace changes

Fixes this build error when CONFIG_NET_NS is not set:

net/sunrpc/svcsock.c: In function 'svc_setup_socket':
net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agopnfs: clean up initiate_file_draining layout lookup
Benny Halevy [Sun, 22 Jan 2012 14:03:39 +0000 (16:03 +0200)]
pnfs: clean up initiate_file_draining layout lookup

Fixes the following compiler warning:

fs/nfs/callback_proc.c: In function 'do_callback_layoutrecall':
fs/nfs/callback_proc.c:115:26: warning: 'lo' may be used uninitialized in this function

Reported-by: Jim Rees <rees@umich.edu>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Use kcalloc() when allocating arrays
Trond Myklebust [Fri, 20 Jan 2012 23:57:02 +0000 (18:57 -0500)]
NFS: Use kcalloc() when allocating arrays

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Avoid thundering herd issues with nfs_release_seqid
Trond Myklebust [Fri, 20 Jan 2012 23:47:05 +0000 (18:47 -0500)]
NFSv4: Avoid thundering herd issues with nfs_release_seqid

Store a pointer to the rpc_task in struct nfs_seqid so that we can wake up
only that request that is able to grab the lock after we've released it.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Add trace events to the sunrpc subsystem
Trond Myklebust [Fri, 20 Jan 2012 19:52:23 +0000 (14:52 -0500)]
SUNRPC: Add trace events to the sunrpc subsystem

Add declarations to allow tracing of RPC call creation, running, sleeping,
and destruction.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: constify the rpc_program
Trond Myklebust [Fri, 20 Jan 2012 18:53:56 +0000 (13:53 -0500)]
SUNRPC: constify the rpc_program

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: constify rpc_program->name
Trond Myklebust [Fri, 20 Jan 2012 18:53:56 +0000 (13:53 -0500)]
SUNRPC: constify rpc_program->name

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: constify rpc_clnt fields cl_server and cl_protname
Trond Myklebust [Fri, 20 Jan 2012 18:53:37 +0000 (13:53 -0500)]
SUNRPC: constify rpc_clnt fields cl_server and cl_protname

...and get rid of the superfluous cl_inline_name.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: search for service transports in network namespace context
Stanislav Kinsbursky [Fri, 20 Jan 2012 12:50:53 +0000 (16:50 +0400)]
SUNRPC: search for service transports in network namespace context

Service transports are parametrized by network namespace. And thus lookup of
transport instance have to take network namespace into account.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
12 years agoNFS: remove unused nfs4_find_client_no_ident function
Stanislav Kinsbursky [Fri, 20 Jan 2012 13:19:56 +0000 (17:19 +0400)]
NFS: remove unused nfs4_find_client_no_ident function

Looks like this function survived after some cleanup patch without a reason.
Now it's not called or referenced and I believe, that it can be simply removed.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: register service stats /proc entries in passed network namespace context
Stanislav Kinsbursky [Tue, 6 Dec 2011 13:42:49 +0000 (16:42 +0300)]
SUNRPC: register service stats /proc entries in passed network namespace context

This patch makes it possible to create NFSd program entry ("/proc/net/rpc/nfsd")
in passed network namespace context instead of hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agosunrpc: fix stats.h for CONFIG_PROC_FS not enabled
Randy Dunlap [Tue, 24 Jan 2012 03:28:07 +0000 (03:28 +0000)]
sunrpc: fix stats.h for CONFIG_PROC_FS not enabled

Fix build errors in linux/sunrpc/stats.h when CONFIG_PROC_FS
is not enabled:
- add parameter names to inline functions
- fix placement of '(' in rpc_proc_unregister()

Fixes these errors:
include/linux/sunrpc/stats.h:72:63: error: parameter name omitted
include/linux/sunrpc/stats.h:73:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'net'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: register RPC stats /proc entries in passed network namespace context
Stanislav Kinsbursky [Tue, 6 Dec 2011 13:42:40 +0000 (16:42 +0300)]
SUNRPC: register RPC stats /proc entries in passed network namespace context

This patch makes it possible to create NFS program entry ("/proc/net/rpc/nfs")
in passed network namespace context instead of hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: decode destination address in proper network namespace context
Stanislav Kinsbursky [Thu, 19 Jan 2012 15:05:57 +0000 (19:05 +0400)]
NFS: decode destination address in proper network namespace context

This patch replaces "init_net" with NFS client's owner net in rpc_pton() call
in decode_ds_addr().

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: parse DNS cache in proper network namespace context
Stanislav Kinsbursky [Thu, 19 Jan 2012 14:51:04 +0000 (18:51 +0400)]
NFS: parse DNS cache in proper network namespace context

This patch replaces "init_net" with cache's owner net in rpc_pton() call.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: generic cache register routines removed
Stanislav Kinsbursky [Thu, 19 Jan 2012 17:42:53 +0000 (21:42 +0400)]
SUNRPC: generic cache register routines removed

All cache users now uses network-namespace-aware routines, so generic ones
are obsolete.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
12 years agoSUNRPC: ip map cache per network namespace cleanup
Stanislav Kinsbursky [Thu, 19 Jan 2012 17:42:45 +0000 (21:42 +0400)]
SUNRPC: ip map cache per network namespace cleanup

This patch converts ip_map_cache per network namespace implemenetation to the
same view, as other caches done in the series.
Besides generalization, code becomes shorter with this patch.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
12 years agoSUNRPC: create GSS auth cache per network namespace
Stanislav Kinsbursky [Thu, 19 Jan 2012 17:42:37 +0000 (21:42 +0400)]
SUNRPC: create GSS auth cache per network namespace

This patch makes GSS auth cache details allocated and registered per network
namespace context.
Thus with this patch rsi_cache and rsc_cache contents for network namespace "X"
are controlled from proc file system mount for the same network namespace "X".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
12 years agoSUNRPC: create unix gid cache per network namespace
Stanislav Kinsbursky [Thu, 19 Jan 2012 17:42:29 +0000 (21:42 +0400)]
SUNRPC: create unix gid cache per network namespace

v2:
1) fixed silly usage of template cache as a real one (this code left from
static global cache for all)

This patch makes unix_gid_cache cache detail allocated and registered per
network namespace context.
Thus with this patch unix_gid_cache contents for network namespace "X" are
controlled from proc file system mount for the same network namespace "X".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
12 years agoSUNRPC: cache creation and destruction routines introduced
Stanislav Kinsbursky [Thu, 19 Jan 2012 17:42:21 +0000 (21:42 +0400)]
SUNRPC: cache creation and destruction routines introduced

This patch prepares infrastructure for network namespace aware cache detail
allocation.
One note about adding network namespace link to cache structure. It's going to
be used later in NFS DNS cache parsing routine (nfs_dns_parse for rpc_pton()
call).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
12 years agoSUNRPC: unregister service on creation in current network namespace
Stanislav Kinsbursky [Fri, 13 Jan 2012 10:03:04 +0000 (14:03 +0400)]
SUNRPC: unregister service on creation in current network namespace

On service shutdown we can be sure, that no more users of it left except
current. Thus it looks like using current network namespace context is safe in
this case.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: register service on creation in current network namespace
Stanislav Kinsbursky [Fri, 13 Jan 2012 10:02:56 +0000 (14:02 +0400)]
SUNRPC: register service on creation in current network namespace

Service, using rpcbind (Lockd, NFSd) are starting from userspace call and thus
we can use current network namespace.
There could be a problem with NFSd service, because it's creation can be called
through NFSd fs from different network namespace. But this is a part of "NFSd
per net ns" task and will be fixed in future.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: pass network namespace to service registering routines
Stanislav Kinsbursky [Fri, 13 Jan 2012 10:02:48 +0000 (14:02 +0400)]
SUNRPC: pass network namespace to service registering routines

Lockd and NFSd services will handle requests from and to many network
nsamespaces. And thus have to be registered and unregistered per network
namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: use proper network namespace in rpcbind RPCBPROC_GETADDR procedure
Stanislav Kinsbursky [Fri, 13 Jan 2012 10:02:40 +0000 (14:02 +0400)]
SUNRPC: use proper network namespace in rpcbind RPCBPROC_GETADDR procedure

Pass request socket network namespace to rpc_uaddr2sockaddr() instead of
hardcoded "init_net",  when decoding address in RPCBPROC_GETADDR procedure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: parametrize rpc_uaddr2sockaddr() by network context
Stanislav Kinsbursky [Fri, 13 Jan 2012 09:09:27 +0000 (13:09 +0400)]
SUNRPC: parametrize rpc_uaddr2sockaddr() by network context

Parametrize rpc_uaddr2sockaddr() by network context and thus force it's callers to pass
in network context instead of using hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: parametrize rpc_pton() by network context
Stanislav Kinsbursky [Fri, 13 Jan 2012 09:09:19 +0000 (13:09 +0400)]
SUNRPC: parametrize rpc_pton() by network context

Parametrize rpc_pton() by network context and thus force it's callers to pass
in network context instead of using hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: parametrize rpc_pton6() by network context
Stanislav Kinsbursky [Fri, 13 Jan 2012 09:09:11 +0000 (13:09 +0400)]
SUNRPC: parametrize rpc_pton6() by network context

Parametrize rpc_pton6() by network context and thus force it's caller
to pass in network context instead of using hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: parametrize rpc_parse_scope_id() by network context
Stanislav Kinsbursky [Fri, 13 Jan 2012 09:09:03 +0000 (13:09 +0400)]
SUNRPC: parametrize rpc_parse_scope_id() by network context

Parametrize rpc_parse_scope_id() by network context and thus force it's caller
to pass in network context instead of using hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: parametrize local rpcbind clients creation with net ns
Stanislav Kinsbursky [Fri, 13 Jan 2012 08:52:51 +0000 (12:52 +0400)]
SUNRPC: parametrize local rpcbind clients creation with net ns

These client are per network namespace and thus can be created for different
network namespaces.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: register rpcbind programs in passed network namespase context
Stanislav Kinsbursky [Fri, 13 Jan 2012 08:52:43 +0000 (12:52 +0400)]
SUNRPC: register rpcbind programs in passed network namespase context

Registering rpcbind program requires rpcbind clients, which are per network
namespace context.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: create rpcbind client in passed network namespace context
Stanislav Kinsbursky [Fri, 13 Jan 2012 08:52:35 +0000 (12:52 +0400)]
SUNRPC: create rpcbind client in passed network namespace context

Rpcbind clients are per network namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: optimize net_ns dereferencing in rpcbind registering calls
Stanislav Kinsbursky [Fri, 13 Jan 2012 08:52:26 +0000 (12:52 +0400)]
SUNRPC: optimize net_ns dereferencing in rpcbind registering calls

Static rpcbind registering functions can be parametrized by network namespace
pointer, calculated only once, instead of using init_net pointer (or taking it
from current when virtualization will be comleted) in many places.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: optimize net_ns dereferencing in rpcbind creation calls
Stanislav Kinsbursky [Fri, 13 Jan 2012 08:52:18 +0000 (12:52 +0400)]
SUNRPC: optimize net_ns dereferencing in rpcbind creation calls

Static rpcbind creation functions can be parametrized by network namespace
pointer, calculated only once, instead of using init_net pointer (or taking it
from current when virtualization will be comleted) in many places.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: move rpcbind internals to sunrpc part of network namespace context
Stanislav Kinsbursky [Fri, 13 Jan 2012 08:52:10 +0000 (12:52 +0400)]
SUNRPC: move rpcbind internals to sunrpc part of network namespace context

This patch makes rpcbind logic works in network namespace context. IOW each
network namespace will have it's own unique rpcbind internals (clients and
friends) required for registering svc services per network namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: Fix potential races in xprt_lock_write_next()
Trond Myklebust [Wed, 18 Jan 2012 03:57:37 +0000 (22:57 -0500)]
SUNRPC: Fix potential races in xprt_lock_write_next()

We have to ensure that the wake up from the waitqueue and the assignment
of xprt->snd_task are atomic. We can do this by assigning the snd_task
while under the waitqueue spinlock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Ensure that mmapped pages remain stable during writeback
Trond Myklebust [Wed, 18 Jan 2012 03:04:26 +0000 (22:04 -0500)]
NFS: Ensure that mmapped pages remain stable during writeback

Ensure that nfs_vm_page_mkwrite() waits for the page writeback to
complete before the application is allowed to modify page
contents.
The main reason for wanting to do this in NFS is to ensure that the
server doesn't get confused if we have to resend the RPC request
due to a dropped/missed reply.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Optimise away unnecessary setattrs for open(O_TRUNC);
Trond Myklebust [Wed, 18 Jan 2012 03:04:26 +0000 (22:04 -0500)]
NFS: Optimise away unnecessary setattrs for open(O_TRUNC);

Currently, we will correctly optimise away a truncate that doesn't
change the file size. However, in the case of open(O_TRUNC), we
also want to optimise away the time changes.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: Move struct nfs_unique_id into struct nfs_seqid_counter
Trond Myklebust [Wed, 18 Jan 2012 03:04:25 +0000 (22:04 -0500)]
NFS: Move struct nfs_unique_id into struct nfs_seqid_counter

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Move contents of struct rpc_sequence into struct nfs_seqid_counter
Trond Myklebust [Wed, 18 Jan 2012 03:04:25 +0000 (22:04 -0500)]
NFSv4: Move contents of struct rpc_sequence into struct nfs_seqid_counter

Clean up.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv41: Add a new helper nfs4_init_sequence()
Trond Myklebust [Wed, 18 Jan 2012 03:04:25 +0000 (22:04 -0500)]
NFSv41: Add a new helper nfs4_init_sequence()

Clean up

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Replace lock_owner->ld_id with an ida based allocator
Trond Myklebust [Wed, 18 Jan 2012 03:04:25 +0000 (22:04 -0500)]
NFSv4: Replace lock_owner->ld_id with an ida based allocator

Again, We're unlikely to ever need more than 2^31 simultaneous lock
owners, so let's replace the custom allocator.

Now that there are no more users, we can also get rid of the custom
allocator code.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Replace state_owner->so_owner_id with an ida based allocator
Trond Myklebust [Wed, 18 Jan 2012 03:04:24 +0000 (22:04 -0500)]
NFSv4: Replace state_owner->so_owner_id with an ida based allocator

We're unlikely to ever need more than 2^31 simultaneous open owners,
so let's replace the custom allocator with the generic ida allocator.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFSv4: Clean up nfs4_get_state_owner
Trond Myklebust [Wed, 18 Jan 2012 03:04:24 +0000 (22:04 -0500)]
NFSv4: Clean up nfs4_get_state_owner

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