GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
16 years agoNFS: Fix minor mixed sign comparison in NFS client's write logic
Chuck Lever [Thu, 20 Dec 2007 19:54:57 +0000 (14:54 -0500)]
NFS: Fix minor mixed sign comparison in NFS client's write logic

Clean up: PAGE_CACHE_SIZE is unsigned, and nfs_pageio_init() takes a size_t.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Use size_t for storing name lengths
Chuck Lever [Thu, 20 Dec 2007 19:54:49 +0000 (14:54 -0500)]
NFS: Use size_t for storing name lengths

Clean up: always use the same type when handling buffer lengths.  As a
bonus, this prevents a mixed sign comparison in idmap_lookup_name.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Fix use of copy_to_user() in idmap_pipe_upcall
Chuck Lever [Thu, 20 Dec 2007 19:54:42 +0000 (14:54 -0500)]
NFS: Fix use of copy_to_user() in idmap_pipe_upcall

The idmap_pipe_upcall() function expects the copy_to_user() function to
return a negative error value if the call fails, but copy_to_user()
returns an unsigned long number of bytes that couldn't be copied.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up fs/nfs/idmap.c
Chuck Lever [Thu, 20 Dec 2007 19:54:35 +0000 (14:54 -0500)]
NFS: Clean up fs/nfs/idmap.c

Clean up white space damage and use standard kernel coding conventions for
return statements.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Fix use of copy_to_user() in gss_pipe_upcall()
Chuck Lever [Thu, 20 Dec 2007 19:54:27 +0000 (14:54 -0500)]
SUNRPC: Fix use of copy_to_user() in gss_pipe_upcall()

The gss_pipe_upcall() function expects the copy_to_user() function to
return a negative error value if the call fails, but copy_to_user()
returns an unsigned long number of bytes that couldn't be copied.

Can rpc_pipefs actually retry a partially completed upcall read?  If
not, then gss_pipe_upcall() should punt any partial read, just like the
upcall logic in net/sunrpc/cache.c.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Fix the 'proto=' mount option
Trond Myklebust [Thu, 3 Jan 2008 21:29:06 +0000 (16:29 -0500)]
NFS: Fix the 'proto=' mount option

Currently, if you have a server mounted using networking protocol, you
cannot specify a different value using the 'proto=' option on another
mountpoint.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Support per-mountpoint timeout parameters.
Trond Myklebust [Thu, 20 Dec 2007 21:03:59 +0000 (16:03 -0500)]
NFS: Support per-mountpoint timeout parameters.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Ensure that we respect NFS_MAX_TCP_TIMEOUT
Trond Myklebust [Thu, 20 Dec 2007 21:03:57 +0000 (16:03 -0500)]
NFS: Ensure that we respect NFS_MAX_TCP_TIMEOUT

It isn't sufficient just to limit timeout->to_initval, we also need to
limit to_maxval.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Add support for per-client timeout values
Trond Myklebust [Thu, 20 Dec 2007 21:03:55 +0000 (16:03 -0500)]
SUNRPC: Add support for per-client timeout values

In order to be able to support setting the timeo and retrans parameters on
a per-mountpoint basis, we move the rpc_timeout structure into the
rpc_clnt.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Clean up the transport timeout initialisation
Trond Myklebust [Thu, 20 Dec 2007 21:03:54 +0000 (16:03 -0500)]
SUNRPC: Clean up the transport timeout initialisation

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: cleanup for rpc_new_client()
Trond Myklebust [Thu, 20 Dec 2007 21:03:53 +0000 (16:03 -0500)]
SUNRPC: cleanup for rpc_new_client()

There is no reason why we shouldn't just pass the rpc_create_args.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFSv4: Add socket proto argument to setclientid
Trond Myklebust [Fri, 14 Dec 2007 19:56:07 +0000 (14:56 -0500)]
NFSv4: Add socket proto argument to setclientid

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Pull covers off IPv6 address parsing
Chuck Lever [Mon, 10 Dec 2007 19:59:35 +0000 (14:59 -0500)]
NFS: Pull covers off IPv6 address parsing

Now that the needed IPv6 infrastructure is in place, allow the NFS client's
IP address parser to generate AF_INET6 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Support non-IPv4 addresses in nfs_parsed_mount_data
Chuck Lever [Mon, 10 Dec 2007 19:59:28 +0000 (14:59 -0500)]
NFS: Support non-IPv4 addresses in nfs_parsed_mount_data

Replace the nfs_server and mount_server address fields in the
nfs_parsed_mount_data structure with a "struct sockaddr_storage"
instead of a "struct sockaddr_in".

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Refactor mount option address parsing into separate function
Chuck Lever [Mon, 10 Dec 2007 19:59:21 +0000 (14:59 -0500)]
NFS: Refactor mount option address parsing into separate function

Refactor the logic to parse incoming text-based IP addresses.  Use the
in4_pton() function instead of the older in_aton(), following the lead
of the in-kernel CIFS client.

