deliverable/linux.git
14 years agonfsd4: move callback setup into session init code
J. Bruce Fields [Tue, 15 Jun 2010 02:26:31 +0000 (22:26 -0400)] 
nfsd4: move callback setup into session init code

The backchannel should  be associated with a session, it isn't really
global to the client.

We do, however, want a pointer global to the client which tracks which
session we're currently using for client-based callbacks.

This is a first step in that direction; for now, just reshuffling of
code with no significant change in behavior.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: don't cache seq_misordered replies
J. Bruce Fields [Sat, 2 Oct 2010 21:03:35 +0000 (17:03 -0400)] 
nfsd4: don't cache seq_misordered replies

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agoSUNRPC: Properly initialize sock_xprt.srcaddr in all cases
Chuck Lever [Wed, 20 Oct 2010 15:53:01 +0000 (11:53 -0400)] 
SUNRPC: Properly initialize sock_xprt.srcaddr in all cases

The source address field in the transport's sock_xprt is initialized
ONLY IF the RPC application passed a pointer to a source address
during the call to rpc_create().  However, xs_bind() subsequently uses
the value of this field without regard to whether the source address
was initialized during transport creation or not.

So far we've been lucky: the uninitialized value of this field is
zeroes.  xs_bind(), until recently, used only the sin[6]_addr field in
this sockaddr, and all zeroes is a valid value for this: it means
ANYADDR.  This is a happy coincidence.

However, xs_bind() now wants to use the sa_family field as well, and
expects it to be initialized to something other than zero.

Therefore, the source address sockaddr field should be fully
initialized at transport create time in _every_ case, not just when
the RPC application wants to use a specific bind address.

Bruce added a workaround for this missing initialization by adjusting
commit 6bc9638a, but the "right" way to do this is to ensure that the
source address sockaddr is always correctly initialized from the
get-go.

This patch doesn't introduce a behavior change.  It's simply a
clean-up of Bruce's fix, to prevent future problems of this kind.  It
may look like overkill, but

  a) it clearly documents the default initial value of this field,

  b) it doesn't assume that the sockaddr_storage memory is first
     initialized to any particular value, and

  c) it will fail verbosely if some unknown address family is passed
     in

Originally introduced by commit d3bc9a1d.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agoSUNRPC: Use conventional switch statement when reclassifying sockets
Chuck Lever [Wed, 20 Oct 2010 15:52:51 +0000 (11:52 -0400)] 
SUNRPC: Use conventional switch statement when reclassifying sockets

Clean up.

Defensive coding: If "family" is ever something that is neither
AF_INET nor AF_INET6, xs_reclassify_socket6() is not the appropriate
default action.  Choose to do nothing in that case.

Introduced by commit 6bc9638a.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc/xprtrdma: clean up workqueue usage
Tejun Heo [Fri, 15 Oct 2010 15:49:27 +0000 (17:49 +0200)] 
sunrpc/xprtrdma: clean up workqueue usage

* Create and use svc_rdma_wq instead of using the system workqueue and
  flush_scheduled_work().  This workqueue is necessary to serve as
  flushing domain for rdma->sc_work which is used to destroy itself
  and thus can't be flushed explicitly.

* Replace cancel_delayed_work() + flush_scheduled_work() with
  cancel_delayed_work_sync().

* Implement synchronous connect in xprt_rdma_connect() using
  flush_delayed_work() on the rdma_connect work instead of using
  flush_scheduled_work().

This is to prepare for the deprecation and removal of
flush_scheduled_work().

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Turn list_for_each-s into the ..._entry-s
Pavel Emelyanov [Tue, 5 Oct 2010 19:30:19 +0000 (23:30 +0400)] 
sunrpc: Turn list_for_each-s into the ..._entry-s

Saves some lines of code and some branticks when reading one.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove dead "else" branch from bc xprt creation
Pavel Emelyanov [Tue, 5 Oct 2010 16:49:35 +0000 (20:49 +0400)] 
sunrpc: Remove dead "else" branch from bc xprt creation

Since the xprt in question is forcibly set to be bound the else
branch of this check is unneeded.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Don't return NULL from rpcb_create
Pavel Emelyanov [Wed, 6 Oct 2010 09:45:56 +0000 (13:45 +0400)] 
sunrpc: Don't return NULL from rpcb_create

> The reason for this is in the future, we may want to support additional
> address family types.  We should, therefore, ensure that every piece of
> code that is sensitive to address families fail in some orderly manner
> to let developers know where a change is needed.

