safe/jmp/linux-2.6
14 years agoNFSv41: Fix a potential state leakage when restarting nfs4_close_prepare
Trond Myklebust [Tue, 8 Dec 2009 13:33:16 +0000 (08:33 -0500)]
NFSv41: Fix a potential state leakage when restarting nfs4_close_prepare

Currently, if the call to nfs4_setup_sequence() in nfs4_close_prepare
fails, any later retries will fail to launch an RPC call, due to the fact
that the &state->flags will have been cleared.
Ditto if nfs4_close_done() triggers a call to the NFSv4.1 version of
nfs_restart_rpc().

We therefore move the actual clearing of the state->flags to
nfs4_close_done(), when we know that the RPC call was successful.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: Handle NFSv4.1 session errors in the delegation recall code
Ricardo Labiaga [Mon, 7 Dec 2009 14:48:30 +0000 (09:48 -0500)]
nfs41: Handle NFSv4.1 session errors in the delegation recall code

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: Retry delegation return if it failed with session error
Ricardo Labiaga [Mon, 7 Dec 2009 14:23:21 +0000 (09:23 -0500)]
nfs41: Retry delegation return if it failed with session error

Update nfs4_delegreturn_done() to retry the operation after setting the
NFS4CLNT_SESSION_SETUP bit to indicate the need to reset the session.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: Handle session errors during delegation return
Ricardo Labiaga [Mon, 7 Dec 2009 14:22:29 +0000 (09:22 -0500)]
nfs41: Handle session errors during delegation return

Add session error handling to nfs4_open_delegation_recall()

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: Mark stateids in need of reclaim if state manager gets stale clientid
Ricardo Labiaga [Mon, 7 Dec 2009 14:16:09 +0000 (09:16 -0500)]
nfs41: Mark stateids in need of reclaim if state manager gets stale clientid

The state manager was not marking the stateids as needing to be reclaimed
after reestablishing the clientid.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFS: Fix up the declaration of nfs4_restart_rpc when NFSv4 not configured
Trond Myklebust [Mon, 7 Dec 2009 14:00:24 +0000 (09:00 -0500)]
NFS: Fix up the declaration of nfs4_restart_rpc when NFSv4 not configured

Also rename it: it is used in generic code, and so should not have a 'nfs4'
prefix.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: Don't clear DRAINING flag on NFS4ERR_STALE_CLIENTID
Ricardo Labiaga [Sun, 6 Dec 2009 17:57:34 +0000 (12:57 -0500)]
nfs41: Don't clear DRAINING flag on NFS4ERR_STALE_CLIENTID

If CREATE_SESSION fails with NFS4ERR_STALE_CLIENTID, don't clear the
NFS4CLNT_SESSION_DRAINING flag and don't wake RPCs waiting for the
session to be reestablished.  We don't have a session yet, so there
is no reason to wake other RPCs.

This avoids sending spurious compounds with bogus sequenceID during
session and state recovery.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
[Trond.Myklebust@netapp.com: cleaned up patch by adding the
                             nfs41_begin/end_drain_session() helpers]
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: nfs41_setup_state_renewal
Ricardo Labiaga [Sun, 6 Dec 2009 17:23:46 +0000 (12:23 -0500)]
nfs41: nfs41_setup_state_renewal

Move call to get the lease time and the setup of the state
renewal out of nfs4_create_session so that it can be called
after clearing the DRAINING flag.  We use the getattr RPC
to obtain the lease time, which requires a sequence slot.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv41: More cleanups
Trond Myklebust [Sun, 6 Dec 2009 00:32:19 +0000 (19:32 -0500)]
NFSv41: More cleanups

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv41: Fix up some bugs in the NFS4CLNT_SESSION_DRAINING code
Trond Myklebust [Sun, 6 Dec 2009 00:32:19 +0000 (19:32 -0500)]
NFSv41: Fix up some bugs in the NFS4CLNT_SESSION_DRAINING code

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv41: Clean up slot table management
Trond Myklebust [Sun, 6 Dec 2009 00:32:19 +0000 (19:32 -0500)]
NFSv41: Clean up slot table management

We no longer need to maintain a distinction between nfs41_sequence_done and
nfs41_sequence_free_slot.

This fixes a number of slot table leakages in the NFSv4.1 code.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv41: Fix nfs4_proc_create_session
Trond Myklebust [Sun, 6 Dec 2009 00:32:11 +0000 (19:32 -0500)]
NFSv41: Fix nfs4_proc_create_session

We should not assume that nfs41_init_clientid() will always want to
initialise the session. If it is being called due to a server reboot, then
we just want to reset the session after re-establishing the clientid.

Fix this by getting rid of the 'reset' parameter in
nfs4_proc_create_session(), and instead relying on whether or not the
session slot table pointer is non-NULL.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: Invoke RECLAIM_COMPLETE
Ricardo Labiaga [Sat, 5 Dec 2009 21:08:41 +0000 (16:08 -0500)]
nfs41: Invoke RECLAIM_COMPLETE

This patch invokes RECLAIM_COMPLETE after the client is done
reclaiming state.

There are interpretations of the spec that suggest that
RECLAIM_COMPLETE should also be issued after a new clientid
has been obtained from the server and even if there is no
state to reclaim.  This tells the server that the client
has no state to reclaim even if the client isn't aware the
server may have rebooted.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: RECLAIM_COMPLETE functionality
Ricardo Labiaga [Sat, 5 Dec 2009 21:08:41 +0000 (16:08 -0500)]
nfs41: RECLAIM_COMPLETE functionality

Implements RECLAIM_COMPLETE as an asynchronous RPC.
NFS4ERR_DELAY is retried, NFS4ERR_DEADSESSION invokes the error handling
but does not result in a retry, since we don't want to have a lingering
RECLAIM_COMPLETE call sent in the middle of a possible new state recovery
cycle.  If a session reset occurs, a new wave of reclaim operations will
follow, containing their own RECLAIM_COMPLETE call.  We don't want a
retry to get on the way of recovery by incorrectly indicating to the
server that we're done reclaiming state.

A subsequent patch invokes the functionality.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: RECLAIM_COMPLETE XDR functionality
Ricardo Labiaga [Sat, 5 Dec 2009 21:08:40 +0000 (16:08 -0500)]
nfs41: RECLAIM_COMPLETE XDR functionality