Later we'll add IPv6 address parsing using the matching in6_pton()
function.  For now we can't allow IPv6 address parsing: we must expand
the size of the address storage fields in the nfs_parsed_mount_options
struct before we can parse and store IPv6 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Remove the NIPQUAD from nfs_try_mount
Chuck Lever [Mon, 10 Dec 2007 19:59:13 +0000 (14:59 -0500)]
NFS: Remove the NIPQUAD from nfs_try_mount

In the name of address family compatibility, we can't have the NIP_FMT and
NIPQUAD macros in nfs_try_mount().  Instead, we can make use of an unused
mount option to display the mount server's hostname.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Adjust nfs_clone_mount structure to store "struct sockaddr *"
Chuck Lever [Mon, 10 Dec 2007 19:59:06 +0000 (14:59 -0500)]
NFS: Adjust nfs_clone_mount structure to store "struct sockaddr *"

Change the addr field in the nfs_clone_mount structure to store a "struct
sockaddr *" to support non-IPv4 addresses in the NFS client.

Note this is mostly a cosmetic change, and does not actually allow
referrals using IPv6 addresses.  The existing referral code assumes that
the server returns a string that represents an IPv4 address.  This code
needs to support hostnames and IPv6 addresses as well as IPv4 addresses,
thus it will need to be reorganized completely (to handle DNS resolution
in user space).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Change nfs4_set_client() to accept struct sockaddr *
Chuck Lever [Mon, 10 Dec 2007 19:58:59 +0000 (14:58 -0500)]
NFS: Change nfs4_set_client() to accept struct sockaddr *

Adjust the arguments and callers of nfs4_set_client() to pass a "struct
sockaddr *" instead of a "struct sockaddr_in *" to support non-IPv4
addresses in the NFS client.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Change nfs_get_client() to take sockaddr *
Chuck Lever [Mon, 10 Dec 2007 19:58:51 +0000 (14:58 -0500)]
NFS: Change nfs_get_client() to take sockaddr *

Adjust arguments and callers of nfs_get_client() to pass a
"struct sockaddr *" instead of "struct sockaddr_in *" to support
non-IPv4 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Change nfs_find_client() to take "struct sockaddr *"
Chuck Lever [Mon, 10 Dec 2007 19:58:44 +0000 (14:58 -0500)]
NFS: Change nfs_find_client() to take "struct sockaddr *"

Adjust arguments and callers of nfs_find_client() to pass a
"struct sockaddr *" instead of "struct sockaddr_in *" to support non-IPv4
addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Trond: Also fix up protocol version number argument in nfs_find_client() to
use the correct u32 type.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Change cb_recallargs to pass "struct sockaddr *" instead of sockaddr_in
Chuck Lever [Mon, 10 Dec 2007 19:58:29 +0000 (14:58 -0500)]
NFS: Change cb_recallargs to pass "struct sockaddr *" instead of sockaddr_in

Change the addr field in the cb_recallargs struct to a "struct sockaddr *"
to support non-IPv4 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Change cb_getattrargs to pass "struct sockaddr *" instead of sockaddr_in
Chuck Lever [Mon, 10 Dec 2007 19:58:22 +0000 (14:58 -0500)]
NFS: Change cb_getattrargs to pass "struct sockaddr *" instead of sockaddr_in

Change the addr field in the cb_getattrargs struct to a "struct sockaddr *"
to support non-IPv4 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Expand server address storage in nfs_client struct
Chuck Lever [Mon, 10 Dec 2007 19:58:15 +0000 (14:58 -0500)]
NFS: Expand server address storage in nfs_client struct

Prepare for managing larger addresses in the NFS client by widening the
nfs_client struct's cl_addr field.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
(Modified to work with the new parameters for nfs_alloc_client)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Add support for AF_INET6 addresses in __nfs_find_client()
Trond Myklebust [Thu, 3 Jan 2008 18:28:58 +0000 (13:28 -0500)]
NFS: Add support for AF_INET6 addresses in __nfs_find_client()

Introduce AF_INET6-specific address checking to __nfs_find_client().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Set default port for NFSv4, with support for AF_INET6
Chuck Lever [Mon, 10 Dec 2007 19:58:00 +0000 (14:58 -0500)]
NFS: Set default port for NFSv4, with support for AF_INET6

Create a helper function to set the default NFS port for NFSv4 mount
points.  The helper supports both AF_INET and AF_INET6 family addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Make setting a port number agostic
Chuck Lever [Mon, 10 Dec 2007 19:57:53 +0000 (14:57 -0500)]
NFS: Make setting a port number agostic

We'll need to set the port number of an AF_INET or AF_INET6 address in
several places in fs/nfs/super.c, so introduce a helper that can manage
this for us.  We put this helper to immediate use.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Verify IPv6 addresses properly
Chuck Lever [Mon, 10 Dec 2007 19:57:45 +0000 (14:57 -0500)]
NFS: Verify IPv6 addresses properly

Add support to nfs_verify_server_address for recognizing AF_INET6
addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Add support for AF_INET6 addresses in nfs_compare_super()
Chuck Lever [Mon, 10 Dec 2007 19:57:38 +0000 (14:57 -0500)]
NFS: Add support for AF_INET6 addresses in nfs_compare_super()