Makes sense. I was under impression, that AF-s other than INET are not
cared about at all :(

Here's a fixed version of the patch.

Log:

Its callers check for ERR_PTR.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove useless if (task == NULL) from xprt_reserve_xprt
Pavel Emelyanov [Tue, 5 Oct 2010 16:47:16 +0000 (20:47 +0400)] 
sunrpc: Remove useless if (task == NULL) from xprt_reserve_xprt

The task in question is dereferenced above (and is actually never NULL).

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove UDP worker wrappers
Pavel Emelyanov [Mon, 4 Oct 2010 12:58:02 +0000 (16:58 +0400)] 
sunrpc: Remove UDP worker wrappers

Same for UDP sockets creation paths.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove TCP worker wrappers
Pavel Emelyanov [Mon, 4 Oct 2010 12:57:40 +0000 (16:57 +0400)] 
sunrpc: Remove TCP worker wrappers

The v4 and the v6 wrappers only pass the respective family
to the xs_tcp_setup_socket. This family can be taken from the
xprt's sockaddr.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Pass family to setup_socket calls
Pavel Emelyanov [Mon, 4 Oct 2010 12:57:11 +0000 (16:57 +0400)] 
sunrpc: Pass family to setup_socket calls

Now we have a single socket creation routine and can call it
directly from the setup_socket routines.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Merge xs_create_sock code
Pavel Emelyanov [Mon, 4 Oct 2010 12:56:38 +0000 (16:56 +0400)] 
sunrpc: Merge xs_create_sock code

After xs_bind is merged it's easy to merge its callers.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
[bfields@redhat.com: fix address family initialization]
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Merge the xs_bind code
Pavel Emelyanov [Tue, 5 Oct 2010 11:53:08 +0000 (15:53 +0400)] 
sunrpc: Merge the xs_bind code

There's the only difference betseen the xs_bind4 and the
xs_bind6 - the size of sockaddr structure they use.

Fortunatelly its size can be indirectly get from the transport.

Change since v1:
* use sockaddr_storage instead of sockaddr
* use rpc_set_port instead of manual port assigning

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
[bfields@redhat.com: fix address family initialization]
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Call xs_create_sockX directly from setup_socket
Pavel Emelyanov [Mon, 4 Oct 2010 12:55:38 +0000 (16:55 +0400)] 
sunrpc: Call xs_create_sockX directly from setup_socket

Remove now unneeded wrappers that just add type and protocol
to socket creation callback.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Factor out v6 sockets creation
Pavel Emelyanov [Mon, 4 Oct 2010 12:54:55 +0000 (16:54 +0400)] 
sunrpc: Factor out v6 sockets creation

Same patch for v6 protocols.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Factor out v4 sockets creation
Pavel Emelyanov [Mon, 4 Oct 2010 12:54:26 +0000 (16:54 +0400)] 
sunrpc: Factor out v4 sockets creation

The UDPv4 and TCPv4 socket creation callbacks now look very similar.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Factor out udp sockets creation
Pavel Emelyanov [Mon, 4 Oct 2010 12:53:46 +0000 (16:53 +0400)] 
sunrpc: Factor out udp sockets creation

Make it look like the TCP sockets creation.
Unfortunately the git diff made the patch look messy :(

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove duplicate xprt/transport arguments from calls
Pavel Emelyanov [Mon, 4 Oct 2010 12:52:55 +0000 (16:52 +0400)] 
sunrpc: Remove duplicate xprt/transport arguments from calls

The xs_tcp_reuse_connection takes the xprt only to pass it down
to the xs_abort_connection. The later one can get it from the given
transport itself.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Get xprt pointer once in xs_tcp_setup_socket
Pavel Emelyanov [Mon, 4 Oct 2010 12:52:25 +0000 (16:52 +0400)] 
sunrpc: Get xprt pointer once in xs_tcp_setup_socket

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove unused sock arg from xs_next_srcport
Pavel Emelyanov [Mon, 4 Oct 2010 12:51:56 +0000 (16:51 +0400)] 
sunrpc: Remove unused sock arg from xs_next_srcport

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Remove unused sock arg from xs_get_srcport
Pavel Emelyanov [Mon, 4 Oct 2010 12:51:23 +0000 (16:51 +0400)] 
sunrpc: Remove unused sock arg from xs_get_srcport

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosvcrdma: Cleanup DMA unmapping in error paths.
Tom Tucker [Tue, 12 Oct 2010 20:33:57 +0000 (15:33 -0500)] 
svcrdma: Cleanup DMA unmapping in error paths.

There are several error paths in the code that do not unmap DMA. This
patch adds calls to svc_rdma_unmap_dma to free these DMA contexts.

Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosvcrdma: Change DMA mapping logic to avoid the page_address kernel API
Tom Tucker [Tue, 12 Oct 2010 20:33:52 +0000 (15:33 -0500)] 
svcrdma: Change DMA mapping logic to avoid the page_address kernel API

There was logic in the send path that assumed that a page containing data
to send to the client has a KVA. This is not always the case and can result
in data corruption when page_address returns zero and we end up DMA mapping
zero.

This patch changes the bus mapping logic to avoid page_address() where
necessary and converts all calls from ib_dma_map_single to ib_dma_map_page
in order to keep the map/unmap calls symmetric.

Signed-off-by: Tom Tucker <tom@ogc.us>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: expire clients more promptly
J. Bruce Fields [Mon, 11 Oct 2010 20:49:44 +0000 (16:49 -0400)] 
nfsd4: expire clients more promptly

Expire clients more promptly, at the expense of possibly running the
laundromat thread more frequently.

Though it's not the default, I'd like it to be feasible to run with a
lease time of just a few seconds, at which point a minimum 10 second
wait between laundromat runs seems a little much.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Use helper to set v4 mapped addr in ip_map_parse
Pavel Emelyanov [Tue, 5 Oct 2010 16:48:02 +0000 (20:48 +0400)] 
sunrpc: Use helper to set v4 mapped addr in ip_map_parse

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc/cache: centralise handling of size limit on deferred list.
NeilBrown [Thu, 7 Oct 2010 04:29:46 +0000 (15:29 +1100)] 
sunrpc/cache: centralise handling of size limit on deferred list.

We limit the number of 'defer' requests to DFR_MAX.

The imposition of this limit is spread about a bit - sometime we don't
add new things to the list, sometimes we remove old things.

Also it is currently applied to requests which we are 'waiting' for
rather than 'deferring'.  This doesn't seem ideal as 'waiting'
requests are naturally limited by the number of threads.

So gather the DFR_MAX handling code to one place and only apply it to
requests that are actually being deferred.

This means that not all 'cache_deferred_req' structures go on the
'cache_defer_list, so we need to be careful when adding and removing
things.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Simplify cache_defer_req and related functions.
NeilBrown [Thu, 7 Oct 2010 04:29:46 +0000 (15:29 +1100)] 
sunrpc: Simplify cache_defer_req and related functions.

The return value from cache_defer_req is somewhat confusing.
Various different error codes are returned, but the single caller is
only interested in success or failure.

In fact it can measure this success or failure itself by checking
CACHE_PENDING, which makes the point of the code more explicit.

So change cache_defer_req to return 'void' and test CACHE_PENDING
after it completes, to see if the request was actually deferred or
not.

Similarly setup_deferral and cache_wait_req don't need a return value,
so make them void and remove some code.

The call to cache_revisit_request (to guard against a race) is only
needed for the second call to setup_deferral, so move it out of
setup_deferral to after that second call.  With the first call the
race is handled differently (by explicitly calling
'wait_for_completion').

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: return expired on unfound stateid's
J. Bruce Fields [Sat, 2 Oct 2010 22:42:39 +0000 (18:42 -0400)] 
nfsd4: return expired on unfound stateid's

Commit 78155ed75f470710f2aecb3e75e3d97107ba8374 "nfsd4: distinguish
expired from stale stateids" attempted to distinguish expired and stale
stateid's using time information that may not have been completely
reliable, so I reverted it.

That was throwing out the baby with the bathwater; we still do want to
return expired, but let's do that using the simpler approach of just
assuming any stateid is expired if it looks like it was given out by the
current server instance, but we can't find it any more.

This may help clients that are recovering from network partitions.

Reported-by: Bian Naimeng <biannm@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: add new connections to session
J. Bruce Fields [Wed, 29 Sep 2010 20:11:06 +0000 (16:11 -0400)] 
nfsd4: add new connections to session

As long as we're not implementing any session security, we should just
automatically add any new connections that come along to the list of
sessions associated with the session.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: refactor connection allocation
J. Bruce Fields [Wed, 29 Sep 2010 19:29:32 +0000 (15:29 -0400)] 
nfsd4: refactor connection allocation

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: use callbacks on svc_xprt_deletion
J. Bruce Fields [Sun, 6 Jun 2010 22:37:16 +0000 (18:37 -0400)] 
nfsd4: use callbacks on svc_xprt_deletion

Remove connections from the list when they go down.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd: provide callbacks on svc_xprt deletion
J. Bruce Fields [Mon, 22 Mar 2010 19:37:17 +0000 (15:37 -0400)] 
nfsd: provide callbacks on svc_xprt deletion

NFSv4.1 needs warning when a client tcp connection goes down, if that
connection is being used as a backchannel, so that it can warn the
client that it has lost the backchannel connection.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: keep per-session list of connections
J. Bruce Fields [Sun, 6 Jun 2010 22:12:14 +0000 (18:12 -0400)] 
nfsd4: keep per-session list of connections

The spec requires us in various places to keep track of the connections
associated with each session.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: clean up session allocation
J. Bruce Fields [Mon, 27 Sep 2010 21:12:05 +0000 (17:12 -0400)] 
nfsd4: clean up session allocation

Changes:
- make sure session memory reservation is released on failure
  path.
- use min_t()/min() for more compact code in several places.
- break alloc_init_session into smaller pieces.
- miscellaneous other cleanup.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: fix alloc_init_session return type
J. Bruce Fields [Mon, 27 Sep 2010 20:26:25 +0000 (16:26 -0400)] 
nfsd4: fix alloc_init_session return type

This returns an nfs error, not -ERRNO.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: fix alloc_init_session BUILD_BUG_ON()
J. Bruce Fields [Mon, 27 Sep 2010 20:22:30 +0000 (16:22 -0400)] 
nfsd4: fix alloc_init_session BUILD_BUG_ON()

Note we're allocating an array of nfsd4_slot *'s, not nfsd4_slot's.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: Move callback setup to callback queue
J. Bruce Fields [Sat, 5 Jun 2010 00:04:45 +0000 (20:04 -0400)] 
nfsd4: Move callback setup to callback queue

Instead of creating the new rpc client from a regular server thread,
set a flag, kick off a null call, and allow the null call to do the work
of setting up the client on the callback workqueue.

Use a spinlock to ensure the callback work gets a consistent view of the
callback parameters.

This allows, for example, changing the callback from contexts where
sleeping is not allowed.  I hope it will also keep the locking simple as
we add more session and trunking features, by serializing most of the
callback-specific work.

This also closes a small race where the the new cb_ident could be used
with an old connection (or vice-versa).

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: remove separate cb_args struct
J. Bruce Fields [Mon, 31 May 2010 22:21:37 +0000 (18:21 -0400)] 
nfsd4: remove separate cb_args struct

I don't see the point of the separate struct.  It seems to just be
getting in the way.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: use generic callback code in null case
J. Bruce Fields [Wed, 26 May 2010 21:52:14 +0000 (17:52 -0400)] 
nfsd4: use generic callback code in null case

This will eventually allow us, for example, to kick off null callback
from contexts where we can't sleep.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: generic callback code
J. Bruce Fields [Sun, 16 May 2010 20:47:08 +0000 (16:47 -0400)] 
nfsd4: generic callback code

Make the recall callback code more generic, so that other callbacks
will be able to use it too.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: rename nfs4_rpc_args->nfsd4_cb_args
J. Bruce Fields [Wed, 26 May 2010 21:46:00 +0000 (17:46 -0400)] 
nfsd4: rename nfs4_rpc_args->nfsd4_cb_args

With apologies for the gratuitous rename, the new name seems more
helpful to me.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: combine nfs4_rpc_args and nfsd4_cb_sequence
J. Bruce Fields [Wed, 26 May 2010 21:40:53 +0000 (17:40 -0400)] 
nfsd4: combine nfs4_rpc_args and nfsd4_cb_sequence

These two structs don't really need to be distinct as far as I can tell.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: minor variable renaming (cb -> conn)
J. Bruce Fields [Mon, 31 May 2010 23:09:40 +0000 (19:09 -0400)] 
nfsd4: minor variable renaming (cb -> conn)

Now that we have both nfsd4_callback and nfsd4_cb_conn structures, I get
confused if variables of both types are always named cb....

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
14 years agonfsd4: remove spkm3
J. Bruce Fields [Fri, 1 Oct 2010 19:40:01 +0000 (15:40 -0400)] 
nfsd4: remove spkm3

Unfortunately, spkm3 never got very far; while interoperability with one
other implementation was demonstrated at some point, problems were found
with the spec that were deemed not worth fixing.

The kernel code is useless on its own without nfs-utils patches which
were never merged into nfs-utils, and were only ever available from
citi.umich.edu.  They appear not to have been updated since 2005.

Therefore it seems safe to assume that this code has no users, and never
will.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: fix race in new cache_wait code.
NeilBrown [Wed, 22 Sep 2010 02:55:06 +0000 (12:55 +1000)] 
sunrpc: fix race in new cache_wait code.

If we set up to wait for a cache item to be filled in, and then find
that it is no longer pending, it could be that some other thread is
in 'cache_revisit_request' and has moved our request to its 'pending' list.
So when our setup_deferral calls cache_revisit_request it will find nothing to
put on the pending list, and do nothing.

We then return from cache_wait_req, thus leaving the 'sleeper'
on-stack structure open to being corrupted by subsequent stack usage.

However that 'sleeper' could still be on the 'pending' list that the
other thread is looking at and so any corruption could cause it to behave badly.

To avoid this race we simply take the same path as if the
'wait_for_completion_interruptible_timeout' was interrupted and if the
sleeper is no longer on the list (which it won't be) we wait on the
completion - which will ensure that any other cache_revisit_request
will have let go of the sleeper.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Create sockets in net namespaces
Pavel Emelyanov [Wed, 29 Sep 2010 12:06:57 +0000 (16:06 +0400)] 
sunrpc: Create sockets in net namespaces

The context is already known in all the sock_create callers.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonet: Export __sock_create
Pavel Emelyanov [Wed, 29 Sep 2010 12:06:32 +0000 (16:06 +0400)] 
net: Export __sock_create

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Tag rpc_xprt with net
Pavel Emelyanov [Wed, 29 Sep 2010 12:05:43 +0000 (16:05 +0400)] 
sunrpc: Tag rpc_xprt with net

The net is known from the xprt_create and this tagging will also
give un the context in the conntection workers where real sockets
are created.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Add net to xprt_create
Pavel Emelyanov [Wed, 29 Sep 2010 12:05:12 +0000 (16:05 +0400)] 
sunrpc: Add net to xprt_create

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Add net to rpc_create_args
Pavel Emelyanov [Wed, 29 Sep 2010 12:04:45 +0000 (16:04 +0400)] 
sunrpc: Add net to rpc_create_args

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Pull net argument downto svc_create_socket
Pavel Emelyanov [Wed, 29 Sep 2010 12:04:18 +0000 (16:04 +0400)] 
sunrpc: Pull net argument downto svc_create_socket

After this the socket creation in it knows the context.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Add net argument to svc_create_xprt
Pavel Emelyanov [Wed, 29 Sep 2010 12:03:50 +0000 (16:03 +0400)] 
sunrpc: Add net argument to svc_create_xprt

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Factor out rpc_xprt freeing
Pavel Emelyanov [Wed, 29 Sep 2010 12:03:13 +0000 (16:03 +0400)] 
sunrpc: Factor out rpc_xprt freeing

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Factor out rpc_xprt allocation
Pavel Emelyanov [Wed, 29 Sep 2010 12:02:43 +0000 (16:02 +0400)] 
sunrpc: Factor out rpc_xprt allocation

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: adjust buflen for encoded attrs bitmap based on actual bitmap length
Benny Halevy [Thu, 30 Sep 2010 18:47:46 +0000 (20:47 +0200)] 
nfsd4: adjust buflen for encoded attrs bitmap based on actual bitmap length

The existing code adjusted it based on the worst case scenario for the returned
bitmap and the best case scenario for the supported attrs attribute.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[bfields@redhat.com: removed likely/unlikely's]
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: fix up rpcauth_remove_module section mismatch
Stephen Rothwell [Wed, 29 Sep 2010 04:16:57 +0000 (14:16 +1000)] 
sunrpc: fix up rpcauth_remove_module section mismatch

On Wed, 29 Sep 2010 14:02:38 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> After merging the final tree, today's linux-next build (powerpc
> ppc44x_defconfig) produced tis warning:
>
> WARNING: net/sunrpc/sunrpc.o(.init.text+0x110): Section mismatch in reference from the function init_sunrpc() to the function .exit.text:rpcauth_remove_module()
> The function __init init_sunrpc() references
> a function __exit rpcauth_remove_module().
> This is often seen when error handling in the init function
> uses functionality in the exit path.
> The fix is often to remove the __exit annotation of
> rpcauth_remove_module() so it may be used outside an exit section.
>
> Probably caused by commit 2f72c9b73730c335381b13e2bd221abe1acea394
> ("sunrpc: The per-net skeleton").

This actually causes a build failure on a sparc32 defconfig build:

`rpcauth_remove_module' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o

I applied the following patch for today:

Fixes:

`rpcauth_remove_module' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Make the ip_map_cache be per-net
Pavel Emelyanov [Mon, 27 Sep 2010 10:02:29 +0000 (14:02 +0400)] 
sunrpc: Make the ip_map_cache be per-net

Everything that is required for that already exists:
* the per-net cache registration with respective proc entries
* the context (struct net) is available in all the users

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Make the /proc/net/rpc appear in net namespaces
Pavel Emelyanov [Mon, 27 Sep 2010 10:01:58 +0000 (14:01 +0400)] 
sunrpc: Make the /proc/net/rpc appear in net namespaces

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: The per-net skeleton
Pavel Emelyanov [Mon, 27 Sep 2010 10:01:27 +0000 (14:01 +0400)] 
sunrpc: The per-net skeleton

Register empty per-net operations for the sunrpc layer.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Tag svc_xprt with net
Pavel Emelyanov [Mon, 27 Sep 2010 10:00:49 +0000 (14:00 +0400)] 
sunrpc: Tag svc_xprt with net

The transport representation should be per-net of course.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Add routines that allow registering per-net caches
Pavel Emelyanov [Mon, 27 Sep 2010 10:00:15 +0000 (14:00 +0400)] 
sunrpc: Add routines that allow registering per-net caches

Existing calls do the same, but for the init_net.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Add net to pure API calls
Pavel Emelyanov [Mon, 27 Sep 2010 09:59:48 +0000 (13:59 +0400)] 
sunrpc: Add net to pure API calls

There are two calls that operate on ip_map_cache and are
directly called from the nfsd code. Other places will be
handled in a different way.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Pass xprt to cached get/put routines
Pavel Emelyanov [Mon, 27 Sep 2010 09:59:13 +0000 (13:59 +0400)] 
sunrpc: Pass xprt to cached get/put routines

They do not require the rqst actually and having the xprt simplifies
further patching.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Make xprt auth cache release work with the xprt
Pavel Emelyanov [Mon, 27 Sep 2010 09:58:42 +0000 (13:58 +0400)] 
sunrpc: Make xprt auth cache release work with the xprt

This is done in order to facilitate getting the ip_map_cache from
which to put the ip_map.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: Pass the ip_map_parse's cd to lower calls
Pavel Emelyanov [Mon, 27 Sep 2010 09:57:36 +0000 (13:57 +0400)] 
sunrpc: Pass the ip_map_parse's cd to lower calls

The target is to have many ip_map_cache-s in the system. This particular
patch handles its usage by the ip_map_parse callback.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd: fix /proc/net/rpc/nfsd.export/content display
J. Bruce Fields [Fri, 24 Sep 2010 21:43:59 +0000 (17:43 -0400)] 
nfsd: fix /proc/net/rpc/nfsd.export/content display

Note with "first" always 0, and "lastflags" initially 0, we always dump
a spurious set of 0 flags at the start, among other problems.

Fix.  And attempt to make the code a little more obvious.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd: Export get_task_comm for nfsd
Pavel Emelyanov [Thu, 23 Sep 2010 14:26:58 +0000 (18:26 +0400)] 
nfsd: Export get_task_comm for nfsd

The git://linux-nfs.org/~bfields/linux.git nfsd-next branch doesn't
compile when nfsd is a module with the following error:

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

Replace the get_task_comm call with direct comm access, which is
safe for current.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd: allow deprecated interface to be compiled out.
NeilBrown [Wed, 22 Sep 2010 02:55:07 +0000 (12:55 +1000)] 
nfsd: allow deprecated interface to be compiled out.

Add CONFIG_NFSD_DEPRECATED, default to y.
Only include deprecated interface if this is defined.
This allows distros to remove this interface before the official
removal, and allows developers to test without it.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd: formally deprecate legacy nfsd syscall interface
NeilBrown [Wed, 22 Sep 2010 02:55:07 +0000 (12:55 +1000)] 
nfsd: formally deprecate legacy nfsd syscall interface

The syscall interface is has been replaced by a more flexible
interface since 2.6.0.  It is time to work towards discarding
the old interface.

So add a entry in feature-removal-schedule.txt and print a warning
when the interface is used.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc/cache: fix recent breakage of cache_clean_deferred
NeilBrown [Wed, 22 Sep 2010 02:55:06 +0000 (12:55 +1000)] 
sunrpc/cache: fix recent breakage of cache_clean_deferred

commit 6610f720e9e8103c22d1f1ccf8fbb695550a571f
broke cache_clean_deferred as entries are no longer added to the
pending list for subsequent revisiting.

So put those requests back on the pending list.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agolockd: Mostly remove BKL from the server
Bryan Schumaker [Tue, 21 Sep 2010 20:38:12 +0000 (16:38 -0400)] 
lockd: Mostly remove BKL from the server

This patch removes all but one call to lock_kernel() from the server.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc/cache: don't use custom hex_to_bin() converter
Andy Shevchenko [Tue, 21 Sep 2010 06:40:25 +0000 (09:40 +0300)] 
sunrpc/cache: don't use custom hex_to_bin() converter

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc/cache: change deferred-request hash table to use hlist.
NeilBrown [Thu, 12 Aug 2010 07:04:08 +0000 (17:04 +1000)] 
sunrpc/cache: change deferred-request hash table to use hlist.

Being a hash table, hlist is the best option.

There is currently some ugliness were we treat "->next == NULL" as
a special case to avoid having to initialise the whole array.
This change nicely gets rid of that case.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosvcauth_gss: replace a trivial 'switch' with an 'if'
NeilBrown [Thu, 12 Aug 2010 07:04:07 +0000 (17:04 +1000)] 
svcauth_gss: replace a trivial 'switch' with an 'if'

Code like:

  switch(xxx) {
  case -error1:
  case -error2:
     ..
     return;
  case 0:
     stuff;
  }

  can more naturally be written:

  if (xxx < 0)
      return;

  stuff;

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd/idmap: drop special request deferal in favour of improved default.
NeilBrown [Thu, 12 Aug 2010 07:04:06 +0000 (17:04 +1000)] 
nfsd/idmap: drop special request deferal in favour of improved default.

The idmap code manages request deferal by waiting for a reply from
userspace rather than putting the NFS request on a queue to be retried
from the start.
Now that the common deferal code does this there is no need for the
special code in idmap.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd: disable deferral for NFSv4
NeilBrown [Thu, 12 Aug 2010 07:04:07 +0000 (17:04 +1000)] 
nfsd: disable deferral for NFSv4

Now that a slight delay in getting a reply to an upcall doesn't
require deferring of requests, request deferral for all NFSv4
requests - the concept doesn't really fit with the v4 model.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agosunrpc: close connection when a request is irretrievably lost.
NeilBrown [Thu, 12 Aug 2010 07:04:07 +0000 (17:04 +1000)] 
sunrpc: close connection when a request is irretrievably lost.

If we drop a request in the sunrpc layer, either due kmalloc failure,
or due to a cache miss when we could not queue the request for later
replay, then close the connection to encourage the client to retry sooner.

Note that if the drop happens in the NFS layer, NFSERR_JUKEBOX
(aka NFS4ERR_DELAY) is returned to guide the client concerning
replay.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agonfsd4: fix hang on fast-booting nfs servers
J. Bruce Fields [Mon, 20 Sep 2010 02:55:06 +0000 (22:55 -0400)] 
nfsd4: fix hang on fast-booting nfs servers

The last_close field of a cache_detail is initialized to zero, so the
condition

detail->last_close < seconds_since_boot() - 30

may be false even for a cache that was never opened.

However, we want to immediately fail upcalls to caches that were never
opened: in the case of the auth_unix_gid cache, especially, which may
never be opened by mountd (if the --manage-gids option is not set), we
want to fail the upcall immediately.  Otherwise client requests will be
dropped unnecessarily on reboot.

Also document these conditions.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 years agoMerge remote branch 'trond/bugfixes' into for-2.6.37
J. Bruce Fields [Mon, 20 Sep 2010 03:48:00 +0000 (23:48 -0400)] 
Merge remote branch 'trond/bugfixes' into for-2.6.37

Without some client-side fixes, server testing is currently difficult.

14 years agoSUNRPC: Fix the NFSv4 and RPCSEC_GSS Kconfig dependencies
Trond Myklebust [Sun, 12 Sep 2010 23:57:50 +0000 (19:57 -0400)] 
SUNRPC: Fix the NFSv4 and RPCSEC_GSS Kconfig dependencies

The NFSv4 client's callback server calls svc_gss_principal(), which
is defined in the auth_rpcgss.ko

The NFSv4 server has the same dependency, and in addition calls
svcauth_gss_flavor(), gss_mech_get_by_pseudoflavor(),
gss_pseudoflavor_to_service() and gss_mech_put() from the same module.

The module auth_rpcgss itself has no dependencies aside from sunrpc,
so we only need to select RPCSEC_GSS.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agostatfs() gives ESTALE error
Menyhart Zoltan [Sun, 12 Sep 2010 23:55:26 +0000 (19:55 -0400)] 
statfs() gives ESTALE error

Hi,

An NFS client executes a statfs("file", &buff) call.
"file" exists / existed, the client has read / written it,
but it has already closed it.

user_path(pathname, &path) looks up "file" successfully in the
directory-cache  and restarts the aging timer of the directory-entry.
Even if "file" has already been removed from the server, because the
lookupcache=positive option I use, keeps the entries valid for a while.

nfs_statfs() returns ESTALE if "file" has already been removed from the
server.

If the user application repeats the statfs("file", &buff) call, we
are stuck: "file" remains young forever in the directory-cache.

Signed-off-by: Zoltan Menyhart <Zoltan.Menyhart@bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
14 years agoNFS: Fix a typo in nfs_sockaddr_match_ipaddr6
Trond Myklebust [Sun, 12 Sep 2010 23:55:26 +0000 (19:55 -0400)] 
NFS: Fix a typo in nfs_sockaddr_match_ipaddr6

Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
14 years agosunrpc: increase MAX_HASHTABLE_BITS to 14
Miquel van Smoorenburg [Sun, 12 Sep 2010 23:55:26 +0000 (19:55 -0400)] 
sunrpc: increase MAX_HASHTABLE_BITS to 14

The maximum size of the authcache is now set to 1024 (10 bits),
but on our server we need at least 4096 (12 bits). Increase
MAX_HASHTABLE_BITS to 14. This is a maximum of 16384 entries,
each containing a pointer (8 bytes on x86_64). This is
exactly the limit of kmalloc() (128K).

Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agogss:spkm3 miss returning error to caller when import security context
Bian Naimeng [Sun, 12 Sep 2010 23:55:26 +0000 (19:55 -0400)] 
gss:spkm3 miss returning error to caller when import security context

spkm3 miss returning error to up layer when import security context,
it may be return ok though it has failed to import security context.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agogss:krb5 miss returning error to caller when import security context
Bian Naimeng [Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)] 
gss:krb5 miss returning error to caller when import security context

krb5 miss returning error to up layer when import security context,
it may be return ok though it has failed to import security context.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoRemove incorrect do_vfs_lock message
Fabio Olive Leite [Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)] 
Remove incorrect do_vfs_lock message

The do_vfs_lock function on fs/nfs/file.c is only called if NLM is
not being used, via the -onolock mount option. Therefore it cannot
really be "out of sync with lock manager" when the local locking
function called returns an error, as there will be no corresponding
call to the NLM. For details, simply check the if/else on do_setlk
and do_unlk on fs/nfs/file.c.

Signed-Off-By: Fabio Olive Leite <fleite@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: cleanup state-machine ordering
J. Bruce Fields [Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)] 
SUNRPC: cleanup state-machine ordering

