History log of /fs/nfsd/netns.h
Revision Date Author Comments
14a571a8ecc69feadce8973bd67090a7d0430123 05-Aug-2014 Jeff Layton <jlayton@primarydata.com> nfsd: add some comments to the nfsd4 object definitions

Add some comments that describe what each of these objects is, and how
they related to one another.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
294ac32e99861f6efee548a6b7afb27c32cd502f 30-Jul-2014 Jeff Layton <jlayton@primarydata.com> nfsd: protect clid and verifier generation with client_lock

The clid counter is a global counter currently. Move it to be a per-net
property so that it can be properly protected by the nn->client_lock
instead of relying on the client_mutex.

The verifier generator is also potentially racy if there are two
simultaneous callers. Generate the verifier when we generate the clid
value, so it's also created under the client_lock. With this, there's
no need to keep two counters as they'd always be in sync anyway, so
just use the clientid_counter for both.

As Trond points out, what would be best is to eventually move this
code to use IDR instead of the hash tables. That would also help ensure
uniqueness, but that's probably best done as a separate project.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
d4f0489f38512027fdf5190d5d1d8007e155e88f 30-Jul-2014 Trond Myklebust <trond.myklebust@primarydata.com> nfsd: Move the open owner hash table into struct nfs4_client

Preparation for removing the client_mutex.

Convert the open owner hash table into a per-client table and protect it
using the nfs4_client->cl_lock spin lock.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
b3c32bcd9c4b8320aea504477573f0c460d2d57d 30-Jun-2014 Trond Myklebust <trond.myklebust@primarydata.com> nfsd: NFSv4 lock-owners are not associated to a specific file

Just like open-owners, lock-owners are associated with a name, a clientid
and, in the case of minor version 0, a sequence id. There is no association
to a file.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
5b8db00bae39e5ecd9bafb05478cca5b42564ab1 02-Jul-2014 Jeff Layton <jlayton@primarydata.com> nfsd: add a new /proc/fs/nfsd/max_connections file

Currently, the maximum number of connections that nfsd will allow
is based on the number of threads spawned. While this is fine for a
default, there really isn't a clear relationship between the two.

The number of threads corresponds to the number of concurrent requests
that we want to allow the server to process at any given time. The
connection limit corresponds to the maximum number of clients that we
want to allow the server to handle. These are two entirely different
quantities.

Break the dependency on increasing threads in order to allow for more
connections, by adding a new per-net parameter that can be set to a
non-zero value. The default is still to base it on the number of threads,
so there should be no behavior change for anyone who doesn't use it.

Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
8ef667140c52e9b88934664954217f28559c75d6 31-Dec-2013 Kinglong Mee <kinglongmee@gmail.com> NFSD: Don't start lockd when only NFSv4 is running

When starting without nfsv2 and nfsv3, nfsd does not need to start
lockd (and certainly doesn't need to fail because lockd failed to
register with the portmapper).

Reported-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
e8c69d17d1ef8437aee729322db005573a467fd6 21-Mar-2013 J. Bruce Fields <bfields@redhat.com> nfsd4: make del_recall_lru per-network-namespace

If nothing else this simplifies the nfs4_state_shutdown_net logic a tad.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
9dd9845f084cda07ce00cca32a5ba8fbcbbfbcaf 06-Dec-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make NFSd service structure allocated per net

This patch makes main step in NFSd containerisation.

There could be different approaches to how to make NFSd able to handle
incoming RPC request from different network namespaces. The two main
options are:

1) Share NFSd kthreads betwween all network namespaces.
2) Create separated pool of threads for each namespace.

While first approach looks more flexible, second one is simpler and
non-racy. This patch implements the second option.

To make it possible to allocate separate pools of threads, we have to
make it possible to allocate separate NFSd service structures per net.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
b9c0ef8571c6ae33465dcf41d496ce2ad783c49d 06-Dec-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make NFSd service boot time per-net