Refactor nfs_compare_super() and add AF_INET6 support.

Replace the generic memcmp() to document explicitly what parts of the
addresses must match in this check, and make the comparison independent
of the lengths of both addresses.

A side benefit is both tests are more computationally efficient than a
memcmp().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Address a couple of nits in nfs_follow_referral()
Chuck Lever [Mon, 10 Dec 2007 19:57:31 +0000 (14:57 -0500)]
NFS: Address a couple of nits in nfs_follow_referral()

Clean up: fix an outdated block comment, and address a comparison
between a signed and unsigned integer.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Move dprintks from callback.c to callback_proc.c
Chuck Lever [Mon, 10 Dec 2007 19:57:23 +0000 (14:57 -0500)]
NFS: Move dprintks from callback.c to callback_proc.c

Clean up: The client side peer address is available in callback_proc.c,
so move a dprintk out of fs/nfs/callback.c and into
fs/nfs/callback_proc.c.

This is more consistent with other debugging messages, and the proc
routines have more information about each request to display.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: eliminate NIPQUAD(clp->cl_addr.sin_addr)
Chuck Lever [Mon, 10 Dec 2007 19:57:16 +0000 (14:57 -0500)]
NFS: eliminate NIPQUAD(clp->cl_addr.sin_addr)

To ensure the NFS client displays IPv6 addresses properly, replace
address family-specific NIPQUAD() invocations with a call to the RPC
client to get a formatted string representing the remote peer's
address.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Enable NFS client to generate CLIENTID strings with IPv6 addresses
Chuck Lever [Mon, 10 Dec 2007 19:57:09 +0000 (14:57 -0500)]
NFS: Enable NFS client to generate CLIENTID strings with IPv6 addresses

We recently added methods to RPC transports that provide string versions of
the remote peer address information.  Convert the NFSv4 SETCLIENTID
procedure to use those methods instead of building the client ID out of
whole cloth.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Increase size of cl_ipaddr field to hold IPv6 addresses
Chuck Lever [Mon, 10 Dec 2007 19:57:01 +0000 (14:57 -0500)]
NFS: Increase size of cl_ipaddr field to hold IPv6 addresses

The nfs_client's cl_ipaddr field needs to be larger to hold strings that
represent IPv6 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Ensure NFSv4 SETCLIENTID send buffer is large enough
Chuck Lever [Mon, 10 Dec 2007 19:56:54 +0000 (14:56 -0500)]
NFS: Ensure NFSv4 SETCLIENTID send buffer is large enough

Ensure that the RPC buffer size specified for NFSv4 SETCLIENTID procedures
matches what we are encoding into the buffer.  See the definition of
struct nfs4_setclientid {} and the encode_setclientid() function.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Move universal address definitions to global header
Chuck Lever [Mon, 10 Dec 2007 19:56:46 +0000 (14:56 -0500)]
SUNRPC: Move universal address definitions to global header

Universal addresses are defined in RFC 1833 and clarified in RFC 3530.  We
need to use them in several places in the NFS and RPC clients, so move the
relevant definition and block comment to an appropriate global include
file.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: RPC version numbers are u32
Chuck Lever [Mon, 10 Dec 2007 19:56:38 +0000 (14:56 -0500)]
SUNRPC: RPC version numbers are u32

Clean up: use correct type for RPC version numbers in rpcbind client.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Fix socket address handling in rpcb_clnt
Chuck Lever [Mon, 10 Dec 2007 19:56:31 +0000 (14:56 -0500)]
SUNRPC: Fix socket address handling in rpcb_clnt

Make sure rpcb_clnt passes the correct address length to rpc_create().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: rpc_create() default hostname should support AF_INET6 addresses
Chuck Lever [Mon, 10 Dec 2007 19:56:24 +0000 (14:56 -0500)]
SUNRPC: rpc_create() default hostname should support AF_INET6 addresses

If the ULP doesn't pass a hostname string to rpc_create(), it manufactures
one based on the passed-in address.  Be smart enough to handle an AF_INET6
address properly in this case.

Move the default servername logic before the xprt_create_transport() call
to simplify error handling in rpc_create().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Remove the redundant nfs_client->cl_nfsversion
Trond Myklebust [Fri, 14 Dec 2007 19:56:07 +0000 (14:56 -0500)]
NFS: Remove the redundant nfs_client->cl_nfsversion

We can get the same information from the rpc_ops structure instead.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up the nfs_find_client function.
Trond Myklebust [Fri, 14 Dec 2007 19:56:05 +0000 (14:56 -0500)]
NFS: Clean up the nfs_find_client function.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up the nfs_client initialisation
Trond Myklebust [Fri, 14 Dec 2007 19:56:04 +0000 (14:56 -0500)]
NFS: Clean up the nfs_client initialisation

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: define a function to update nfsi->cache_change_attribute
Trond Myklebust [Mon, 15 Oct 2007 22:18:29 +0000 (18:18 -0400)]
NFS: define a function to update nfsi->cache_change_attribute

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Remove an unneeded check in decode_compound_header_arg()
Chuck Lever [Fri, 26 Oct 2007 17:33:01 +0000 (13:33 -0400)]
NFS: Remove an unneeded check in decode_compound_header_arg()