This is just a minor cleanup: net/sunrpc/clnt.c clarifies the rpc client
state machine by commenting each state and by laying out the functions
implementing each state in the order that each state is normally
executed (in the absence of errors).

The previous patch "Fix null dereference in call_allocate" changed the
order of the states.  Move the functions and update the comments to
reflect the change.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Fix a race in rpc_info_open
Trond Myklebust [Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)] 
SUNRPC: Fix a race in rpc_info_open

There is a race between rpc_info_open and rpc_release_client()
in that nothing stops a process from opening the file after
the clnt->cl_kref goes to zero.

Fix this by using atomic_inc_unless_zero()...

Reported-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
14 years agoSUNRPC: Fix race corrupting rpc upcall
Trond Myklebust [Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)] 
SUNRPC: Fix race corrupting rpc upcall

If rpc_queue_upcall() adds a new upcall to the rpci->pipe list just
after rpc_pipe_release calls rpc_purge_list(), but before it calls
gss_pipe_release (as rpci->ops->release_pipe(inode)), then the latter
will free a message without deleting it from the rpci->pipe list.

We will be left with a freed object on the rpc->pipe list.  Most
frequent symptoms are kernel crashes in rpc.gssd system calls on the
pipe in question.

Reported-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
14 years agoFix null dereference in call_allocate
J. Bruce Fields [Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)] 
Fix null dereference in call_allocate