XDR encoding and decoding for RECLAIM_COMPLETE.  Implements the necessary
encoding to indicate reclaim complete for the entire client.  In the future,
it can be extended to provide reclaim complete functionality for a single
file system after migration.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoCleanup some NFSv4 XDR decode comments
Ricardo Labiaga [Sat, 5 Dec 2009 21:08:39 +0000 (16:08 -0500)]
Cleanup some NFSv4 XDR decode comments

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv41: nfs4_reset_session must always set NFS4CLNT_SESSION_DRAINING
Trond Myklebust [Sat, 5 Dec 2009 20:03:20 +0000 (15:03 -0500)]
NFSv41: nfs4_reset_session must always set NFS4CLNT_SESSION_DRAINING

Otherwise we have no guarantees that other processes won't start another
RPC call while we're resetting the session.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: v2 fix cb_recall bug
Alexandros Batsakis [Sat, 5 Dec 2009 18:48:55 +0000 (13:48 -0500)]
nfs41: v2 fix cb_recall bug

in NFSv4.1 the seqid part of a stateid in CB_RECALL must be 0

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: check SEQUENCE status flag
Alexandros Batsakis [Sat, 5 Dec 2009 18:46:14 +0000 (13:46 -0500)]
nfs41: check SEQUENCE status flag

the server can indicate a number of error conditions by setting the
appropriate bits in the SEQUENCE operation. The client re-establishes
state with the server when it receives one of those, with the action
depending on the specific case.

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: V2 adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize
Alexandros Batsakis [Sat, 5 Dec 2009 18:36:55 +0000 (13:36 -0500)]
nfs41: V2 adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize

The v4.1 client should take into account the desired rsize, wsize when
negotiating the max size in CREATE_SESSION. Accordingly, it should use
rsize, wsize that are smaller than the session negotiated values.

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: remove server-only EXCHGID4_FLAG_CONFIRMED_R flag from exchange_id
Alexandros Batsakis [Sat, 5 Dec 2009 18:33:25 +0000 (13:33 -0500)]
nfs41: remove server-only EXCHGID4_FLAG_CONFIRMED_R flag from exchange_id

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: add support for the exclusive create flags
Alexandros Batsakis [Sat, 5 Dec 2009 18:30:21 +0000 (13:30 -0500)]
nfs41: add support for the exclusive create flags

In v4.1 the client MUST/SHOULD use the EXCLUSIVE4_1 flag instead of
EXCLUSIVE4, and GUARDED when the server supports persistent sessions.
For now (and until we support suppattr_exclcreat), we don't send any
attributes with EXCLUSIVE4_1 relying in the subsequent SETATTR as in v4.0

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: check if session exists and if it is persistent
Alexandros Batsakis [Sat, 5 Dec 2009 18:29:53 +0000 (13:29 -0500)]
nfs41: check if session exists and if it is persistent

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: V2 initial support for CB_RECALL_ANY
Alexandros Batsakis [Sat, 5 Dec 2009 18:27:02 +0000 (13:27 -0500)]
nfs41: V2 initial support for CB_RECALL_ANY

For now the clients returns _all_ the delegations of the specificed type
it holds

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs4: V2 return/expire delegations depending on their type
Alexandros Batsakis [Sat, 5 Dec 2009 18:20:52 +0000 (13:20 -0500)]
nfs4: V2 return/expire delegations depending on their type

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs4: minor delegation cleaning
Alexandros Batsakis [Sat, 5 Dec 2009 18:19:11 +0000 (13:19 -0500)]
nfs4: minor delegation cleaning

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: add support for callback with RPC version number 4
Alexandros Batsakis [Sat, 5 Dec 2009 18:19:01 +0000 (13:19 -0500)]
nfs41: add support for callback with RPC version number 4

The NFSv4.1 spec-29 (18.36.3) says that the server MUST use an ONC RPC
(program) version number equal to 4 in callbacks sent to the client.
For now we allow both versions 1 and 4.

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: only state manager sets NFS4CLNT_SESSION_SETUP
Andy Adamson [Fri, 4 Dec 2009 21:02:14 +0000 (16:02 -0500)]
nfs41: only state manager sets NFS4CLNT_SESSION_SETUP

Replace sync and async handlers setting of the NFS4CLNT_SESSION_SETUP bit with
setting NFS4CLNT_CHECK_LEASE, and let the state manager decide to reset the session.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: drain session cleanup
Andy Adamson [Fri, 4 Dec 2009 20:55:39 +0000 (15:55 -0500)]
nfs41: drain session cleanup

Do not wake up the next slot_tbl_waitq task in nfs4_free_slot because we
may be draining the slot. Either signal the state manager that the session
is drained (the state manager wakes up tasks) OR wake up the next task.

In nfs41_sequence_done, the slot dereference is only needed in the sequence
operation success case.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: nfs41: fix state manager deadlock in session reset
Andy Adamson [Fri, 4 Dec 2009 20:55:38 +0000 (15:55 -0500)]
nfs41: nfs41: fix state manager deadlock in session reset

If the session is reset during state recovery, the state manager thread can
sleep on the slot_tbl_waitq causing a deadlock.

Add a completion framework to the session.  Have the state manager thread set
a new session state (NFS4CLNT_SESSION_DRAINING) and wait for the session slot
table to drain.

Signal the state manager thread in nfs41_sequence_free_slot when the
NFS4CLNT_SESSION_DRAINING bit is set and the session is drained.

Reported-by: Trond Myklebust <trond@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: remove nfs4_recover_session
Andy Adamson [Fri, 4 Dec 2009 20:55:37 +0000 (15:55 -0500)]
nfs41: remove nfs4_recover_session

nfs4_recover_session can put rpciod to sleep. Just use nfs4_schedule_recovery.

Reported-by: Trond Myklebust <trond.myklebust@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: don't clear tk_action on success
Andy Adamson [Fri, 4 Dec 2009 20:55:35 +0000 (15:55 -0500)]
nfs41: don't clear tk_action on success

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: fix switch in nfs4_recovery_handle_error
Andy Adamson [Fri, 4 Dec 2009 20:55:34 +0000 (15:55 -0500)]
nfs41: fix switch in nfs4_recovery_handle_error