This is simple: an NFSd service can be started at different times in
different network environments. So, its "boot time" has to be assigned
per net.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2c2fe2909e124c32a34dbbb3ac129112524fc540 06-Dec-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: per-net NFSd up flag introduced

This patch introduces introduces per-net "nfsd_net_up" boolean flag, which has
the same purpose as general "nfsd_up" flag - skip init or shutdown of per-net
resources in case of they are inited on shutted down respectively.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
9a9c6478a8b6ce8b6da6b6d1e15f365b505895cd 04-Dec-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make NFSv4 recovery client tracking options per net

Pointer to client tracking operations - client_tracking_ops - have to be
containerized, because different environment can support different trackers
(for example, legacy tracker currently is not suported in container).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
44e34da60b24ca14666534b61cc9579aa4e1eac5 29-Nov-2012 Bryan Schumaker <bjschuma@netapp.com> NFSD: Clean up forgetting clients

I added in a generic for-each loop that takes a pass over the client_lru
list for the current net namespace and calls some function. The next few
patches will update other operations to use this function as well. A value
of 0 still means "forget everything that is found".

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
5284b44e438580a50e8cc5189297a73a48a45ecb 27-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make NFSv4 grace time per net

Grace time is a part of NFSv4 state engine, which is constructed per network
namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
3d7337115d06f21970e23684f4d2e62e3a44c572 27-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make NFSv4 lease time per net

Lease time is a part of NFSv4 state engine, which is constructed per network
namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
f141f79d709de447c8c92ba54821740ae53a5d07 26-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: recovery - make in_grace per net

Flag in_grace is a part of client tracking state, which is network namesapce
aware. So let'a replace global static variable with per-net one.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
3a0733692f6665a28c50ebadb6d9db2b183bcb91 26-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: recovery - make rec_file per net

Opening and closing of this file is done in client tracking init and exit
operations.
Client tracking is done in network namespace context already. So let's make
this file opened and closed per network context - this will simlify it's
management.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
c9a4962881929df7f1ef6e63e1b9da304faca4dd 26-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make client_lock per net

This lock protects the client lru list and session hash table, which are
allocated per network namespace already.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
0912128149e86b48ed946371298d7fe61120d627 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make laundromat network namespace aware

This patch moves laundromat_work to nfsd per-net context, thus allowing to run
multiple laundries.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
73758fed711b847d833b9b0db59137eaeed06485 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make close_lru list per net

This list holds nfs4 clients (open) stateowner queue for last close replay,
which are network namespace aware. So let's make this list per network
namespace too.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
5ed58bb243484e01e82ffca8451907403168e262 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make client_lru list per net

This list holds nfs4 clients queue for lease renewal, which are network
namespace aware. So let's make this list per network namespace too.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1872de0e8171904612ee85de218fa045bc473cad 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make sessionid_hashtbl allocated per net

This hash holds established sessions state and closely associated with
nfs4_clients info, which are network namespace aware. So let's make it
allocated per network namespace too.

Note: this hash can be allocated in per-net operations. But it looks
better to allocate it on nfsd state start and thus don't waste resources
if server is not running.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
20e9e2bc98b907efe82621797c561f6169d63d96 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make lockowner_ino_hashtbl allocated per net

This hash holds file lock owners and closely associated with nfs4_clients info,
which are network namespace aware. So let's make it allocated per network
namespace too.

Note: this hash can be allocated in per-net operations. But it looks
better to allocate it on nfsd state start and thus don't waste resources
if server is not running.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
9b5311374057e5c87017ea3756e566047c9b61e7 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make ownerstr_hashtbl allocated per net

This hash holds open owner state and closely associated with nfs4_clients
info, which are network namespace aware. So let's make it allocated per
network namespace too.

Note: this hash can be allocated in per-net operations. But it looks
better to allocate it on nfsd state start and thus don't waste resources
if server is not running.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
a99454aa4ff1241a19dcb486fa302d3e8cc09e5b 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make unconf_name_tree per net