In call_allocate we need to reach the auth in order to factor au_cslack
into the allocation.

As of a17c2153d2e271b0cbacae9bed83b0eaa41db7e1 "SUNRPC: Move the bound
cred to struct rpc_rqst", call_allocate attempts to do this by
dereferencing tk_client->cl_auth, however this is not guaranteed to be
defined--cl_auth can be zero in the case of gss context destruction (see
rpc_free_auth).

Reorder the client state machine to bind credentials before allocating,
so that we can instead reach the auth through the cred.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
14 years agoLinux 2.6.36-rc4
Linus Torvalds [Sun, 12 Sep 2010 23:07:37 +0000 (16:07 -0700)] 
Linux 2.6.36-rc4

14 years agodocbook: skip files with no docs since they generate scary warnings
Randy Dunlap [Sat, 11 Sep 2010 22:55:26 +0000 (15:55 -0700)] 
docbook: skip files with no docs since they generate scary warnings

Fix docbook templates that reference files that do not contain the
expected kernel-doc notation.

Fixes these warnings:

  Warning(arch/x86/include/asm/unaligned.h): no structured comments found
  Warning(lib/vsprintf.c): no structured comments found

These cause errors in the generated html output, like below, so drop
these lines.

  Name
  arch/x86/include/asm/unaligned.h - Document generation inconsistency
  Oops
  Warning
  The template for this document tried to insert the structured comment from the file arch/x86/include/asm/unaligned.h at this point, but none was found. This dummy section is inserted to allow generation to continue.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agodocbook: warn on unused doc entries
