openwrt/staging/blogic.git
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>
12 years agoNFS: Remove unnecessary includes from linux/nfs_fs_i.h
Trond Myklebust [Wed, 18 Jan 2012 03:04:24 +0000 (22:04 -0500)]
NFS: Remove unnecessary includes from linux/nfs_fs_i.h

Also from linux/nfs_xdr.h.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: kernel PipeFS mount point creation routines removed
Stanislav Kinsbursky [Tue, 10 Jan 2012 13:04:48 +0000 (17:04 +0400)]
SUNRPC: kernel PipeFS mount point creation routines removed

This patch removes static rpc_mnt variable and its creation and destruction
routines, because they are not used anymore.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: remove RPC PipeFS mount point reference from blocklayout routines
Stanislav Kinsbursky [Tue, 10 Jan 2012 13:04:40 +0000 (17:04 +0400)]
NFS: remove RPC PipeFS mount point reference from blocklayout routines

This is a cleanup patch. We don't need this reference anymore, because
blocklayout pipes dentries now creates and destroys in per-net operations and
on PipeFS mount/umount notification.
Note that nfs4blocklayout_register_net() now returns 0 instead of -ENOENT in
case of PipeFS superblock absence. This is ok, because blocklayout pipe dentry
will be created on PipeFS mount event.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: blocklayout PipeFS notifier introduced
Stanislav Kinsbursky [Tue, 10 Jan 2012 13:04:32 +0000 (17:04 +0400)]
NFS: blocklayout PipeFS notifier introduced

This patch subscribes blocklayout pipes to RPC pipefs notifications. Notifier
is registering on blocklayout module load. This notifier callback is
responsible for creation/destruction of PipeFS blocklayout pipe dentry.
Note that no locking required in notifier callback because PipeFS superblock
pointer is passed as an argument from it's creation or destruction routine and
thus we can be sure about it's validity.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: blocklayout pipe creation per network namespace context introduced
Stanislav Kinsbursky [Tue, 10 Jan 2012 13:04:24 +0000 (17:04 +0400)]
NFS: blocklayout pipe creation per network namespace context introduced

This patch implements blocklayout pipe creation and registration per each
existent network namespace.
This was achived by registering NFS per-net operations, responsible for
blocklayout pipe allocation/register and unregister/destruction instead of
initialization and destruction of static "bl_device_pipe" pipe (this one was
removed).
Note, than pointer to network blocklayout pipe is stored in per-net "nfs_net"
structure, because allocating of one more per-net structure for blocklayout
module looks redundant.
This patch also changes dev_remove() function prototype (and all it's callers,
where it' requied) by adding network namespace pointer parameter, which is used
to discover proper blocklayout pipe for rpc_queue_upcall() call.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: handle blocklayout pipe PipeFS dentry by network namespace aware routines
Stanislav Kinsbursky [Tue, 10 Jan 2012 13:04:16 +0000 (17:04 +0400)]
NFS: handle blocklayout pipe PipeFS dentry by network namespace aware routines

This patch makes blocklayout pipe dentry allocated and destroyed in network
namespace context by PipeFS network namespace aware routines.
Network namespace context is obtained from nfs_client structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: idmap PipeFS notifier introduced
Stanislav Kinsbursky [Tue, 10 Jan 2012 12:13:19 +0000 (16:13 +0400)]
NFS: idmap PipeFS notifier introduced

v2:
1) Added "nfs_idmap_init" and "nfs_idmap_quit" definitions for kernels built
without CONFIG_NFS_V4 option set.

This patch subscribes NFS clients to RPC pipefs notifications. Idmap notifier
is registering on NFS module load. This notifier callback is responsible for
creation/destruction of PipeFS idmap pipe dentry for NFS4 clients.

Since ipdmap pipe is created in rpc client pipefs directory, we have make sure,
that this directory has been created already. IOW RPC client notifier callback
has been called already. To achive this, PipeFS notifier priorities has been
introduced (RPC clients notifier priority is greater than NFS idmap one).
But this approach gives another problem: unlink for RPC client directory will
be called before NFS idmap pipe unlink on UMOUNT event and will fail, because
directory is not empty.
The solution, introduced in this patch, is to try to remove client directory
once again after idmap pipe was unlinked. This looks like ugly hack, so
probably it should be replaced in some more elegant way.

