| Age | Commit message (Collapse) | Author |
|
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
|
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
|
For events that are rare, such as referral DNS lookups, it makes limited
sense to have a daemon constantly listening for upcalls on a channel. An
alternative in those cases might simply be to run the app that fills the
cache using call_usermodehelper_exec() and friends.
The following patch allows the cache_detail to specify alternative upcall
mechanisms for these particular cases.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
|
What part of 'internal use' is so hard to understand?
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
|
|
This field is set once and never used; probably some artifact of an
earlier implementation idea.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
|
|
Newer server features such as nfsv4 and gss depend on proc to work, so a
failure to initialize the proc files they need should be treated as
fatal.
Thanks to Andrew Morton for style fix and compile fix in case where
CONFIG_NFSD_V4 is undefined.
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
|
|
There's really nothing much the caller can do if cache unregistration
fails. And indeed, all any caller does in this case is print an error
and continue. So just return void and move the printk's inside
cache_unregister.
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
|
|
This macro is unused.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
|
|
Speed up high call-rate workloads by caching the struct ip_map for the peer on
the connected struct svc_sock instead of looking it up in the ip_map cache
hashtable on every call. This helps workloads using AUTH_SYS authentication
over TCP.
Testing was on a 4 CPU 4 NIC Altix using 4 IRIX clients, each with 16
synthetic client threads simulating an rsync (i.e. recursive directory
listing) workload reading from an i386 RH9 install image (161480 regular files
in 10841 directories) on the server. That tree is small enough to fill in the
server's RAM so no disk traffic was involved. This setup gives a sustained
call rate in excess of 60000 calls/sec before being CPU-bound on the server.
Profiling showed strcmp(), called from ip_map_match(), was taking 4.8% of each
CPU, and ip_map_lookup() was taking 2.9%. This patch drops both contribution
into the profile noise.
Note that the above result overstates this value of this patch for most
workloads. The synthetic clients are all using separate IP addresses, so
there are 64 entries in the ip_map cache hash. Because the kernel measured
contained the bug fixed in commit
commit 1f1e030bf75774b6a283518e1534d598e14147d4
and was running on 64bit little-endian machine, probably all of those 64
entries were on a single chain, thus increasing the cost of ip_map_lookup().
With a modern kernel you would need more clients to see the same amount of
performance improvement. This patch has helped to scale knfsd to handle a
deployment with 2000 NFS clients.
Signed-off-by: Greg Banks <gnb@melbourne.sgi.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
We can now make some code static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Neil Brown <neilb@suse.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
.. it makes some of the code nicer.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Cache_fresh is now only used in cache.c, so unexport it.
Part of cache_fresh (setting CACHE_VALID) should really be done under the
lock, while part (calling cache_revisit_request etc) must be done outside the
lock. So we split it up appropriately.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This has been replaced by more traditional code.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
declare one
The C++-like 'template' approach proves to be too ugly and hard to work with.
The old 'template' won't go away until all users are updated.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
These were an unnecessary wart. Also only have one 'DefineSimpleCache..'
instead of two.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
When registering an RPC cache, cache_register() always sets the owner as the
sunrpc module. However, there are RPC caches owned by other modules. With
the incorrect owner setting, the real owning module can be removed potentially
with an open reference to the cache from userspace.
For example, if one were to stop the nfs server and unmount the nfsd
filesystem, the nfsd module could be removed eventhough rpc.idmapd had
references to the idtoname and nametoid caches (i.e.
/proc/net/rpc/nfs4.<cachename>/channel is still open). This resulted in a
system panic on one of our machines when attempting to restart the nfs
services after reloading the nfsd module.
The following patch adds a 'struct module *owner' field in struct
cache_detail. The owner is further assigned to the struct proc_dir_entry
in cache_register() so that the module cannot be unloaded while user-space
daemons have an open reference on the associated file under /proc.
Signed-off-by: Bruce Allan <bwa@us.ibm.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
instead.
This patch should fix a problem that has been experienced on at-least one
busy NFS server, but it has not had lots of testing yet. If -mm could provide
that .....
The rpc auth cache currently differentiates between a reference due to
being in a hash chain (signalled by CACHE_HASHED flag) and any other
reference (counted in refcnt).
This is an artificial difference due to an historical accident, and it
makes cache_put unsafe.
This patch removes the distinction so now existance in a hash chain is
counted just like any other reference. Thus a race window in cache_put is
closed.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
The interface between the auth_domain and the cache code is messy; the
auth_domain code is the only real user of the full 11-argument
DefineCacheLookup, and does weird stuff with it (like passing in through one
of the arguments a bit of code with a conditional return).
We could further parametrize DefineCacheLookup, but I think it's already too
complicated.
My solution is to just ignore DefineCacheLookup and write the
auth_domain_lookup function from scratch. It's actually a pretty short
function (much simpler than DefineCacheLookup itself), and it's much easier to
read this short function than it is to read some special-cased
DefineCacheLookup to verify that it does what it says it does....
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Presumably anyone creating a new cache entry is going to want a reference on
that cache; and indeed every caller of cache_init increments the reference
count immediately afterwards. So may as well make cache_init set an initial
reference count of 1.
Also, note that cache_init initializes the flags; callers don't need to.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
From: "J. Bruce Fields" <bfields@fieldses.org>
The kernel currently prints:
nfsd: nobody listening for auth.unix.ip upcall; has some daemon not been started?
on every bootup, during initscripts.
Neil Brown <neilb@cse.unsw.edu.au> says:
It was part of the recent set of idmapper patches. Bruce wanted the admin
to get a warning when the idmapper daemon wasn't running. I thought the
same warning should apply to any daemon that responded to upcalls.
In the case of auth.unix.ip it isn't strictly necessary for a daemon to be
running (for comparability with 2.4).
You can get rid of the warning by doing:
mount -t nfsd nfsd /proc/fs/nfs
before mountd is started (init scripts should start doing this I hope, but
distributions don't tend to use the init script from nfs-utils, so it is
hard to push it). This will trigger mountd to listen on auth.unix.ip and
others.
That's a hassle, so Bruce's patch limits the warning purely to the new
idmapper cache. It provides a callback in the cache_detail that individual
caches can use to log messages when upcalls fail because a userspace daemon
not running. Implement this method for the idmapping caches.
|
|
From: NeilBrown <neilb@cse.unsw.edu.au>
From: "J. Bruce Fields" <bfields@fieldses.org>
To help the user diagnose problems caused by user-level daemons not running.
|
|
updates.
From: NeilBrown <neilb@cse.unsw.edu.au>
This is important for update-in-place caches which may change from being
negative to posative.
Thanks to "J. Bruce Fields" <bfields@fieldses.org> and Olaf Kirch
<okir@suse.de>
|
|
From: NeilBrown <neilb@cse.unsw.edu.au>
When adding a item to a sunrpc/svc cache that contains kmalloced data it is
usefully to move the malloced data out of the key object into the new cache
object rather than copying (as then we would need to cope with kmalloc
failure and such). This means modifying the original.
If the kmalloced data forms part of the key, then we must not move the data
out until after the key isn't needed any more. So this patch moves the
call to "INIT" on a new item (which fills in the key) to *after* the item
has been found (or not), and also makes sure we only call the HASH function
once.
Thanks to "J. Bruce Fields" <bfields@fieldses.org>
also
1/ remove unnecessary assignment
2/ fix comments that lag behind implementation.
|
|
From: Steve Dickson <SteveD@redhat.com>
Here is a patch for the 2.6.1 kernel that fixes an oops that occurs when
the sunrpc module is unloaded.
The problem was the RPC cache_register() call was not saving entry pointers
to the procfs entries it was creating. So when it came time to dismantle
the entires, a BUG_ON() was tripped in remove_proc_entry() since the tree
was not broken down completely.
(acked by neilb)
|
|
|
|
this was need for paths, but now we have seq_path...
|
|
The sunrpc/cache.c caches which store nfsd export information
can be updated either "inplace" or by replacing the entry.
replacement is needed when an entry hold a reference to some
other object, so the reference counts work properly.
"inplace" can be used when no such references are held, and should be
used when the object could be refered to by another cache (as otherwise
the other cache would have to be updated whenever this one is).
Previously the type of update (inplace or replace) was specified
as an argument to the *_lookup operation. This too easily lead to
inconsistancies.
With this patch, the update mode is specified when the cache is
declared.
|
|
The most significant fix is cleaning up properly when
nfs service is stopped.
Also fix some refcounting problems and other little bits.
|
|
1/ call cache_fresh when replacing a cache entry (instead of only
when updating) so that up-calls waiting on the replaced entry continue.
2/ in svcauth_unix_accept, don't put the verifier until all tests have
succeeded.
3/ calculate size of request-being-deferred correctly.
|
|
This provides a /proc/sunrpc/*/content seq_file for caches to display
their content.
This code is based on the code for /proc/fs/nfs/exports
|
|
|
|
|
|
... as generic names probably aren't such a good idea.
Also sort the related EXPORT_SYMBOLS.
A 'qword' is a 'quoted word' and can be added, added as hex,
or got (getted??).
|
|
|
|
get_word understands both \x and \012 quoting styles.
|
|
This code enhances 'cache_check' to try to initiate
an up-call if the cache entry is not up-to-date, and also
defines add_word and add_hex for formating up-call
requests. See rpc-cache.txt for more detail.
|
|
communicating cache updates with kernel
Each cache gets it's own 'channel' at
/proc/net/rpc/$CACHENAME/channel
Reads from the file will return all pending requests, one at a time.
select will block when at end of file.
writes will pass full lines in to be processed.
|
|
cache.c gets code to allow a 'request' to be referred pending
an update of a cache item, and revisited when the item is
updates.
svcsock.c gets code to store the relevant part of a request on deferral, and
to re-queue it when the cache item that caused the deferral is
filled in.
|
|
This patch provides a "virtual class" for defining caches
that make user-space information available in the kernel
It is intended for RPC services or clients that need user-space
support for authentication.
As yet, support for userspace interaction isn't included as I want
that to be able to have separate review.
|