Johannes Berg [Sat, 11 Sep 2010 22:55:22 +0000 (15:55 -0700)] 
docbook: warn on unused doc entries

When you don't use !E or !I but only !F, then it's very easy to miss
including some functions, structs etc.  in documentation.  To help
finding which ones were missed, allow printing out the unused ones as
warnings.

For example, using this on mac80211 yields a lot of warnings like this:

  Warning: didn't use docs for DOC: mac80211 workqueue
  Warning: didn't use docs for ieee80211_max_queues
  Warning: didn't use docs for ieee80211_bss_change
  Warning: didn't use docs for ieee80211_bss_conf

when generating the documentation for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agokernel-doc: ignore case when stripping attributes
Johannes Berg [Sat, 11 Sep 2010 22:55:12 +0000 (15:55 -0700)] 
kernel-doc: ignore case when stripping attributes

There are valid attributes that could have upper case letters, but we
still want to remove, like for example
__attribute__((aligned(NETDEV_ALIGN)))
as encountered in the wireless code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspe...
Linus Torvalds [Sat, 11 Sep 2010 22:50:53 +0000 (15:50 -0700)] 
Merge branch 'pm-fixes' of git://git./linux/kernel/git/rafael/suspend-2.6

* 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  PM / Hibernate: Avoid hitting OOM during preallocation of memory
  PM QoS: Correct pr_debug() misuse and improve parameter checks
  PM: Prevent waiting forever on asynchronous resume after failing suspend

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
Linus Torvalds [Sat, 11 Sep 2010 19:17:02 +0000 (12:17 -0700)] 
Merge git://git./linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] fix use-after-free in scsi_init_io()
  [SCSI] sd: fix medium-removal bug
  [SCSI] qla2xxx: Update version number to 8.03.04-k0.
  [SCSI] qla2xxx: Check for empty slot in request queue before posting Command type 6 request.
  [SCSI] qla2xxx: Cover UNDERRUN case where SCSI status is set.
  [SCSI] qla2xxx: Correctly set fw hung and complete only waiting mbx.
  [SCSI] qla2xxx: Reset seconds_since_last_heartbeat correctly.
  [SCSI] qla2xxx: make rport deletions explicit during vport removal
  [SCSI] qla2xxx: Fix vport delete issues
  [SCSI] sd, sym53c8xx: Remove warnings after vsprintf %pV introducation.
  [SCSI] Fix warning: zero-length gnu_printf format string
  [SCSI] hpsa: disable doorbell reset on reset_devices
  [SCSI] be2iscsi: Fix for Login failure
  [SCSI] fix bio.bi_rw handling