This hash holds nfs4_clients info, which are network namespace aware.
So let's make it allocated per network namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
0a7ec37727dcc3293cd4c9958b25c43f3a797d47 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make unconf_id_hashtbl allocated per net

This hash holds nfs4_clients info, which are network namespace aware.
So let's make it allocated per network namespace.

Note: this hash can be allocated in per-net operations. But it looks
better to allocate it on nfsd state start and thus don't waste resources
if server is not running.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
382a62e76cbf91fb364a4cd8732761e4ecf62153 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make conf_name_tree per net

This tree holds nfs4_clients info, which are network namespace aware.
So let's make it per network namespace.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
8daae4dc0d09d44d38194f72bc91740b46a6ce53 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make conf_id_hashtbl allocated per net

This hash holds nfs4_clients info, which are network namespace aware.
So let's make it allocated per network namespace.

Note: this hash can be allocated in per-net operations. But it looks
better to allocate it on nfsd state start and thus don't waste resources
if server is not running.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
52e19c09a183d82d99f10c284bc8b27933b1d1fc 14-Nov-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make reclaim_str_hashtbl allocated per net

This hash holds nfs4_clients info, which are network namespace aware.
So let's make it allocated per network namespace.

Note: this hash is used only by legacy tracker. So let's allocate hash in
tracker init.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2c142baa7b237584bae7dc28630851701497e1ef 25-Jul-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> NFSd: make boot_time variable per network namespace

NFSd's boot_time represents grace period start point in time.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
a51c84ed502c25fed996afb7696fd7db2fa32fe2 25-Jul-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> NFSd: make grace end flag per network namespace

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
5e1533c7880bb0df98f71fa683979ec296aa947d 25-Jul-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> NFSd: make nfsd4_manager allocated per network namespace context.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
9e75a4dee08e8fe21f349e11c43955c34523bced 11-Apr-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make name-to-id cache allocated per network namespace context

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
c2e76ef5e0716bc82364e6049e8023ffd5bbe395 11-Apr-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make id-to-name cache allocated per network namespace context

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
e5f06f720eff24e32f1cc08ec03bcc8c4b2d2934 11-Apr-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make expkey cache allocated per network namespace context

This patch also changes svcauth_unix_purge() function: added network namespace
as a parameter and thus loop over all networks was replaced by only one call
for ip map cache purge.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
b3853e0ea1f2ef58f7e7c03e47819e2ae3766dea 11-Apr-2012 Stanislav Kinsbursky <skinsbursky@parallels.com> nfsd: make export cache allocated per network namespace context

This patch also changes prototypes of nfsd_export_flush() and exp_rootfh():
network namespace parameter added.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
797a9d797f8483bb67f265c761b76dcd5a077a23 29-Mar-2012 Jeff Layton <jlayton@redhat.com> nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled

Otherwise, we get a warning or error similar to this when building with
CONFIG_NFSD_V4 disabled:

ERROR: "nfsd4_cld_block" [fs/nfsd/nfsd.ko] undefined!

Fix this by wrapping the calls to rpc_pipefs_notifier_register and
..._unregister in another function and providing no-op replacements
when CONFIG_NFSD_V4 is disabled.

Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
813fd320c16691eac508fe350b4ee7362c6c4a56 21-Mar-2012 Jeff Layton <jlayton@redhat.com> nfsd: add notifier to handle mount/unmount of rpc_pipefs sb

In the event that rpc_pipefs isn't mounted when nfsd starts, we
must register a notifier to handle creating the dentry once it
is mounted, and to remove the dentry on unmount.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
7ea34ac15e45b790f2faa7d5f69c560a43f2de70 21-Mar-2012 Jeff Layton <jlayton@redhat.com> nfsd: add a per-net-namespace struct for nfsd

Eventually, we'll need this when nfsd gets containerized fully. For
now, create a struct on a per-net-namespace basis that will just hold
a pointer to the cld_net structure. That struct will hold all of the
per-net data that we need for the cld tracker.

Eventually we can add other pernet objects to struct nfsd_net.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>