Do not fall through and set NFS4CLNT_SESSION_RESET bit on NFS4ERR_EXPIRED

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: fix switch in nfs4_handle_exception
Andy Adamson [Fri, 4 Dec 2009 20:55:32 +0000 (15:55 -0500)]
nfs41: fix switch in nfs4_handle_exception

Do not fall through and call nfs4_delay on session error handling.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: free the slot on unhandled read errors
Andy Adamson [Fri, 4 Dec 2009 20:55:30 +0000 (15:55 -0500)]
nfs41: free the slot on unhandled read errors

nfs4_read_done returns zero on unhandled errors. nfs_readpage_result will
return on a negative tk_status without freeing the slot.
Call nfs4_sequence_free_slot on unhandled errors in nfs4_read_done.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: call free slot from nfs4_restart_rpc
Andy Adamson [Fri, 4 Dec 2009 20:55:29 +0000 (15:55 -0500)]
nfs41: call free slot from nfs4_restart_rpc

nfs41_sequence_free_slot can be called multiple times on SEQUENCE operation
errors.
No reason to inline nfs4_restart_rpc

Reported-by: Trond Myklebust <trond.myklebust@netapp.com>
nfs_writeback_done and nfs_readpage_retry call nfs4_restart_rpc outside the
error handler, and the slot is not freed prior to restarting in the rpc_prepare
state during session reset.

Fix this by moving the call to nfs41_sequence_free_slot from the error
path of nfs41_sequence_done into nfs4_restart_rpc, and by removing the test
for NFS4CLNT_SESSION_SETUP.
Always free slot and goto the rpc prepare state on async errors.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: nfs4_get_lease_time will never session reset
Andy Adamson [Fri, 4 Dec 2009 20:55:27 +0000 (15:55 -0500)]
nfs41: nfs4_get_lease_time will never session reset

Make this clear by calling rpc_restart-call.
Prepare for nfs4_restart_rpc() to free slots.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: rename cl_state session SETUP bit to RESET
Andy Adamson [Fri, 4 Dec 2009 20:55:05 +0000 (15:55 -0500)]
nfs41: rename cl_state session SETUP bit to RESET

The bit is no longer used for session setup, only for session reset.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs41: add create session into establish_clid
Andy Adamson [Fri, 4 Dec 2009 20:52:24 +0000 (15:52 -0500)]
nfs41: add create session into establish_clid

Reported-by: Trond Myklebust <trond.myklebust@netapp.com>
Resetting the clientid from the state manager could result in not confirming
the clientid due to create session not being called.

Move the create session call from the NFS4CLNT_SESSION_SETUP state manager
initialize session case into the NFS4CLNT_LEASE_EXPIRED case establish_clid
call.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoMerge branch 'devel' into linux-next
Trond Myklebust [Fri, 4 Dec 2009 02:27:36 +0000 (21:27 -0500)]
Merge branch 'devel' into linux-next