Note that no locking required in notifier callback because PipeFS superblock
pointer is passed as an argument from it's creation or destruction routine and
thus we can be sure about it's validity.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: handle NFS idmap pipe PipeFS dentries by network namespace aware routines
Stanislav Kinsbursky [Tue, 10 Jan 2012 12:13:11 +0000 (16:13 +0400)]
NFS: handle NFS idmap pipe PipeFS dentries by network namespace aware routines

This patch makes NFS idmap pipes dentries allocated and destroyed in network
namespace context by PipeFS network namespace aware routines.
Network namespace context is obtained from nfs_client structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: create callback transports in parent transport network namespace
Stanislav Kinsbursky [Tue, 10 Jan 2012 12:13:03 +0000 (16:13 +0400)]
NFS: create callback transports in parent transport network namespace

This patch replaces static "init_net" references with parent transport xprt_net
reference. Thus callback transports will be created in the same network
namespace as respective NFS mount point was created.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: pass NFS client owner network namespace to RPC client creation routine
Stanislav Kinsbursky [Tue, 10 Jan 2012 12:12:54 +0000 (16:12 +0400)]
NFS: pass NFS client owner network namespace to RPC client creation routine

This patch replaces static "init_net" with nfs_client->net pointer in RPC
client creation calls.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: make NFS client allocated per network namespace context
Stanislav Kinsbursky [Tue, 10 Jan 2012 12:12:46 +0000 (16:12 +0400)]
NFS: make NFS client allocated per network namespace context

This patch adds new net variable to nfs_client structure. This variable is set
on NFS client creation and cheched during matching NFS client search.
Initially current->nsproxy->net_ns is used as network namespace owner for new
NFS client to create. This network namespace pointer is set during mount
options parsing and thus can be passed from user-spave utils in future if will
be necessary.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoSUNRPC: fix pipe->ops cleanup on pipe dentry unlink
Stanislav Kinsbursky [Tue, 10 Jan 2012 12:12:38 +0000 (16:12 +0400)]
SUNRPC: fix pipe->ops cleanup on pipe dentry unlink

This patch looks late due to GSS AUTH patches sent already. But it fixes a flaw
in RPC PipeFS pipes handling.
I've added this patch in the series, because this series related to pipes. But
it should be a part of previous series named "SUNPRC: cleanup PipeFS for
network-namespace-aware users".

Pipe dentry can be created and destroyed many times during pipe life cycle.
This actually means, that we can't set pipe->ops to NULL in rpc_close_pipes()
and use this variable as a flag, indicating, that pipe's dentry is unlinking.
To follow this restriction, this patch replaces "pipe->ops = NULL" assignment
and checks for NULL with "pipe->dentry = NULL" assignment and checks for
NULL respectively.
This patch also removes check for non-NULL pipe->ops (or pipe->dentry) in
rpc_close_pipes() because it always non-NULL now.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: remove RPC PipeFS mount point references from NFS cache routines
Stanislav Kinsbursky [Fri, 25 Nov 2011 14:13:20 +0000 (17:13 +0300)]
NFS: remove RPC PipeFS mount point references from NFS cache routines

This is a cleanup patch. We don't need this reference anymore, because DNS
resolver cache now creates it's dentries in per-net operations and on PipeFS
mount/umount notification.
Note that nfs_cache_register_net() now returns 0 instead of -ENOENT in case of
PiepFS superblock absence. This is ok, Dns resolver cache will be regestered on
PipeFS mount event.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
12 years agoNFS: DNS resolver PipeFS notifier introduced
Stanislav Kinsbursky [Fri, 25 Nov 2011 14:13:12 +0000 (17:13 +0300)]
NFS: DNS resolver PipeFS notifier introduced

This patch subscribes DNS resolver caches to RPC pipefs notifications. Notifier
is registering on NFS module load. This notifier callback is responsible for
creation/destruction of PipeFS DNS resolver cache directory.
Note that no locking required in notifier callback because PipeFS superblock
pointer is passed as an argument from it's creation or destruction routine and
thus we can be sure about it's validity.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>