Clean up:  The header tag length is unsigned, so checking that it is less
than zero is unnecessary.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up address comparison in __nfs_find_client()
Chuck Lever [Fri, 26 Oct 2007 17:32:45 +0000 (13:32 -0400)]
NFS: Clean up address comparison in __nfs_find_client()

The address comparison in the __nfs_find_client() function is deceptive.
It uses a memcmp() to check a pair of u32 fields for equality.  Not only is
this inefficient, but usually memcmp() is used for comparing two *whole*
sockaddr_in's (which includes comparisons of the address family and port
number), so it's easy to mistake the comparison here for a whole sockaddr
comparison, which it isn't.

So for clarity and efficiency, we replace the memcmp() with a simple test
for equality between the two s_addr fields.  This should have no
behavioral effect.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up: copy hostname with kstrndup during mount processing
Chuck Lever [Fri, 26 Oct 2007 17:32:40 +0000 (13:32 -0400)]
NFS: Clean up: copy hostname with kstrndup during mount processing

Clean up: mount option parsing uses kstrndup in several places, rather than
using kzalloc.  Replace the few remaining uses of kzalloc with kstrndup,
for consistency.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Remove support for the 'mountprog' option
Chuck Lever [Fri, 26 Oct 2007 17:32:29 +0000 (13:32 -0400)]
NFS: Remove support for the 'mountprog' option

Remove the mount option that allows users to specify an alternate mountd
program number.  The client hasn't support setting an alternate mountd
program number for a very long time.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Remove support for the 'nfsprog' option
Chuck Lever [Fri, 26 Oct 2007 17:32:24 +0000 (13:32 -0400)]
NFS: Remove support for the 'nfsprog' option

Remove the mount option that allows users to specify an alternate NFS
program number.  The client hasn't support setting an alternate NFS
program number for a very long time.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Ensure that NFS version 4 mounts use NFS_PORT if nfsport wasn't set
Chuck Lever [Fri, 26 Oct 2007 17:32:19 +0000 (13:32 -0400)]
NFS: Ensure that NFS version 4 mounts use NFS_PORT if nfsport wasn't set

Text-based mount option parsing introduced a minor regression in the
behavior of NFS version 4 mounts.  NFS version 4 is not supposed to require
a running rpcbind service on the server in order for a mount to succeed.

In other words, if the mount options don't specify a port number, the port
number is supposed to default to 2049.  For earlier versions of NFS, the
default port number was zero in order to cause the RPC client to autobind
to the server's NFS service.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Prevent nfs_getattr() hang during heavy write workloads
Chuck Lever [Fri, 26 Oct 2007 17:32:13 +0000 (13:32 -0400)]
NFS: Prevent nfs_getattr() hang during heavy write workloads

POSIX requires that ctime and mtime, as reported by the stat(2) call,
reflect the activity of the most recent write(2).  To that end, nfs_getattr()
flushes pending dirty writes to a file before doing a GETATTR to allow the
NFS server to set the file's size, ctime, and mtime properly.

However, nfs_getattr() can be starved when a constant stream of application
writes to a file prevents nfs_wb_nocommit() from completing.  This usually
results in hangs of programs doing a stat against an NFS file that is being
written.  "ls -l" is a common victim of this behavior.

To prevent starvation, hold the file's i_mutex in nfs_getattr() to
freeze applications writes temporarily so the client can more quickly obtain
clean values for a file's size, mtime, and ctime.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Change sign of some loop indices in nfs4xdr.c
Chuck Lever [Fri, 26 Oct 2007 17:32:08 +0000 (13:32 -0400)]
NFS: Change sign of some loop indices in nfs4xdr.c

Nit: Eliminate some mixed sign comparisons in loop indices.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Use unsigned intermediates for manipulating header lengths (NFSv4 XDR)
Chuck Lever [Fri, 26 Oct 2007 17:32:03 +0000 (13:32 -0400)]
NFS: Use unsigned intermediates for manipulating header lengths (NFSv4 XDR)

Clean up: prevent length underflow and mixed sign comparison when
unmarshalling NFS version 4 getacl, readdir, and readlink replies.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Use unsigned intermediates for manipulating header lengths (NFSv3 XDR)
Chuck Lever [Fri, 26 Oct 2007 17:31:57 +0000 (13:31 -0400)]
NFS: Use unsigned intermediates for manipulating header lengths (NFSv3 XDR)

Clean up: prevent length underflow and mixed sign comparisons when
unmarshalling NFS version 3 read, readdir, and readlink replies.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Use unsigned intermediates for manipulating header lengths (NFSv2 XDR)
Chuck Lever [Fri, 26 Oct 2007 17:31:52 +0000 (13:31 -0400)]
NFS: Use unsigned intermediates for manipulating header lengths (NFSv2 XDR)