14 years agoPM / Hibernate: Avoid hitting OOM during preallocation of memory
Rafael J. Wysocki [Sat, 11 Sep 2010 18:58:27 +0000 (20:58 +0200)] 
PM / Hibernate: Avoid hitting OOM during preallocation of memory

There is a problem in hibernate_preallocate_memory() that it calls
preallocate_image_memory() with an argument that may be greater than
the total number of available non-highmem memory pages.  If that's
the case, the OOM condition is guaranteed to trigger, which in turn
can cause significant slowdown to occur during hibernation.

To avoid that, make preallocate_image_memory() adjust its argument
before calling preallocate_image_pages(), so that the total number of
saveable non-highem pages left is not less than the minimum size of
a hibernation image.  Change hibernate_preallocate_memory() to try to
allocate from highmem if the number of pages allocated by
preallocate_image_memory() is too low.

Modify free_unnecessary_pages() to take all possible memory
allocation patterns into account.

Reported-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: M. Vefa Bicakci <bicave@superonline.com>
14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Sat, 11 Sep 2010 15:06:38 +0000 (08:06 -0700)] 
Merge git://git./linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (28 commits)
  ipheth: remove incorrect devtype to WWAN
  MAINTAINERS: Add CAIF
  sctp: fix test for end of loop
  KS8851: Correct RX packet allocation
  udp: add rehash on connect()
  net: blackhole route should always be recalculated
  ipv4: Suppress lockdep-RCU false positive in FIB trie (3)
  niu: Fix kernel buffer overflow for ETHTOOL_GRXCLSRLALL
  ipvs: fix active FTP
  gro: Re-fix different skb headrooms
  via-velocity: Turn scatter-gather support back off.
  ipv4: Fix reverse path filtering with multipath routing.
  UNIX: Do not loop forever at unix_autobind().
  PATCH: b44 Handle RX FIFO overflow better (simplified)
  irda: off by one
  3c59x: Fix deadlock in vortex_error()
  netfilter: discard overlapping IPv6 fragment
  ipv6: discard overlapping fragment
  net: fix tx queue selection for bridged devices implementing select_queue
  bonding: Fix jiffies overflow problems (again)
  ...

Fix up trivial conflicts due to the same cgroup API thinko fix going
through both Andrew and the networking tree.  However, there were small
differences between the two, with Andrew's version generally being the
nicer one, and the one I merged first. So pick that one.

Conflicts in: include/linux/cgroup.h and kernel/cgroup.c

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Sat, 11 Sep 2010 15:01:09 +0000 (08:01 -0700)] 
Merge git://git./linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc: Kill all BKL usage.

This page took 0.068122 seconds and 5 git commands to generate.