14 years agoNFS4ERR_FILE_OPEN handling in Linux/NFS
NeilBrown [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
NFS4ERR_FILE_OPEN handling in Linux/NFS

NFS4ERR_FILE_OPEN is return by the server when an operation cannot be
performed because the file is currently open and local (to the server)
semantics prohibit the operation while the file is open.
A typical case is a RENAME operation on an MS-Windows platform, which
prevents rename while the file is open.

While it is possible that such a condition is transitory, it is also
very possible that the file will be held open for an extended period
of time thus preventing the operation.

The current behaviour of Linux/NFS is to retry the operation
indefinitely.  This is not appropriate - we do not expect a rename to
take an arbitrary amount of time to complete.

Rather, and error should be returned.  The most obvious error code
would be EBUSY, which is a legal at least for 'rename' and 'unlink',
and accurately captures the reason for the error.

This patch allows a few retries until about 2 seconds have elapsed,
then returns EBUSY.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoMerge branch 'bugfixes' into nfs-for-next
Trond Myklebust [Thu, 3 Dec 2009 21:01:51 +0000 (16:01 -0500)]
Merge branch 'bugfixes' into nfs-for-next

14 years agonfs: clean up sillyrenaming in nfs_rename()
Miklos Szeredi [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
nfs: clean up sillyrenaming in nfs_rename()

The d_instantiate(new_dentry, NULL) is superfluous, the dentry is
already negative.  Rehashing this dummy dentry isn't needed either,
d_move() works fine on an unhashed target.

The re-checking for busy after a failed nfs_sillyrename() is bogus
too: new_dentry->d_count < 2 would be a bug here.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs: dont unhash target if renaming a directory
Miklos Szeredi [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
nfs: dont unhash target if renaming a directory

Move unhashing the target to after the check for existence and being a
non-directory.

If renaming a directory then the VFS already unhashes the target if it
is not busy.  If it's busy then acquiring more references during the
rename makes no difference.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs: fix comments in nfs_rename()
Miklos Szeredi [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
nfs: fix comments in nfs_rename()

Comments are wrong or out of date.  In particular d_drop() doesn't
free the inode it just unhashes the dentry.  And if target is a
directory then it is not checked for being busy.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agonfs: remove unnecessary check from nfs_rename()
Miklos Szeredi [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
nfs: remove unnecessary check from nfs_rename()

VFS already checks if both source and target are directories.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4.1: Handle NFSv4.1 session errors in the lock recovery code
Trond Myklebust [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
NFSv4.1: Handle NFSv4.1 session errors in the lock recovery code

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: soft connect semantics for UDP
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: soft connect semantics for UDP

Introduce soft connect behavior for UDP transports.  In this case, a
major timeout returns ETIMEDOUT instead of EIO.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Use soft connect semantics when performing RPC ping
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Use soft connect semantics when performing RPC ping

Currently, if a remote RPC service is unreachable, an RPC ping will
hang until the underlying transport connect attempt times out.  A more
desirable behavior might be to have the ping fail immediately so upper
layers can recover appropriately.

In the case of an NFS mount, for instance, this would mean the
mount(2) system call could fail immediately if the server isn't
listening, rather than hanging uninterruptibly for more than 3
minutes.

Change rpc_ping() so that it fails immediately for connection-oriented
transports.  rpc_create() will then fail immediately for such
transports if an RPC ping was requested.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Use soft connects for autobinding over TCP
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Use soft connects for autobinding over TCP

Autobinding is handled by the rpciod process, not in user processes
that are generating regular RPC requests.  Thus autobinding is usually
not affected by signals targetting user processes, such as KILL or
timer expiration events.

In addition, an RPC request generated by a user process that has
RPC_TASK_SOFTCONN set and needs to perform an autobind will hang if
the remote rpcbind service is not available.

For rpcbind queries on connection-oriented transports, let's use the
new soft connect semantic to return control to the user's process
quickly, if the kernel's rpcbind client can't connect to the remote
rpcbind service.

Logic is introduced in call_bind_status() to handle connection errors
that occurred during an asynchronous rpcbind query.  The logic
abandons the rpcbind query if the RPC request has SOFTCONN set, and
retries after a few seconds in the normal case.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Use TCP for local rpcbind upcalls
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Use TCP for local rpcbind upcalls

Use TCP with the soft connect semantic for local rpcbind upcalls so
the kernel can detect immediately if the local rpcbind daemon is not
running.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
14 years agoSUNRPC: Use a cached RPC client and transport for rpcbind upcalls
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Use a cached RPC client and transport for rpcbind upcalls

The kernel's rpcbind client creates and deletes an rpc_clnt and its
underlying transport socket for every upcall to the local rpcbind
daemon.

When starting a typical NFS server on IPv4 and IPv6, the NFS service
itself does three upcalls (one per version) times two upcalls (one
per transport) times two upcalls (one per address family), making 12,
plus another one for the initial call to unregister previous NFS
services.  Starting the NLM service adds an additional 13 upcalls,
for similar reasons.

(Currently the NFS service doesn't start IPv6 listeners, but it will
soon enough).

Instead, let's create an rpc_clnt for rpcbind upcalls during the
first local rpcbind query, and cache it.  This saves the overhead of
creating and destroying an rpc_clnt and a socket for every upcall.

The new logic also prevents the kernel from attempting an RPCB_SET or
RPCB_UNSET if it knows from the start that the local portmapper does
not support rpcbind protocol version 4.  This will cut down on the
number of rpcbind upcalls in legacy environments.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
14 years agoSUNRPC: Simplify synopsis of rpcb_local_clnt()
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Simplify synopsis of rpcb_local_clnt()

Clean up: At one point, rpcb_local_clnt() handled IPv6 loopback
addresses too, but it doesn't any more; only IPv4 loopback is used
now.  Get rid of the @addr and @addrlen arguments to
rpcb_local_clnt().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Allow RPCs to fail quickly if the server is unreachable
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Allow RPCs to fail quickly if the server is unreachable

The kernel sometimes makes RPC calls to services that aren't running.
Because the kernel's RPC client always assumes the hard retry semantic
when reconnecting a connection-oriented RPC transport, the underlying
reconnect logic takes a long while to time out, even though the remote
may have responded immediately with ECONNREFUSED.

In certain cases, like upcalls to our local rpcbind daemon, or for NFS
mount requests, we'd like the kernel to fail immediately if the remote
service isn't reachable.  This allows another transport to be tried
immediately, or the pending request can be abandoned quickly.

Introduce a per-request flag which controls how call_transmit_status()
behaves when request transmission fails because the server cannot be
reached.

We don't want soft connection semantics to apply to other errors.  The
default case of the switch statement in call_transmit_status() no
longer falls through; the fall through code is copied to the default
case, and a "break;" is added.

The transport's connection re-establishment timeout is also ignored for
such requests.  We want the request to fail immediately, so the
reconnect delay is skipped.  Additionally, we don't want a connect
failure here to further increase the reconnect timeout value, since
this request will not be retried.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Check explicitly for tk_status == 0 in call_transmit_status()
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Check explicitly for tk_status == 0 in call_transmit_status()

The success case, where task->tk_status == 0, is by far the most
frequent case in call_transmit_status().

The default: arm of the switch statement in call_transmit_status()
handles the 0 case.  default: was moved close to the top of the switch
statement in call_transmit_status() under the theory that the compiler
places object code for the earliest arms of a switch statement first,
making the CPU do less work.

The default: arm of a switch statement, however, is executed only
after all the other cases have been checked.  Even if the compiler
rearranges the object code, the default: arm is the "last resort",
meaning all of the other cases have been explicitly exhausted.  That
makes the current arrangement about as inefficient as it gets for the
common case.

To fix this, add an explicit check for zero before the switch
statement.  That forces the compiler to do the zero check first, no
matter what optimizations it might try to do to the switch statement.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFS: Revert default r/wsize behavior
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
NFS: Revert default r/wsize behavior

When the "rsize=" or "wsize=" mount options are not specified,
text-based mounts have slightly different behavior than legacy binary
mounts.  Text-based mounts use the smaller of the server's maximum
and the client's maximum, but binary mounts use the smaller of the
server's _preferred_ size and the client's maximum.

This difference is actually pretty subtle.  Most servers advertise
the same value as their maximum and their preferred transfer size, so
the end result is the same in most cases.

The reason for this difference is that for text-based mounts, if
r/wsize are not specified, they are set to the largest value supported
by the client.  For legacy mounts, the values are set to zero if these
options are not specified.

nfs_server_set_fsinfo() can negotiate the transfer size defaults
correctly in any case.  There's no need to specify any particular
value as default in the text-based option parsing logic.

Note that nfs4 doesn't use nfs_server_set_fsinfo(), but the mount.nfs4
command does set rsize and wsize to 0 if the user didn't specify these
options.  So, make the same change for text-based NFSv4 mounts.

Thanks to James Pearson <james-p@moving-picture.com> for reporting and
diagnosing the problem.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFS: Display compressed (shorthand) IPv6 in /proc/mounts
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
NFS: Display compressed (shorthand) IPv6 in /proc/mounts

Recent changes to snprintf() introduced the %pI6c formatter, which can
display an IPv6 address with standard shorthanding.  Use this new
formatter when displaying IPv6 server addresses in /proc/mounts.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Display compressed (shorthand) IPv6 presentation addresses
Chuck Lever [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
SUNRPC: Display compressed (shorthand) IPv6 presentation addresses

Recent changes to snprintf() introduced the %pI6c formatter, which can
display an IPv6 address with standard shorthanding.  Using a
shorthanded address can save us a few bytes of memory for each stored
presentation address, or a few bytes on the wire when sending these in
a universal address.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFS: reorder nfs4_sequence_regs to remove 8 bytes of padding on 64 bits
Richard Kennedy [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
NFS: reorder nfs4_sequence_regs to remove 8 bytes of padding on 64 bits

reorder nfs4_sequence_args to remove 8 bytes of padding on 64 bit
builds.

The size of this structure drops to 24 bytes from 32 and reduces the
text size of nfs.ko.
On my x86_64 size reports

text       data     bss
2.6.32-rc5  200996    8512     432  209940   33414 nfs.ko
+patch  200884    8512     432  209828   333a4 nfs.ko

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFS: convert proto= option to use netids rather than a protoname
Jeff Layton [Thu, 3 Dec 2009 20:58:56 +0000 (15:58 -0500)]
NFS: convert proto= option to use netids rather than a protoname

Solaris uses netids as values for the proto= option, so that when
someone specifies "tcp6" they get traffic over TCP + IPv6. Until
recently, this has never really been an issue for Linux since it didn't
support NFS over IPv6. The netid and the protocol name were generally
always the same (modulo any strange configuration in /etc/netconfig).

The solaris manpage documents their proto= option as:

    proto= _netid_ | rdma

This patch is intended to bring Linux closer to how the Solaris proto=
option works, by declaring a static netid mapping in the kernel and
converting the proto= and mountproto= options to follow it and display
the proper values in /proc/mounts.

Much of this functionality will need to be provided by a userspace
mount.nfs patch. Chuck Lever has a patch to change mount.nfs in
the same way. In principle, we could do *all* of this in userspace but
that would mean that the options in /proc/mounts may not match the
options used by userspace.

The alternative to the static mapping here is to add a mechanism to
upcall to userspace for netid's. I'm not opposed to that option, but
it'll probably mean more overhead (and quite a bit more code). Rather
than shoot for that at first, I figured it was probably better to
start simply.

Comments welcome.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoThe rpc server does not require that service threads take the BKL.
J. Bruce Fields [Thu, 3 Dec 2009 20:58:33 +0000 (15:58 -0500)]
The rpc server does not require that service threads take the BKL.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Ensure nfs4_close_context() is declared as static
Trond Myklebust [Thu, 3 Dec 2009 20:54:02 +0000 (15:54 -0500)]
NFSv4: Ensure nfs4_close_context() is declared as static

Fix another 'sparse' warning in fs/nfs/nfs4proc.c

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Ensure nfs_dns_lookup() and nfs_dns_update() are declared static
Trond Myklebust [Thu, 3 Dec 2009 20:54:01 +0000 (15:54 -0500)]
NFSv4: Ensure nfs_dns_lookup() and nfs_dns_update() are declared static

Fix two 'sparse' warnings in fs/nfs/dns_resolve.c

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Fix up error handling in the state manager main loop.
Trond Myklebust [Thu, 3 Dec 2009 20:53:22 +0000 (15:53 -0500)]
NFSv4: Fix up error handling in the state manager main loop.

The nfs4_state_manager should not be looking at the error values when
deciding whether or not to loop round in order to handle a higher priority
state recovery task. It should rather be looking at the clp->cl_state.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Handle NFS4ERR_GRACE when recovering an expired lease.
Trond Myklebust [Thu, 3 Dec 2009 20:53:21 +0000 (15:53 -0500)]
NFSv4: Handle NFS4ERR_GRACE when recovering an expired lease.

If our lease expires, and the server reboots while we're recovering, we
need to be able to wait until the grace period is over.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Ensure the state manager handles NFS4ERR_NO_GRACE correctly
Trond Myklebust [Thu, 3 Dec 2009 20:53:21 +0000 (15:53 -0500)]
NFSv4: Ensure the state manager handles NFS4ERR_NO_GRACE correctly

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: The state manager shouldn't exit on errors that were handled
Trond Myklebust [Thu, 3 Dec 2009 20:53:20 +0000 (15:53 -0500)]
NFSv4: The state manager shouldn't exit on errors that were handled

nfs4_recovery_handle_error() will correctly handle errors such as
NFS4ERR_CB_PATH_DOWN, however because they are still passed back to the
main loop in nfs4_state_manager(), they can cause the latter to exit
prematurely.

Fix this by letting nfs4_recovery_handle_error() change the error value in
cases where there is no action required by the caller.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Fix up the callers of nfs4_state_end_reclaim_reboot
Trond Myklebust [Thu, 3 Dec 2009 20:52:41 +0000 (15:52 -0500)]
NFSv4: Fix up the callers of nfs4_state_end_reclaim_reboot

In practice, we need to ensure that we call nfs4_state_end_reclaim_reboot
in 2 cases:

 - If we lose the lease while we were reclaiming state
OR
 - After we're done with reboot recovery

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFSv4: Fix a potential state manager deadlock when returning delegations
Trond Myklebust [Thu, 3 Dec 2009 13:10:17 +0000 (08:10 -0500)]
NFSv4: Fix a potential state manager deadlock when returning delegations

The nfsv4 state manager could potentially deadlock inside
__nfs_inode_return_delegation() if the server reboots, so that the calls to
nfs_msync_inode() end up waiting on state recovery to complete.

Also ensure that if a server reboot or network partition causes us to have
to stop returning delegations, that NFS4CLNT_DELEGRETURN is set so that
the state manager can resume any outstanding delegation returns after it
has dealt with the state recovery situation.

Finally, ensure that the state manager doesn't wait for the DELEGRETURN
call to complete. It doesn't need to, and that too can cause a deadlock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoRe: acl trouble after upgrading ubuntu
J. Bruce Fields [Thu, 3 Dec 2009 13:10:17 +0000 (08:10 -0500)]
Re: acl trouble after upgrading ubuntu

Subject: [PATCH] nfs: fix acl decoding

Commit 28f566942c6b1d929f5e240e69e7081b77b238d3 "NFS: use dynamically
computed compound_hdr.replen for xdr_inline_pages offset" accidentally
changed the amount of space to allow for the acl reply, resulting in an
IO error on attempts to get an acl.

Reported-by: Paul Rudin <paul@rudin.co.uk>
Cc: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoRPC: Fix two potential races in put_rpccred
Trond Myklebust [Thu, 3 Dec 2009 13:10:17 +0000 (08:10 -0500)]
RPC: Fix two potential races in put_rpccred

It is possible for rpcauth_destroy_credcache() to cause the rpc credentials
to be unhashed while put_rpccred is waiting for the rpc_credcache_lock on
another cpu. Should this happen, then we can end up calling
hlist_del_rcu(&cred->cr_hash) a second time in put_rpccred, thus causing
list corruption.

Should the credential actually be hashed, it is also possible for
rpcauth_lookup_credcache to find and reference it before we get round to
unhashing it. In this case, the call to rpcauth_unhash_cred will fail, and
so we should just exit without destroying the cred.

Reported-by: Neil Brown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoSUNRPC: Ensure that we honour autoclose before attempting to reconnect
Trond Myklebust [Thu, 3 Dec 2009 13:10:17 +0000 (08:10 -0500)]
SUNRPC: Ensure that we honour autoclose before attempting to reconnect

If the XPRT_CLOSE_WAIT flag is set, we need to ensure that we call
xprt->ops->close() while holding xprt_lock_write() before we can
start reconnecting.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoNFS: BKL removal from the mount code...
Trond Myklebust [Thu, 3 Dec 2009 13:09:56 +0000 (08:09 -0500)]
NFS: BKL removal from the mount code...

None of the code in nfs_umount_begin() or nfs_remount() has any BKL
dependency.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
14 years agoLinux 2.6.32 v2.6.32
Linus Torvalds [Thu, 3 Dec 2009 03:51:21 +0000 (19:51 -0800)]
Linux 2.6.32

14 years agoVIDEO: Correct use of request_region/request_mem_region
Julia Lawall [Sun, 9 Aug 2009 09:42:32 +0000 (11:42 +0200)]
VIDEO: Correct use of request_region/request_mem_region

request_region should be used with release_region, not request_mem_region.

Geert Uytterhoeven pointed out that in the case of drivers/video/gbefb.c,
the problem is actually the other way around; request_mem_region should be
used instead of request_region.

The semantic patch that finds/fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r1@
expression start;
@@

request_region(start,...)

@b1@
expression r1.start;
@@

request_mem_region(start,...)

@depends on !b1@
expression r1.start;
expression E;
@@

- release_mem_region
+ release_region
  (start,E)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
14 years agoSPI: spi_txx9: Fix bit rate calculation
Atsushi Nemoto [Thu, 3 Sep 2009 13:59:01 +0000 (22:59 +0900)]
SPI: spi_txx9: Fix bit rate calculation

TXx9 SPI bit rate is calculated by:
        fBR = (spi-baseclk) / (n + 1)
Fix calculation of min_speed_hz, max_speed_hz and n.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Linus Torvalds [Wed, 2 Dec 2009 23:41:49 +0000 (15:41 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/sameo/mfd-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
  mfd: Correct WM831X_MAX_ISEL_VALUE

14 years agoInput: i8042 - add Dell Vostro 1320, 1520 and 1720 to the reset list
Anisse Astier [Tue, 1 Dec 2009 09:14:25 +0000 (01:14 -0800)]
Input: i8042 - add Dell Vostro 1320, 1520 and 1720 to the reset list

These laptops often leave i8042 in a wierd state resulting in non-
operational touchpad and keyboard.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Wed, 2 Dec 2009 23:40:37 +0000 (15:40 -0800)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  md: revert incorrect fix for read error handling in raid1.

14 years agoparam: don't complain about unused module parameters.
Rusty Russell [Tue, 1 Dec 2009 04:26:44 +0000 (14:56 +1030)]
param: don't complain about unused module parameters.

Jon confirms that recent modprobe will look in /proc/cmdline, so these
cmdline options can still be used.

See http://bugzilla.kernel.org/show_bug.cgi?id=14164

Reported-by: Adam Williamson <awilliam@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
Linus Torvalds [Wed, 2 Dec 2009 23:39:20 +0000 (15:39 -0800)]
Merge branch 'upstream' of git://ftp.linux-mips.org/upstream-linus

* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
  MIPS: RB532: Fix devices.c compilation.
  MIPS: Fix MIPS I build.

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
Linus Torvalds [Wed, 2 Dec 2009 23:38:49 +0000 (15:38 -0800)]
Merge git://git./linux/kernel/git/wim/linux-2.6-watchdog

* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  [PATCH] rc32434_wdt: fix compilation failure
  [WATCHDOG] rc32434_wdt.c: use resource_size()

14 years agomodules: don't export section names of empty sections via sysfs
Helge Deller [Wed, 2 Dec 2009 23:29:15 +0000 (00:29 +0100)]
modules: don't export section names of empty sections via sysfs

On the parisc architecture we face for each and every loaded kernel module
this kernel "badness warning":
  sysfs: cannot create duplicate filename '/module/ac97_bus/sections/.text'
  Badness at fs/sysfs/dir.c:487

Reason for that is, that on parisc all kernel modules do have multiple
.text sections due to the usage of the -ffunction-sections compiler flag
which is needed to reach all jump targets on this platform.

An objdump on such a kernel module gives:
Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .note.gnu.build-id 00000024  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .text         00000000  00000000  00000000  00000058  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .text.ac97_bus_match 0000001c  00000000  00000000  00000058  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .text         00000000  00000000  00000000  000000d4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
...
Since the .text sections are empty (size of 0 bytes) and won't be
loaded by the kernel module loader anyway, I don't see a reason
why such sections need to be listed under
/sys/module/<module_name>/sections/<section_name> either.

The attached patch does solve this issue by not exporting section
names which are empty.

This fixes bugzilla http://bugzilla.kernel.org/show_bug.cgi?id=14703

Signed-off-by: Helge Deller <deller@gmx.de>
CC: rusty@rustcorp.com.au
CC: akpm@linux-foundation.org
CC: James.Bottomley@HansenPartnership.com
CC: roland@redhat.com
CC: dave@hiauly1.hia.nrc.ca
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
Linus Torvalds [Wed, 2 Dec 2009 20:44:42 +0000 (12:44 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/lrg/voltage-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6:
  regulator: Initialise wm831x structure pointor for ISINK driver

14 years agoregulator: Initialise wm831x structure pointor for ISINK driver
Mark Brown [Mon, 30 Nov 2009 14:01:56 +0000 (14:01 +0000)]
regulator: Initialise wm831x structure pointor for ISINK driver

The version that made it into mainline missed the initialisation of the
chip handle.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
14 years agoMIPS: RB532: Fix devices.c compilation.
Florian Fainelli [Wed, 2 Dec 2009 12:07:01 +0000 (13:07 +0100)]
MIPS: RB532: Fix devices.c compilation.

We should now use dev_set_drvdata to set the driver driver_data field.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/747/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
14 years agoMIPS: Fix MIPS I build.
Ralf Baechle [Wed, 2 Dec 2009 11:33:03 +0000 (11:33 +0000)]
MIPS: Fix MIPS I build.

Broken by d63c63e889bbeeaa461a8addf1245f89f3ce4ece (lmo) rsp.
f1e39a4a616cd9981a9decfd5332fd07a01abb8b (kernel.org).

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/746/

14 years agoMerge branch 'fix' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6
Linus Torvalds [Wed, 2 Dec 2009 16:21:58 +0000 (08:21 -0800)]
Merge branch 'fix' of git://git./linux/kernel/git/ycmiao/pxa-linux-2.6

* 'fix' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6:
  [ARM] pxamci: call mmc_remove_host() before freeing resources

14 years ago[ARM] pxamci: call mmc_remove_host() before freeing resources
Daniel Mack [Tue, 1 Dec 2009 17:17:18 +0000 (18:17 +0100)]
[ARM] pxamci: call mmc_remove_host() before freeing resources

mmc_remove_host() will cause the mmc core to switch off the bus power by
eventually calling pxamci_set_ios(). This function uses the regulator or
the GPIO which have been freed already.

This causes the following Oops on module unload.

[   49.519649] Unable to handle kernel paging request at virtual address 30303a70
[   49.526878] pgd = c7084000
[   49.529563] [30303a70] *pgd=00000000
[   49.533136] Internal error: Oops: 5 [#1]
[   49.537025] last sysfs file: /sys/devices/platform/pxa27x-ohci/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_level
[   49.547471] Modules linked in: pxamci(-) eeti_ts
[   49.552061] CPU: 0    Not tainted  (2.6.32-rc8 #322)
[   49.557001] PC is at regulator_is_enabled+0x3c/0xbc
[   49.561846] LR is at regulator_is_enabled+0x30/0xbc
[   49.566691] pc : [<c01a2448>]    lr : [<c01a243c>]    psr: 60000013
[   49.566702] sp : c7083e70  ip : 30303a30  fp : 00000000
[   49.578093] r10: c705e200  r9 : c7082000  r8 : c705e2e0
[   49.583280] r7 : c7061340  r6 : c7061340  r5 : c7083e70  r4 : 00000000
[   49.589759] r3 : c04dc434  r2 : c04dc434  r1 : c03eecea  r0 : 00000047
[   49.596241] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   49.603329] Control: 0000397f  Table: a7084018  DAC: 00000015
[   49.609031] Process rmmod (pid: 1101, stack limit = 0xc7082278)
[   49.614908] Stack: (0xc7083e70 to 0xc7084000)
[   49.619238] 3e60:                                     c7082000 c703c4f8 c705ea00 c04f4074
[   49.627366] 3e80: 00000000 c705e3a0 ffffffff c0247ddc c70361a0 00000000 c705e3a0 ffffffff
[   49.635499] 3ea0: c705e200 bf006400 c78c4f00 c705e200 c705e3a0 ffffffff c705e200 ffffffff
[   49.643633] 3ec0: c04d8ac8 c02476d0 ffffffff c0247c60 c705e200 c0248678 c705e200 c0249064
[   49.651765] 3ee0: ffffffff bf006204 c04d8ad0 c04d8ad0 c04d8ac8 bf007490 00000880 c00440c4
[   49.659898] 3f00: 0000b748 c01c5708 bf007490 c01c44c8 c04d8ac8 c04d8afc bf007490 c01c4570
[   49.668031] 3f20: bf007490 bf00750c c04f4258 c01c37a4 00000000 bf00750c c7083f44 c007b014
[   49.676162] 3f40: 4000d000 6d617870 08006963 00000001 00000000 c7085000 00000001 00000000
[   49.684287] 3f60: 4000d000 c7083f8c 00000001 bea01a54 00005401 c7ab1400 c00440c4 00082000
[   49.692420] 3f80: bf00750c 00000880 c7083f8c 00000000 4000cfa8 00000000 00000880 bea01cc8
[   49.700552] 3fa0: 00000081 c0043f40 00000000 00000880 bea01cc8 00000880 00000006 00000000
[   49.708677] 3fc0: 00000000 00000880 bea01cc8 00000081 00000097 0000cca4 0000b748 00000000
[   49.716802] 3fe0: 4001a4f0 bea01cc0 00018bf4 4001a4fc 20000010 bea01cc8 a063e021 a063e421
[   49.724958] [<c01a2448>] (regulator_is_enabled+0x3c/0xbc) from [<c0247ddc>] (mmc_regulator_set_ocr+0x14/0xd8)
[   49.734836] [<c0247ddc>] (mmc_regulator_set_ocr+0x14/0xd8) from [<bf006400>] (pxamci_set_ios+0xd8/0x17c [pxamci])
[   49.745044] [<bf006400>] (pxamci_set_ios+0xd8/0x17c [pxamci]) from [<c02476d0>] (mmc_power_off+0x50/0x58)
[   49.754555] [<c02476d0>] (mmc_power_off+0x50/0x58) from [<c0247c60>] (mmc_detach_bus+0x68/0xc4)
[   49.763207] [<c0247c60>] (mmc_detach_bus+0x68/0xc4) from [<c0248678>] (mmc_stop_host+0xd4/0x1bc)
[   49.771944] [<c0248678>] (mmc_stop_host+0xd4/0x1bc) from [<c0249064>] (mmc_remove_host+0xc/0x20)
[   49.780681] [<c0249064>] (mmc_remove_host+0xc/0x20) from [<bf006204>] (pxamci_remove+0xc8/0x174 [pxamci])
[   49.790211] [<bf006204>] (pxamci_remove+0xc8/0x174 [pxamci]) from [<c01c5708>] (platform_drv_remove+0x1c/0x24)
[   49.800164] [<c01c5708>] (platform_drv_remove+0x1c/0x24) from [<c01c44c8>] (__device_release_driver+0x7c/0xc4)
[   49.810110] [<c01c44c8>] (__device_release_driver+0x7c/0xc4) from [<c01c4570>] (driver_detach+0x60/0x8c)
[   49.819535] [<c01c4570>] (driver_detach+0x60/0x8c) from [<c01c37a4>] (bus_remove_driver+0x90/0xcc)
[   49.828452] [<c01c37a4>] (bus_remove_driver+0x90/0xcc) from [<c007b014>] (sys_delete_module+0x1d8/0x254)
[   49.837891] [<c007b014>] (sys_delete_module+0x1d8/0x254) from [<c0043f40>] (ret_fast_syscall+0x0/0x28)
[   49.847145] Code: eb06c53a e596c030 e1a0500d e59f106c (e59c0040)
[   49.853566] ---[ end trace b5fa66a00cea142f ]---

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Reported-by: Sven Neumann <s.neumann@raumfeld.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: stable@kernel.org
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
14 years ago[PATCH] rc32434_wdt: fix compilation failure
Florian Fainelli [Wed, 2 Dec 2009 12:21:23 +0000 (13:21 +0100)]
[PATCH] rc32434_wdt: fix compilation failure

This patch fixes the compilation failure of
rc32434 due to a bad module parameter description.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
14 years ago[WATCHDOG] rc32434_wdt.c: use resource_size()
H Hartley Sweeten [Wed, 25 Nov 2009 02:06:26 +0000 (21:06 -0500)]
[WATCHDOG] rc32434_wdt.c: use resource_size()

The size value passed to ioremap_nocache() is not correct.
Use resource_size() to get the correct value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Phil Sutter <n0-1@freewrt.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
14 years agosysfs: fix SYSFS_DEPRECATED_V2 prompt
Randy Dunlap [Tue, 1 Dec 2009 21:17:50 +0000 (13:17 -0800)]
sysfs: fix SYSFS_DEPRECATED_V2 prompt

The SYSFS_DEPRECATED_V2 says "remove" older, deprecated features, but it
actually enables them, so correct this confusing, backwards text.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agortc-x1205: reset clock to sane state after power failure
Johannes Weiner [Tue, 1 Dec 2009 21:17:49 +0000 (13:17 -0800)]
rtc-x1205: reset clock to sane state after power failure

When detecting power failure, the probe function would reset the clock
time to defined state.

However, the clock's _date_ might still be bogus and a subsequent probe
fails when sanity-checking these values.

Change the power-failure fixup code to do a full setting of rtc_time,
including a valid date.

Signed-off-by: Johannes Weiner <jw@emlix.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agortc-x1205: fix rtc_time to y2k register value conversion
Johannes Weiner [Tue, 1 Dec 2009 21:17:48 +0000 (13:17 -0800)]
rtc-x1205: fix rtc_time to y2k register value conversion

The possible CCR_Y2K register values are 19 or 20 and struct rtc_time's
tm_year is in years since 1900.

The function translating rtc_time to register values assumes tm_year to be
years since first christmas, though, and we end up storing 0 or 1 in the
CCR_Y2K register, which the hardware does not refuse to do.

A subsequent probing of the clock fails due to the invalid value range in
the register, though.

[ And if it didn't, reading the clock would yield a bogus year because
  the function translating registers to tm_year is assuming a register
  value of 19 or 20. ]

This fixes the conversion from years since 1900 in tm_year to the
corresponding CCR_Y2K value of 19 or 20.

Signed-off-by: Johannes Weiner <jw@emlix.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoaoe: prevent cache aliases
Peter Horton [Tue, 1 Dec 2009 21:17:46 +0000 (13:17 -0800)]
aoe: prevent cache aliases

Prevent the AoE block driver from creating cache aliases of page cache
pages on machines with virtually indexed caches.

Building kernels on an AT91SAM9G20 board without this patch fails with
segmentation faults after a couple of passes.

Signed-off-by: Peter Horton <zero@colonel-panic.org>
Cc: "Ed L. Cashin" <ecashin@coraid.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agogpio: Langwell GPIO driver bugfixes
Alek Du [Tue, 1 Dec 2009 21:17:45 +0000 (13:17 -0800)]
gpio: Langwell GPIO driver bugfixes

- Remove wrong and unnecessary unmask operation

- Remove extra GEDR reading

This fixes the loss of interrupts which occurs when two or more pins are
triggered in close succession.

Signed-off-by: Alek Du <alek.du@intel.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agokbuild: stepping down as maintainer
Sam Ravnborg [Tue, 1 Dec 2009 21:17:44 +0000 (13:17 -0800)]
kbuild: stepping down as maintainer

It has been fun but the last year or more it has been a duty and a burden.
So I leave it open for others to take over.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Anibal Monsalve Salazar <anibal@debian.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agodavinci: fb: fix frame buffer driver issues
Sudhakar Rajashekhara [Tue, 1 Dec 2009 21:17:43 +0000 (13:17 -0800)]
davinci: fb: fix frame buffer driver issues

Following issues have been addressed on DA8XX/OMAP-L1XX:

a. Screen misalignment during booting when frame buffer console is
   enabled.

b. Driver was configured always in PSEUDOCOLOR mode.  This patch
   dynamically configures the driver either in PSEUDOCOLOUR or TRUECOLOR
   mode depending on bpp.

c. The RED and BLUE offsets were interchanged resulting in wrong
   bootup logo colour.

This patch has been tested on DA830/OMAP-L137 and DA850/OMAP-L138 EVMs.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Cc: Steve Chen <schen@mvista.com>
Cc: Pavel Kiryukhin <pkiryukhin@ru.mvista.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agodrivers/rtc/rtc-pcf50633.c: fix use after free in pcf50633_rtc_probe()
Dan Carpenter [Tue, 1 Dec 2009 21:17:41 +0000 (13:17 -0800)]
drivers/rtc/rtc-pcf50633.c: fix use after free in pcf50633_rtc_probe()

"rtc" is freed and then dereferenced on the next line.  This patch fixes
that.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agodrivers/media/dvb/dvb-core/dvb_frontend.c: needs semaphore.h
Andrew Morton [Tue, 1 Dec 2009 21:17:41 +0000 (13:17 -0800)]
drivers/media/dvb/dvb-core/dvb_frontend.c: needs semaphore.h

Fixes:

  v4l/dvb_frontend.c: In function 'dvb_frontend_stop':
  v4l/dvb_frontend.c:707: error: implicit declaration of function 'init_MUTEX'

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14609

Reported-by: <tstrelar@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>