Clean up: prevent length underflow and mixed sign comparisons when
unmarshalling NFS version 2 read, readdir, and readlink replies.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Ensure nfs_wcc_update_inode always converts file size to loff_t
Chuck Lever [Fri, 26 Oct 2007 17:31:47 +0000 (13:31 -0400)]
NFS: Ensure nfs_wcc_update_inode always converts file size to loff_t

The nfs_wcc_update_inode() function omits logic to convert the type of
the NFS on-the-wire value of a file's size (__u64) to the type of file
size value stored in struct inode (loff_t, which is signed).

Everywhere else in the NFS client I checked already correctly converts the
file size type.

This effects only very large files.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Remove an unneeded implicit type cast when calling rpc_depopulate()
Chuck Lever [Fri, 26 Oct 2007 17:31:04 +0000 (13:31 -0400)]
SUNRPC: Remove an unneeded implicit type cast when calling rpc_depopulate()

The two arguments of rpc_depopulate() that pass in inode numbers should use
the same type as inode->i_ino: unsigned long.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: temp var should match return type of xdr_skb_read_actor
Chuck Lever [Fri, 26 Oct 2007 17:30:59 +0000 (13:30 -0400)]
SUNRPC: temp var should match return type of xdr_skb_read_actor

The return type of xdr_skb_read_actor functions is size_t.  This fixes a
nit I unwittingly overlooked in commit dd456471.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Check a return result
Chuck Lever [Fri, 26 Oct 2007 17:30:54 +0000 (13:30 -0400)]
SUNRPC: Check a return result

Minor: Replace an empty if statement with a debugging dprintk.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Thomas Talpey <Thomas.Talpey@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Fix an unnecessary implicit type cast in rpcrdma_count_chunks()
Chuck Lever [Fri, 26 Oct 2007 17:30:49 +0000 (13:30 -0400)]
SUNRPC: Fix an unnecessary implicit type cast in rpcrdma_count_chunks()

Nit: rl_nchunks is an unsigned integer, so pass it into
rpcrdma_count_chunks() via an unsigned integer argument.  This eliminates
a harmless mixed sign comparison in rpcrdma_count_chunks()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Thomas Talpey <Thomas.Talpey@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Prevent mixed sign comparisons in rpcrdma_convert_iovs()
Chuck Lever [Fri, 26 Oct 2007 17:30:43 +0000 (13:30 -0400)]
SUNRPC: Prevent mixed sign comparisons in rpcrdma_convert_iovs()

Keep the type of the buffer position the same during iovec conversion to
reduce the likelihood of unexpected results from comparisons and length
computations.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Thomas Talpey <Thomas.Talpey@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Remove the obsolete RPC_WAITQ macro
Trond Myklebust [Wed, 18 Jul 2007 22:32:38 +0000 (18:32 -0400)]
SUNRPC: Remove the obsolete RPC_WAITQ macro

Now that we've killed off all the users.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Cleanup to remove the last users of the RPC_WAITQ declaration
Trond Myklebust [Wed, 18 Jul 2007 17:24:19 +0000 (13:24 -0400)]
SUNRPC: Cleanup to remove the last users of the RPC_WAITQ declaration

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Unexport rpc_init_task() and rpc_execute()
Trond Myklebust [Thu, 25 Oct 2007 22:42:55 +0000 (18:42 -0400)]
SUNRPC: Unexport rpc_init_task() and rpc_execute()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS/SUNRPC: Convert users of rpc_init_task+rpc_execute to rpc_run_task()
Trond Myklebust [Thu, 25 Oct 2007 22:42:54 +0000 (18:42 -0400)]
NFS/SUNRPC: Convert users of rpc_init_task+rpc_execute to rpc_run_task()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: allow the caller of rpc_run_task to preallocate the struct rpc_task
Trond Myklebust [Thu, 25 Oct 2007 22:42:53 +0000 (18:42 -0400)]
SUNRPC: allow the caller of rpc_run_task to preallocate the struct rpc_task

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Remove the now unused function rpc_call_setup()
Trond Myklebust [Thu, 25 Oct 2007 22:42:21 +0000 (18:42 -0400)]
SUNRPC: Remove the now unused function rpc_call_setup()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS/SUNRPC: Convert all users of rpc_call_setup()
Trond Myklebust [Sat, 14 Jul 2007 19:40:01 +0000 (15:40 -0400)]
NFS/SUNRPC: Convert all users of rpc_call_setup()

Replace use of rpc_call_setup() with rpc_init_task(), and in cases where we
need to initialise task->tk_action, with rpc_call_start().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up the (commit|read|write)_setup() callback routines
Trond Myklebust [Sat, 14 Jul 2007 19:40:00 +0000 (15:40 -0400)]
NFS: Clean up the (commit|read|write)_setup() callback routines

Move the common code for setting up the nfs_write_data and nfs_read_data
structures into fs/nfs/read.c, fs/nfs/write.c and fs/nfs/direct.c.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Allow rpc_init_task() to initialise the rpc_task->tk_msg
Trond Myklebust [Thu, 25 Oct 2007 22:32:34 +0000 (18:32 -0400)]
SUNRPC: Allow rpc_init_task() to initialise the rpc_task->tk_msg

In preparation for the removal of rpc_call_setup().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Add a helper rpc_call_start() that initialises task->tk_action
Trond Myklebust [Thu, 25 Oct 2007 22:40:21 +0000 (18:40 -0400)]
SUNRPC: Add a helper rpc_call_start() that initialises task->tk_action

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Mask signals across the call to rpc_call_setup() in rpc_run_task
Trond Myklebust [Thu, 25 Oct 2007 22:19:37 +0000 (18:19 -0400)]
SUNRPC: Mask signals across the call to rpc_call_setup() in rpc_run_task

To ensure that the RPCSEC_GSS upcall is performed with the correct sigmask.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Clean up the initialisation of priority queue scheduling info.
Trond Myklebust [Sat, 14 Jul 2007 19:40:00 +0000 (15:40 -0400)]
SUNRPC: Clean up the initialisation of priority queue scheduling info.

We want the default scheduling priority (priority == 0) to remain
RPC_PRIORITY_NORMAL.

Also ensure that the priority wait queue scheduling is per process id
instead of sometimes being per thread, and sometimes being per inode.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Clean up rpc_run_task
Trond Myklebust [Sat, 14 Jul 2007 19:39:59 +0000 (15:39 -0400)]
SUNRPC: Clean up rpc_run_task

Make it use the new task initialiser structure instead of acting as a
wrapper.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Cleanup of rpc_task initialisation
Trond Myklebust [Sat, 14 Jul 2007 19:39:59 +0000 (15:39 -0400)]
SUNRPC: Cleanup of rpc_task initialisation

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Restrict sunrpc client exports
Trond Myklebust [Sat, 14 Jul 2007 19:39:59 +0000 (15:39 -0400)]
SUNRPC: Restrict sunrpc client exports

The sunrpc client exports are not meant to be part of any official kernel
API: they can change at the drop of a hat. Mark them as internal functions
using EXPORT_SYMBOL_GPL.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Move exported declarations to the function declarations
Trond Myklebust [Sat, 14 Jul 2007 19:39:58 +0000 (15:39 -0400)]
SUNRPC: Move exported declarations to the function declarations

Do this for all RPC client related functions and XDR functions.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agosunrpc: document the rpc_pipefs kernel api
J. Bruce Fields [Tue, 6 Nov 2007 18:06:03 +0000 (13:06 -0500)]
sunrpc: document the rpc_pipefs kernel api

Add kerneldoc comments for the rpc_pipefs.c functions that are exported.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Reconnect immediately whenever the server isn't refusing it.
Trond Myklebust [Tue, 1 Jan 2008 23:42:12 +0000 (18:42 -0500)]
SUNRPC: Reconnect immediately whenever the server isn't refusing it.

If we've disconnected from the server, rather than the other way round,
then it makes little sense to wait 3 seconds before reconnecting.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Rename xprt_disconnect()
Trond Myklebust [Tue, 6 Nov 2007 23:44:20 +0000 (18:44 -0500)]
SUNRPC: Rename xprt_disconnect()

xprt_disconnect() should really only be called when the transport shutdown
is completed, and it is time to wake up any pending tasks. Rename it to
xprt_disconnect_done() in order to reflect the semantical change.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Make call_status()/call_decode() call xprt_force_disconnect()
Trond Myklebust [Tue, 6 Nov 2007 23:40:12 +0000 (18:40 -0500)]
SUNRPC: Make call_status()/call_decode() call xprt_force_disconnect()

Move the calls to xprt_disconnect() over to xprt_force_disconnect() in
order to enable the transport layer to manage the state of the
XPRT_CONNECTED flag.
Ditto in xs_tcp_read_fraghdr().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: xprt_autoclose() should not call xprt_disconnect()
Trond Myklebust [Tue, 6 Nov 2007 23:28:53 +0000 (18:28 -0500)]
SUNRPC: xprt_autoclose() should not call xprt_disconnect()

The transport layer should do that itself whenever appropriate.

Note that the RDMA transport already assumes that it needs to call
xprt_disconnect in xprt_rdma_close().
For TCP sockets, we want to call xprt_disconnect() only after the
connection has been closed by both ends.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Use shutdown() instead of close() when disconnecting a TCP socket
Trond Myklebust [Mon, 5 Nov 2007 20:44:12 +0000 (15:44 -0500)]
SUNRPC: Use shutdown() instead of close() when disconnecting a TCP socket

By using shutdown() rather than close() we allow the RPC client to wait
for the TCP close handshake to complete before we start trying to reconnect
using the same port.
We use shutdown(SHUT_WR) only instead of shutting down both directions,
however we wait until the server has closed the connection on its side.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: TCP clear XPRT_CLOSE_WAIT when the socket is closed for writes
Trond Myklebust [Mon, 31 Dec 2007 21:19:17 +0000 (16:19 -0500)]
SUNRPC: TCP clear XPRT_CLOSE_WAIT when the socket is closed for writes

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Allow the client to detect if the TCP connection is closed
Trond Myklebust [Mon, 5 Nov 2007 22:42:39 +0000 (17:42 -0500)]
SUNRPC: Allow the client to detect if the TCP connection is closed

Add an xprt->state bit to enable the TCP ->state_change() method to signal
whether or not the TCP connection is in the process of closing down.
This will to be used by the reconnection logic in a separate patch.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Fix TCP rebinding logic
Trond Myklebust [Mon, 5 Nov 2007 22:40:58 +0000 (17:40 -0500)]
SUNRPC: Fix TCP rebinding logic

Currently the TCP rebinding logic assumes that if we're not using a
reserved port, then we don't need to reconnect on the same port if a
disconnection event occurs. This breaks most RPC duplicate reply cache
implementations.

Also take into account the fact that xprt_min_resvport and
xprt_max_resvport may change while we're reconnecting, since the user may
change them at any time via the sysctls. Ensure that we check the port
boundaries every time we loop in xs_bind4/xs_bind6. Also ensure that if the
boundaries change, we only scan the ports a maximum of 2 times.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoSUNRPC: Fix a race in xs_tcp_state_change()
Trond Myklebust [Tue, 6 Nov 2007 15:18:36 +0000 (10:18 -0500)]
SUNRPC: Fix a race in xs_tcp_state_change()

When scheduling the autoclose RPC call, we want to ensure that we don't
race against the test_bit() call in xprt_clear_locked().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Stop sillyname renames and unmounts from racing
Steve Dickson [Thu, 8 Nov 2007 09:05:04 +0000 (04:05 -0500)]
NFS: Stop sillyname renames and unmounts from racing

Added an active/deactive mechanism to the nfs_server structure
allowing async operations to hold off umount until the
operations are done.

Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFSv4: Clean up the OPEN/CLOSE serialisation code
Trond Myklebust [Tue, 8 Jan 2008 22:56:07 +0000 (17:56 -0500)]
NFSv4: Clean up the OPEN/CLOSE serialisation code

Reduce the time spent locking the rpc_sequence structure by queuing the
nfs_seqid only when we are ready to take the lock (when calling
nfs_wait_on_sequence).

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Clean up the write request locking.
Trond Myklebust [Tue, 22 Jan 2008 22:13:07 +0000 (17:13 -0500)]
NFS: Clean up the write request locking.

Ensure that we set/clear NFS_PAGE_TAG_LOCKED when the nfs_page is hashed.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Optimise nfs_vm_page_mkwrite()
Trond Myklebust [Tue, 22 Jan 2008 22:13:06 +0000 (17:13 -0500)]
NFS: Optimise nfs_vm_page_mkwrite()

The current model locks the page twice for no good reason. Optimise by
inlining the parts of nfs_write_begin()/nfs_write_end() that we care about.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Ensure that we eject stale inodes as soon as possible
Trond Myklebust [Tue, 29 Jan 2008 00:43:19 +0000 (19:43 -0500)]
NFS: Ensure that we eject stale inodes as soon as possible

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Handle -ENOENT errors in unlink()/rmdir()/rename()
Trond Myklebust [Tue, 29 Jan 2008 00:43:18 +0000 (19:43 -0500)]
NFS: Handle -ENOENT errors in unlink()/rmdir()/rename()

If the server returns an ENOENT error, we still need to do a d_delete() in
order to ensure that the dentry is deleted.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Sillyrename: in the case of a race, check aliases are really positive
Trond Myklebust [Tue, 29 Jan 2008 00:42:59 +0000 (19:42 -0500)]
NFS: Sillyrename: in the case of a race, check aliases are really positive

In nfs_do_call_unlink() we check that we haven't raced, and that lookup()
hasn't created an aliased dentry to our sillydeleted dentry. If somebody
has deleted the file on the server and the lookup() resulted in a negative
dentry, then ignore...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoNFS: Fix a sillyrename race...
Trond Myklebust [Sat, 26 Jan 2008 22:37:47 +0000 (17:37 -0500)]
NFS: Fix a sillyrename race...

Ensure that readdir revalidates its data cache after blocking on
sillyrename.

Also fix a typo in nfs_do_call_unlink(): swap the ^= for an |=. The result
is the same, since we've already checked that the flag is unset, but it
makes the code more readable.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
16 years agoMostly revert "e1000/e1000e: Move PCI-Express device IDs over to e1000e"
Linus Torvalds [Tue, 29 Jan 2008 22:54:54 +0000 (09:54 +1100)]
Mostly revert "e1000/e1000e: Move PCI-Express device IDs over to e1000e"

The new e1000e driver is apparently not yet suitable for general use, so
mark it experimental, and re-instate all the PCI-Express device IDs in
the old and stable e1000 driver so that people (namely me) can continue
to use a driver that actually works.

Auke & co have been appraised of the situation.

Cc: Auke Kok <auke-jan.h.kok@intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agosplice: fix problem with atime not being updated
Jens Axboe [Tue, 29 Jan 2008 20:05:57 +0000 (21:05 +0100)]
splice: fix problem with atime not being updated

A bug report on nfsd that states that since it was switched to use
splice instead of sendfile, the atime was no longer being updated
on the input file. do_generic_mapping_read() does this when accessing
the file, make splice do it for the direct splice handler.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
16 years agoblock: constify function pointer tables
Jan Engelhardt [Tue, 29 Jan 2008 19:57:51 +0000 (20:57 +0100)]
block: constify function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
16 years agocciss: fix bug in overriding ->data_len before completion
Jens Axboe [Tue, 29 Jan 2008 18:46:02 +0000 (19:46 +0100)]
cciss: fix bug in overriding ->data_len before completion

For BLOCK_PC requests, we need that length for completing the request.
Andrew Vasquez <andrew.vasquez@qlogic.com> reported the following
oops

Hitting a consistent BUG() with recent Linus' linux-2.6.git:

[   12.941428] ------------[ cut here ]------------
[   12.944874] kernel BUG at drivers/block/cciss.c:1260!
[   12.944874] invalid opcode: 0000 [1] SMP
[   12.944874] CPU 0
[   12.944874] Modules linked in:
[   12.944874] Pid: 0, comm: swapper Not tainted 2.6.24 #43
[   12.944874] RIP: 0010:[<ffffffff8039e43d>]  [<ffffffff8039e43d>] cciss_softirq_done+0xbc/0x1bf
[   12.944874] RSP: 0018:ffffffff8063aed0  EFLAGS: 00010202
[   12.944874] RAX: 0000000000000001 RBX: ffff8100cf800010 RCX: ffff81042f1253b0
[   12.944874] RDX: ffff81042de398f0 RSI: ffff81042de398f0 RDI: 0000000000000001
[   12.944874] RBP: ffff81042daa0000 R08: ffff81042f1253b0 R09: 0000000000000001
[   12.944874] R10: 00000000000000fe R11: 0000000000000000 R12: 0000000000000002
[   12.944874] R13: 0000000000000001 R14: ffff8100cf800000 R15: ffff81042de398f0
[   12.944874] FS:  0000000000000000(0000) GS:ffffffff805bb000(0000) knlGS:0000000000000000
[   12.944874] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[   12.944874] CR2: 00002afed7eea340 CR3: 000000042dbba000 CR4: 00000000000006e0
[   12.944874] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   12.944874] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[   12.944874] Process swapper (pid: 0, threadinfo ffffffff805f4000, task ffffffff805624a0)
[   12.944874] Stack:  0000000000000000 ffffffff8063af10 0000000000000001 ffffffff80632d60
[   12.944874]  0000000000000000 000000000000000a ffffffff805bb900 ffffffff8032038f
[   12.944874]  ffffffff8063af10 ffffffff8063af10 ffffffff805bb940 ffffffff802346b4
[   12.944874] Call Trace:
[   12.944874]  <IRQ>  [<ffffffff8032038f>] blk_done_softirq+0x69/0x78
[   12.944874]  [<ffffffff802346b4>] __do_softirq+0x6f/0xd8
[   12.944874]  [<ffffffff8020c45c>] call_softirq+0x1c/0x30
[   12.944874]  [<ffffffff8020e347>] do_softirq+0x30/0x80
[   12.944874]  [<ffffffff8020e409>] do_IRQ+0x72/0xd9
[   12.944874]  [<ffffffff8020a50a>] mwait_idle+0x0/0x46
[   12.944874]  [<ffffffff8020a3da>] default_idle+0x0/0x3d
[   12.944874]  [<ffffffff8020b7e1>] ret_from_intr+0x0/0xa
[   12.944874]  <EOI>  [<ffffffff8020a54c>] mwait_idle+0x42/0x46
[   12.944874]  [<ffffffff8020a481>] cpu_idle+0x6a/0xae
[   12.944874]
[   12.944874]
[   12.944874] Code: 0f 0b eb fe 48 8d 85 d8 c0 00 00 48 89 04 24 48 89 c7 e8 e5
[   12.944874] RIP  [<ffffffff8039e43d>] cciss_softirq_done+0xbc/0x1bf
[   12.944874]  RSP <ffffffff8063aed0>
[   12.944903] ---[ end trace e9c631603f90d22f ]---

which is caused by blk_end_request() returning 'not done' for a request,
since it gets asked to complete zero bytes.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
16 years agoExpose hardware sector size
Martin K. Petersen [Tue, 29 Jan 2008 18:14:08 +0000 (19:14 +0100)]
Expose hardware sector size

Expose hardware sector size in sysfs queue directory.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
16 years agoFix blktrace compile warning
Martin K. Petersen [Tue, 29 Jan 2008 18:12:06 +0000 (19:12 +0100)]
Fix blktrace compile warning

request_queue_t is deprecated

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
16 years agoblock: fix warning on compile with CONFIG_BLOCK
Jens Axboe [Tue, 29 Jan 2008 13:08:06 +0000 (14:08 +0100)]
block: fix warning on compile with CONFIG_BLOCK

struct io_context was not defined, just add an empty forward decl.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>