]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/log
linux-2.6-omap-h63xx.git
17 years agodriver core: Remove completion from struct klist_node
Matthew Wilcox [Thu, 16 Oct 2008 20:57:54 +0000 (14:57 -0600)]
driver core: Remove completion from struct klist_node

Removing the completion from klist_node reduces its size from 64 bytes
to 28 on x86-64.  To maintain the semantics of klist_remove(), we add
a single list of klist nodes which are pending deletion and scan them.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agodriver core: Rearrange struct device for better packing
Matthew Wilcox [Thu, 16 Oct 2008 21:51:35 +0000 (15:51 -0600)]
driver core: Rearrange struct device for better packing

This minor rearrangement saves 16 bytes from sizeof(struct device)
according to pahole.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoFix misspellings in pm.h macros
Alan Stern [Mon, 17 Nov 2008 16:14:19 +0000 (11:14 -0500)]
Fix misspellings in pm.h macros

This patch (as1167) fixes some misspellings in various recently-added
macros in pm.h.  Fortunately these macros are not yet used anywhere.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
17 years agoPM: Simplify the new suspend/hibernation framework for devices
Rafael J. Wysocki [Mon, 6 Oct 2008 20:46:05 +0000 (22:46 +0200)]
PM: Simplify the new suspend/hibernation framework for devices

PM: Simplify the new suspend/hibernation framework for devices

Following the discussion at the Kernel Summit, simplify the new
device PM framework by merging 'struct pm_ops' and
'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops'
from 'struct platform_driver' and 'struct pci_driver'.

After this change, the suspend/hibernation callbacks will only
reside in 'struct device_driver' as well as at the bus type/
device class/device type level.  Accordingly, PCI and platform
device drivers are now expected to put their suspend/hibernation
callbacks into the 'struct device_driver' embedded in
'struct pci_driver' or 'struct platform_driver', respectively.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agovirtio: convert to net_device_ops
Stephen Hemminger [Tue, 6 Jan 2009 18:44:22 +0000 (10:44 -0800)]
virtio: convert to net_device_ops

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agowireless: convert wireless ioctl to net_device_ops
Stephen Hemminger [Tue, 6 Jan 2009 18:42:24 +0000 (10:42 -0800)]
wireless: convert wireless ioctl to net_device_ops

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agobonding: use net_device_ops
Stephen Hemminger [Tue, 6 Jan 2009 18:41:56 +0000 (10:41 -0800)]
bonding: use net_device_ops

Use the correct pointer in debug message.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoirda: convert to internal stats
Stephen Hemminger [Tue, 6 Jan 2009 18:40:43 +0000 (10:40 -0800)]
irda: convert to internal stats

Convert IRDA drivers to use already existing net_device_stats structure
in network device. This is a pre-cursor to conversion to net_device
ops. Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoioat: fix self test for multi-channel case
Dan Williams [Tue, 6 Jan 2009 18:38:22 +0000 (11:38 -0700)]
ioat: fix self test for multi-channel case

In the multiple device case we need to re-arm the completion and protect
against concurrent self-tests.  The printk from the test callback is
removed as it can arbitrarily delay completion of the test.

Cc: <stable@kernel.org>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: bump initcall level to arch_initcall
Dan Williams [Tue, 6 Jan 2009 18:38:22 +0000 (11:38 -0700)]
dmaengine: bump initcall level to arch_initcall

There are dmaengine users that would like to register dma devices at
subsys_initcall time to ensure channels are available by device_initcall
time.

Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: advertise all channels on a device to dma_filter_fn
Dan Williams [Tue, 6 Jan 2009 18:38:21 +0000 (11:38 -0700)]
dmaengine: advertise all channels on a device to dma_filter_fn

Allow dma_filter_fn routines to disambiguate multiple channels on a device
rather than assuming that all channels on a device are equal.

Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: use idr for registering dma device numbers
Dan Williams [Tue, 6 Jan 2009 18:38:21 +0000 (11:38 -0700)]
dmaengine: use idr for registering dma device numbers

This brings some predictability to dma device numbers, i.e. an rmmod/insmod
cycle may now result in /sys/class/dma/dma0chan0 being restored rather than
/sys/class/dma/dma1chan0 appearing.

Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: add a release for dma class devices and dependent infrastructure
Dan Williams [Tue, 6 Jan 2009 18:38:21 +0000 (11:38 -0700)]
dmaengine: add a release for dma class devices and dependent infrastructure

Resolves:
WARNING: at drivers/base/core.c:122 device_release+0x4d/0x52()
Device 'dma0chan0' does not have a release() function, it is broken and must be fixed.

The dma_chan_dev object is introduced to gear-match sysfs kobject and
dmaengine channel lifetimes.  When a channel is removed access to the
sysfs entries return -ENODEV until the kobject can be released.

The bulk of the change is updates to existing code to handle the extra
layer of indirection between a dma_chan and its struct device.

Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agoioat: do not perform removal actions at shutdown
Dan Williams [Tue, 6 Jan 2009 18:38:20 +0000 (11:38 -0700)]
ioat: do not perform removal actions at shutdown

Unregistering services should only happen at "remove" time.  This prevents
the device from being unregistered while dmaengine clients are still
active.  Also, the comment on ioat_remove is stale since removal is prevented
while a channel may be in use.

Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agoiop-adma: enable module removal
Dan Williams [Tue, 6 Jan 2009 18:38:20 +0000 (11:38 -0700)]
iop-adma: enable module removal

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agoiop-adma: kill debug BUG_ON
Dan Williams [Tue, 6 Jan 2009 18:38:20 +0000 (11:38 -0700)]
iop-adma: kill debug BUG_ON

This BUG_ON caught problems in early development but now it is in the
way as it invalidly triggers when trying to remove the module.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agoiop-adma: let devm do its job, don't duplicate free
Dan Williams [Tue, 6 Jan 2009 18:38:19 +0000 (11:38 -0700)]
iop-adma: let devm do its job, don't duplicate free

No need to free stuff that the devm infrastructure will take care of...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: kill enum dma_state_client
Dan Williams [Tue, 6 Jan 2009 18:38:19 +0000 (11:38 -0700)]
dmaengine: kill enum dma_state_client

DMA_NAK is now useless.  We can just use a bool instead.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: remove 'bigref' infrastructure
Dan Williams [Tue, 6 Jan 2009 18:38:18 +0000 (11:38 -0700)]
dmaengine: remove 'bigref' infrastructure

Reference counting is done at the module level so clients need not worry
that a channel will leave while they are actively using dmaengine.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: kill struct dma_client and supporting infrastructure
Dan Williams [Tue, 6 Jan 2009 18:38:17 +0000 (11:38 -0700)]
dmaengine: kill struct dma_client and supporting infrastructure

All users have been converted to either the general-purpose allocator,
dma_find_channel, or dma_request_channel.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: replace dma_async_client_register with dmaengine_get
Dan Williams [Tue, 6 Jan 2009 18:38:17 +0000 (11:38 -0700)]
dmaengine: replace dma_async_client_register with dmaengine_get

Now that clients no longer need to be notified of channel arrival
dma_async_client_register can simply increment the dmaengine_ref_count.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agoatmel-mci: convert to dma_request_channel and down-level dma_slave
Dan Williams [Tue, 6 Jan 2009 18:38:16 +0000 (11:38 -0700)]
atmel-mci: convert to dma_request_channel and down-level dma_slave

dma_request_channel provides an exclusive channel, so we no longer need to
pass slave data through dmaengine.

Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmatest: convert to dma_request_channel
Dan Williams [Tue, 6 Jan 2009 18:38:15 +0000 (11:38 -0700)]
dmatest: convert to dma_request_channel

Replace the client registration infrastructure with a custom loop to
poll for channels.  Once dma_request_channel returns NULL stop asking
for channels.  A userspace side effect of this change if that loading
the dmatest module before loading a dma driver will result in no
channels being found, previously dmatest would get a callback.  To
facilitate testing in the built-in case dmatest_init is marked as a
late_initcall.  Another side effect is that channels under test can not
be used for any other purpose.

Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: introduce dma_request_channel and private channels
Dan Williams [Tue, 6 Jan 2009 18:38:15 +0000 (11:38 -0700)]
dmaengine: introduce dma_request_channel and private channels

This interface is primarily for device-to-memory clients which need to
search for dma channels with platform-specific characteristics.  The
prototype is:

struct dma_chan *dma_request_channel(dma_cap_mask_t mask,
                                     dma_filter_fn filter_fn,
                                     void *filter_param);

When the optional 'filter_fn' parameter is set to NULL
dma_request_channel simply returns the first channel that satisfies the
capability mask.  Otherwise, when the mask parameter is insufficient for
specifying the necessary channel, the filter_fn routine can be used to
disposition the available channels in the system. The filter_fn routine
is called once for each free channel in the system.  Upon seeing a
suitable channel filter_fn returns DMA_ACK which flags that channel to
be the return value from dma_request_channel.  A channel allocated via
this interface is exclusive to the caller, until dma_release_channel()
is called.

To ensure that all channels are not consumed by the general-purpose
allocator the DMA_PRIVATE capability is provided to exclude a dma_device
from general-purpose (memory-to-memory) consideration.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agonet_dma: convert to dma_find_channel
Dan Williams [Tue, 6 Jan 2009 18:38:15 +0000 (11:38 -0700)]
net_dma: convert to dma_find_channel

Use the general-purpose channel allocation provided by dmaengine.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: provide a common 'issue_pending_all' implementation
Dan Williams [Tue, 6 Jan 2009 18:38:14 +0000 (11:38 -0700)]
dmaengine: provide a common 'issue_pending_all' implementation

async_tx and net_dma each have open-coded versions of issue_pending_all,
so provide a common routine in dmaengine.

The implementation needs to walk the global device list, so implement
rcu to allow dma_issue_pending_all to run lockless.  Clients protect
themselves from channel removal events by holding a dmaengine reference.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: centralize channel allocation, introduce dma_find_channel
Dan Williams [Tue, 6 Jan 2009 18:38:14 +0000 (11:38 -0700)]
dmaengine: centralize channel allocation, introduce dma_find_channel

Allowing multiple clients to each define their own channel allocation
scheme quickly leads to a pathological situation.  For memory-to-memory
offload all clients can share a central allocator.

This simply moves the existing async_tx allocator to dmaengine with
minimal fixups:
* async_tx.c:get_chan_ref_by_cap --> dmaengine.c:nth_chan
* async_tx.c:async_tx_rebalance --> dmaengine.c:dma_channel_rebalance
* split out common code from async_tx.c:__async_tx_find_channel -->
  dma_find_channel

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agodmaengine: up-level reference counting to the module level
Dan Williams [Tue, 6 Jan 2009 18:38:14 +0000 (11:38 -0700)]
dmaengine: up-level reference counting to the module level

Simply, if a client wants any dmaengine channel then prevent all dmaengine
modules from being removed.  Once the clients are done re-enable module
removal.

Why?, beyond reducing complication:
1/ Tracking reference counts per-transaction in an efficient manner, as
   is currently done, requires a complicated scheme to avoid cache-line
   bouncing effects.
2/ Per-transaction ref-counting gives the false impression that a
   dma-driver can be gracefully removed ahead of its user (net, md, or
   dma-slave)
3/ None of the in-tree dma-drivers talk to hot pluggable hardware, but
   if such an engine were built one day we still would not need to notify
   clients of remove events.  The driver can simply return NULL to a
   ->prep() request, something that is much easier for a client to handle.

Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
17 years agoBtrfs: Don't use kmap_atomic(..., KM_IRQ0) during checksum verifies
Chris Mason [Tue, 6 Jan 2009 18:26:40 +0000 (13:26 -0500)]
Btrfs: Don't use kmap_atomic(..., KM_IRQ0) during checksum verifies

Checksum verification happens in a helper thread, and there is no
need to mess with interrupts.  This switches to kmap() instead.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agosparc: make proces_ver_nack a bit more readable
Steven Rostedt [Tue, 6 Jan 2009 18:02:38 +0000 (10:02 -0800)]
sparc: make proces_ver_nack a bit more readable

Impact: clean up

The code in process_ver_nack is a little obfuscated. This change
makes it a bit more readable by humans. It removes the complex
if statement and replaces it with a cleaner flow of control.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agowusb: return -ENOTCONN when resetting a port with no connected device
David Vrabel [Tue, 6 Jan 2009 17:58:02 +0000 (17:58 +0000)]
wusb: return -ENOTCONN when resetting a port with no connected device

If reading the device descriptor fails during hub_port_init() fails,
then the port is disabled, disconnecting the device.  The port is then
reset at the start of the next init attempt but there is no device to
reset.

Signed-off-by: David Vrabel <david.vrabel@csr.com>
17 years agouwb: safely remove all reservations
David Vrabel [Tue, 6 Jan 2009 17:55:32 +0000 (17:55 +0000)]
uwb: safely remove all reservations

When removing all reservations during shutdown, terminate them first and
then wait for any pending timeout work to complete.  This prevents the
timeout work from running after the reservation has been freed.

Signed-off-by: David Vrabel <david.vrabel@csr.com>
17 years agoSUNRPC: Ensure the server closes sockets in a timely fashion
Trond Myklebust [Tue, 23 Dec 2008 21:30:11 +0000 (16:30 -0500)]
SUNRPC: Ensure the server closes sockets in a timely fashion

We want to ensure that connected sockets close down the connection when we
set XPT_CLOSE, so that we don't keep it hanging while cleaning up all the
stuff that is keeping a reference to the socket.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNFSD: Add documenting comments for nfsctl interface
Chuck Lever [Fri, 12 Dec 2008 21:57:35 +0000 (16:57 -0500)]
NFSD: Add documenting comments for nfsctl interface

Document the NFSD sysctl interface laid out in fs/nfsd/nfsctl.c.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNFSD: Replace open-coded integer with macro
Chuck Lever [Fri, 12 Dec 2008 21:57:27 +0000 (16:57 -0500)]
NFSD: Replace open-coded integer with macro

Clean up: Instead of open-coding 2049, use the NFS_PORT macro.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNFSD: Fix a handful of coding style issues in write_filehandle()
Chuck Lever [Fri, 12 Dec 2008 21:57:20 +0000 (16:57 -0500)]
NFSD: Fix a handful of coding style issues in write_filehandle()

Clean up: follow kernel coding style.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNFSD: clean up failover sysctl function naming
Chuck Lever [Fri, 12 Dec 2008 21:57:13 +0000 (16:57 -0500)]
NFSD: clean up failover sysctl function naming

Clean up: Rename recently-added failover functions to match the naming
convention in fs/nfsd/nfsctl.c.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agolockd: Enable NLM use of AF_INET6
Chuck Lever [Thu, 11 Dec 2008 22:56:59 +0000 (17:56 -0500)]
lockd: Enable NLM use of AF_INET6

If the kernel is configured to support IPv6 and the RPC server can register
services via rpcbindv4, we are all set to enable IPv6 support for lockd.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aime Le Rouzic <aime.le-rouzic@bull.net>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Rewrite IPv4 privileged requester's check
Chuck Lever [Thu, 11 Dec 2008 22:56:52 +0000 (17:56 -0500)]
NLM: Rewrite IPv4 privileged requester's check

Clean up.

For consistency, rewrite the IPv4 check to match the same style as the
new IPv6 check.  Note that ipv4_is_loopback() is somewhat broader in
its interpretation of what is a loopback address than simply
"127.0.0.1".

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: nlm_privileged_requester() doesn't recognize mapped loopback address
Chuck Lever [Thu, 11 Dec 2008 22:56:44 +0000 (17:56 -0500)]
NLM: nlm_privileged_requester() doesn't recognize mapped loopback address

Commit b85e4676 added the nlm_privileged_requester() helper to check
whether an RPC request was sent from a local privileged caller.  It
recognizes IPv4 privileged callers (from "127.0.0.1"), and IPv6
privileged callers (from "::1").

However, IPV6_ADDR_LOOPBACK is not set for the mapped IPv4 loopback
address (::ffff:7f00:0001), so the test breaks when the kernel's RPC
service is IPv6-enabled but user space is calling via the IPv4
loopback address.  This is actually the most common case for IPv6-
enabled RPC services on Linux.

Rewrite the IPv6 check to handle the mapped IPv4 loopback address as
well as a normal IPv6 loopback address.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Move nsm_create()
Chuck Lever [Thu, 11 Dec 2008 22:56:37 +0000 (17:56 -0500)]
NSM: Move nsm_create()

Clean up: one last thing... relocate nsm_create() to eliminate the forward
declaration and group it near the only function that actually uses it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Move nsm_use_hostnames to mon.c
Chuck Lever [Thu, 11 Dec 2008 22:56:29 +0000 (17:56 -0500)]
NSM: Move nsm_use_hostnames to mon.c

Clean up.

Treat the nsm_use_hostnames global variable like nsm_local_state.
Note that the default value of nsm_use_hostnames is still zero.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Move nsm_addr() to fs/lockd/mon.c
Chuck Lever [Thu, 11 Dec 2008 22:56:22 +0000 (17:56 -0500)]
NSM: Move nsm_addr() to fs/lockd/mon.c

Clean up: nsm_addr_in() is no longer used, and nsm_addr() is used only in
fs/lockd/mon.c, so move it there.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Remove include/linux/lockd/sm_inter.h
Chuck Lever [Thu, 11 Dec 2008 22:56:14 +0000 (17:56 -0500)]
NSM: Remove include/linux/lockd/sm_inter.h

Clean up: The include/linux/lockd/sm_inter.h header is nearly empty
now.  Remove it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Replace IP address as our nlm_reboot lookup key
Chuck Lever [Thu, 11 Dec 2008 22:56:07 +0000 (17:56 -0500)]
NSM: Replace IP address as our nlm_reboot lookup key

NLM provides file locking services for NFS files.  Part of this service
includes a second protocol, known as NSM, which is a reboot
notification service.  NLM uses this service to determine when to
reclaim locks or enter a grace period after a client or server reboots.

The NLM service (implemented by lockd in the Linux kernel) contacts
the local NSM service (implemented by rpc.statd in Linux user space)
via NSM protocol upcalls to register a callback when a particular
remote peer reboots.

To match the callback to the correct remote peer, the NLM service
constructs a cookie that it passes in the request.  The NSM service
passes that cookie back to the NLM service when it is notified that
the given remote peer has indeed rebooted.

Currently on Linux, the cookie is the raw 32-bit IPv4 address of the
remote peer.  To support IPv6 addresses, which are larger, we could
use all 16 bytes of the cookie to represent a full IPv6 address,
although we still can't represent an IPv6 address with a scope ID in
just 16 bytes.

Instead, to avoid the need for future changes to support additional
address types, we'll use a manufactured value for the cookie, and use
that to find the corresponding nsm_handle struct in the kernel during
the NLMPROC_SM_NOTIFY callback.

This should provide complete support in the kernel's NSM
implementation for IPv6 hosts, while remaining backwards compatible
with older rpc.statd implementations.

Note we also deal with another case where nsm_use_hostnames can change
while there are outstanding notifications, possibly resulting in the
loss of reboot notifications.  After this patch, the priv cookie is
always used to lookup rebooted hosts in the kernel.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: More clean up of nsm_get_handle()
Chuck Lever [Thu, 11 Dec 2008 22:55:59 +0000 (17:55 -0500)]
NSM: More clean up of nsm_get_handle()

Clean up: refactor nsm_get_handle() so it is organized the same way that
nsm_reboot_lookup() is.

There is an additional micro-optimization here.  This change moves the
"hostname & nsm_use_hostnames" test out of the list_for_each_entry()
clause in nsm_get_handle(), since it is loop-invariant.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Refactor nsm_handle creation into a helper function
Chuck Lever [Thu, 11 Dec 2008 22:55:52 +0000 (17:55 -0500)]
NSM: Refactor nsm_handle creation into a helper function

Clean up.  Refactor the creation of nsm_handles into a helper.  Fields
are initialized in increasing address order to make efficient use of
CPU caches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Remove "create" argument from nsm_find()
Chuck Lever [Sat, 6 Dec 2008 00:04:01 +0000 (19:04 -0500)]
NLM: Remove "create" argument from nsm_find()

Clean up: nsm_find() now has only one caller, and that caller
unconditionally sets the @create argument. Thus the @create
argument is no longer needed.

Since nsm_find() now has a more specific purpose, pick a more
appropriate name for it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Call nsm_reboot_lookup() instead of nsm_find()
Chuck Lever [Sat, 6 Dec 2008 00:03:54 +0000 (19:03 -0500)]
NLM: Call nsm_reboot_lookup() instead of nsm_find()

Invoke the newly introduced nsm_reboot_lookup() function in
nlm_host_rebooted() instead of nsm_find().

This introduces just one behavioral change: debugging messages
produced during reboot notification will now appear when the
NLMDBG_MONITOR flag is set, but not when the NLMDBG_HOSTCACHE flag
is set.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Add nsm_lookup() function
Chuck Lever [Sat, 6 Dec 2008 00:03:46 +0000 (19:03 -0500)]
NSM: Add nsm_lookup() function

Introduce a new API to fs/lockd/mon.c that allows nlm_host_rebooted()
to lookup up nsm_handles via the contents of an nlm_reboot struct.

The new function is equivalent to calling nsm_find() with @create set
to zero, but it takes a struct nlm_reboot instead of separate
arguments.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Decode "priv" argument of NLMPROC_SM_NOTIFY as an opaque
Chuck Lever [Sat, 6 Dec 2008 00:03:39 +0000 (19:03 -0500)]
NLM: Decode "priv" argument of NLMPROC_SM_NOTIFY as an opaque

The NLM XDR decoders for the NLMPROC_SM_NOTIFY procedure should treat
their "priv" argument truly as an opaque, as defined by the protocol,
and let the upper layers figure out what is in it.

This will make it easier to modify the contents and interpretation of
the "priv" argument, and keep knowledge about what's in "priv" local
to fs/lockd/mon.c.

For now, the NLM and NSM implementations should behave exactly as they
did before.

The formation of the address of the rebooted host in
nlm_host_rebooted() may look a little strange, but it is the inverse
of how nsm_init_private() forms the private cookie.  Plus, it's
going away soon anyway.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Change nlm_host_rebooted() to take a single nlm_reboot argument
Chuck Lever [Sat, 6 Dec 2008 00:03:31 +0000 (19:03 -0500)]
NLM: Change nlm_host_rebooted() to take a single nlm_reboot argument

Pass the nlm_reboot data structure directly from the NLMPROC_SM_NOTIFY
XDR decoders to nlm_host_rebooted().  This eliminates some packing and
unpacking of the NLMPROC_SM_NOTIFY results, and prepares for passing
these results, including the "priv" cookie, directly to a lookup
routine in fs/lockd/mon.c.

This patch changes code organization but should not cause any
behavioral change.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Encode the new "priv" cookie for NSMPROC_MON requests
Chuck Lever [Sat, 6 Dec 2008 00:03:24 +0000 (19:03 -0500)]
NSM: Encode the new "priv" cookie for NSMPROC_MON requests

Pass the new "priv" cookie to NSMPROC_MON's XDR encoder, instead of
creating the "priv" argument in the encoder at call time.

This patch should not cause a behavioral change: the contents of the
cookie remain the same for the time being.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Generate NSMPROC_MON's "priv" argument when nsm_handle is created
Chuck Lever [Sat, 6 Dec 2008 00:03:16 +0000 (19:03 -0500)]
NSM: Generate NSMPROC_MON's "priv" argument when nsm_handle is created

Introduce a new data type, used by both the in-kernel NLM and NSM
implementations, that is used to manage the opaque "priv" argument
for the NSMPROC_MON and NLMPROC_SM_NOTIFY calls.

Construct the "priv" cookie when the nsm_handle is created.

The nsm_init_private() function may look a little strange, but it is
roughly equivalent to how the XDR encoder formed the "priv" argument.
It's going to go away soon.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Remove !nsm check from nsm_release()
Chuck Lever [Sat, 6 Dec 2008 00:03:09 +0000 (19:03 -0500)]
NSM: Remove !nsm check from nsm_release()

The nsm_release() function should never be called with a NULL handle
point.  If it is, that's a bug.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Remove NULL pointer check from nsm_find()
Chuck Lever [Sat, 6 Dec 2008 00:03:01 +0000 (19:03 -0500)]
NSM: Remove NULL pointer check from nsm_find()

The nsm_find() function should never be called with a NULL IP address
pointer.  If it is, that's a bug.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Add dprintk() calls in nsm_find and nsm_release
Chuck Lever [Sat, 6 Dec 2008 00:02:53 +0000 (19:02 -0500)]
NSM: Add dprintk() calls in nsm_find and nsm_release

Introduce some dprintk() calls in fs/lockd/mon.c that are enabled by
the NLMDBG_MONITOR flag.  These report when we find, create, and
release nsm_handles.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Move nsm_find() to fs/lockd/mon.c
Chuck Lever [Sat, 6 Dec 2008 00:02:45 +0000 (19:02 -0500)]
NSM: Move nsm_find() to fs/lockd/mon.c

The nsm_find() function sets up fresh nsm_handle entries.  This is
where we will store the "priv" cookie used to lookup nsm_handles during
reboot recovery.  The cookie will be constructed when nsm_find()
creates a new nsm_handle.

As much as possible, I would like to keep everything that handles a
"priv" cookie in fs/lockd/mon.c so that all the smarts are in one
source file.  That organization should make it pretty simple to see how
all this works.

To me, it makes more sense than the current arrangement to keep
nsm_find() with nsm_monitor() and nsm_unmonitor().

So, start reorganizing by moving nsm_find() into fs/lockd/mon.c.  The
nsm_release() function comes along too, since it shares the nsm_lock
global variable.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: move to xdr_stream-based XDR encoders and decoders
Chuck Lever [Sat, 6 Dec 2008 00:02:15 +0000 (19:02 -0500)]
NSM: move to xdr_stream-based XDR encoders and decoders

Introduce xdr_stream-based XDR encoder and decoder functions, which are
more careful about preventing RPC buffer overflows.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Move NSM program and procedure numbers to fs/lockd/mon.c
Chuck Lever [Sat, 6 Dec 2008 00:02:07 +0000 (19:02 -0500)]
NSM: Move NSM program and procedure numbers to fs/lockd/mon.c

Clean up: Move the RPC program and procedure numbers for NSM into the
one source file that needs them: fs/lockd/mon.c.

And, as with NLM, NFS, and rpcbind calls, use NSMPROC_FOO instead of
SM_FOO for NSM procedure numbers.

Finally, make a couple of comments more precise: what is referred to
here as SM_NOTIFY is really the NLM (lockd) NLMPROC_SM_NOTIFY downcall,
not NSMPROC_NOTIFY.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Move NSM-related XDR data structures to lockd's xdr.h
Chuck Lever [Sat, 6 Dec 2008 00:01:59 +0000 (19:01 -0500)]
NSM: Move NSM-related XDR data structures to lockd's xdr.h

Clean up: NSM's XDR data structures are used only in fs/lockd/mon.c,
so move them there.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Check result of SM_UNMON upcall
Chuck Lever [Thu, 4 Dec 2008 19:21:46 +0000 (14:21 -0500)]
NSM: Check result of SM_UNMON upcall

Make sure any error returned by rpc.statd during an SM_UNMON call is
reported rather than ignored completely.  There isn't much to do with
such an error, but we should log it in any case.

Similar to a recent change to nsm_monitor().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Move the public declaration of nsm_unmonitor() to lockd.h
Chuck Lever [Thu, 4 Dec 2008 19:21:38 +0000 (14:21 -0500)]
NLM: Move the public declaration of nsm_unmonitor() to lockd.h

Clean up.

Make the nlm_host argument "const," and move the public declaration to
lockd.h.  Add a documenting comment.

Bruce observed that nsm_unmonitor()'s only caller doesn't care about
its return code, so make nsm_unmonitor() return void.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Release nsmhandle in nlm_destroy_host
Chuck Lever [Thu, 4 Dec 2008 19:21:31 +0000 (14:21 -0500)]
NSM: Release nsmhandle in nlm_destroy_host

The nsm_handle's reference count is bumped in nlm_lookup_host().  It
should be decremented in nlm_destroy_host() to make it easier to see
the balance of these two operations.

Move the nsm_release() call to fs/lockd/host.c.

The h_nsmhandle pointer is set in nlm_lookup_host(), and never cleared.
The nlm_destroy_host() function is never called for the same nlm_host
twice, so h_nsmhandle won't ever be NULL when nsm_unmonitor() is
called.

All references to the nlm_host are gone before it is freed.  We can
skip making h_nsmhandle NULL just before the nlm_host is deallocated.

It's also likely we can remove the h_nsmhandle NULL check in
nlmsvc_is_client() as well, but we can do that later when rearchitect-
ing the nlm_host cache.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Move the public declaration of nsm_monitor() to lockd.h
Chuck Lever [Thu, 4 Dec 2008 19:21:24 +0000 (14:21 -0500)]
NLM: Move the public declaration of nsm_monitor() to lockd.h

Clean up.

Make the nlm_host argument "const," and move the public declaration to
lockd.h with other NSM public function (nsm_release, eg) and global
variable declarations.

Add a documenting comment.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Make sure to return an error if the SM_MON call result is not zero
Chuck Lever [Thu, 4 Dec 2008 19:21:15 +0000 (14:21 -0500)]
NSM: Make sure to return an error if the SM_MON call result is not zero

The nsm_monitor() function reports an error and does not set sm_monitored
if the SM_MON upcall reply has a non-zero result code, but nsm_monitor()
does not return an error to its caller in this case.

Since sm_monitored is not set, the upcall is retried when the next NLM
request invokes nsm_monitor().  However, that may not come for a while.
In the meantime, at least one NLM request will potentially proceed
without the peer being monitored properly.

Have nsm_monitor() return an error if the result code is non-zero.
This will cause all NLM requests to fail immediately if the upcall
completed successfully but rpc.statd returned an error.

This may be inconvenient in some cases (for example if rpc.statd
cannot complete a proper DNS reverse lookup of the hostname), but will
make the reboot monitoring service more robust by forcing such issues
to be corrected by an admin.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Remove BUG_ON() in nsm_monitor()
Chuck Lever [Thu, 4 Dec 2008 19:21:08 +0000 (14:21 -0500)]
NSM: Remove BUG_ON() in nsm_monitor()

Clean up: Remove the BUG_ON() invocation in nsm_monitor().  It's not
likely that nsm_monitor() is ever called with a NULL host pointer, and
the code will die anyway if host is NULL.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Remove redundant printk() in nlmclnt_lock()
Chuck Lever [Thu, 4 Dec 2008 19:21:01 +0000 (14:21 -0500)]
NLM: Remove redundant printk() in nlmclnt_lock()

The nsm_monitor() function already generates a printk(KERN_NOTICE) if
the SM_MON upcall fails, so the similar printk() in the nlmclnt_lock()
function is redundant.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Use sm_name instead of h_name in nsm_monitor() and nsm_unmonitor()
Chuck Lever [Thu, 4 Dec 2008 19:20:53 +0000 (14:20 -0500)]
NSM: Use sm_name instead of h_name in nsm_monitor() and nsm_unmonitor()

Clean up: Use the sm_name field for reporting the hostname in nsm_monitor()
and nsm_unmonitor(), just as the other functions in fs/lockd/mon.c do.

The h_name field is just a copy of the sm_name pointer.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Support IPv6 version of mon_name
Chuck Lever [Thu, 4 Dec 2008 19:20:46 +0000 (14:20 -0500)]
NSM: Support IPv6 version of mon_name

The "mon_name" argument of the NSMPROC_MON and NSMPROC_UNMON upcalls
is a string that contains the hostname or IP address of the remote peer
to be notified when this host has rebooted.  The sm-notify command uses
this identifier to contact the peer when we reboot, so it must be
either a well-qualified DNS hostname or a presentation format IP
address string.

When the "nsm_use_hostnames" sysctl is set to zero, the kernel's NSM
provides a presentation format IP address in the "mon_name" argument.
Otherwise, the "caller_name" argument from NLM requests is used,
which is usually just the DNS hostname of the peer.

To support IPv6 addresses for the mon_name argument, we use the
nsm_handle's address eye-catcher, which already contains an appropriate
presentation format address string.  Using the eye-catcher string
obviates the need to use a large buffer on the stack to form the
presentation address string for the upcall.

This patch also addresses a subtle bug.

An NSMPROC_MON request and the subsequent NSMPROC_UNMON request for the
same peer are required to use the same value for the "mon_name"
argument.  Otherwise, rpc.statd's NSMPROC_UNMON processing cannot
locate the database entry for that peer and remove it.

If the setting of nsm_use_hostnames is changed between the time the
kernel sends an NSMPROC_MON request and the time it sends the
NSMPROC_UNMON request for the same peer, the "mon_name" argument for
these two requests may not be the same.  This is because the value of
"mon_name" is currently chosen at the moment the call is made based on
the setting of nsm_use_hostnames

To ensure both requests pass identical contents in the "mon_name"
argument, we now select which string to use for the argument in the
nsm_monitor() function.  A pointer to this string is saved in the
nsm_handle so it can be used for a subsequent NSMPROC_UNMON upcall.

NB: There are other potential problems, such as how nlm_host_rebooted()
might behave if nsm_use_hostnames were changed while hosts are still
being monitored.  This patch does not attempt to address those
problems.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Use modern style for sm_name field in nsm_handle
Chuck Lever [Thu, 4 Dec 2008 19:20:38 +0000 (14:20 -0500)]
NSM: Use modern style for sm_name field in nsm_handle

Clean up: I'm about to add another "char *" field to the nsm_handle
structure.  The sm_name field uses an older style of declaring a
"char *" field.  If I match that style for the new field, checkpatch.pl
will complain.

So, fix the sm_name field to use the new style.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: convert printk(KERN_DEBUG) to a dprintk()
Chuck Lever [Thu, 4 Dec 2008 19:20:31 +0000 (14:20 -0500)]
NSM: convert printk(KERN_DEBUG) to a dprintk()

Clean up: make the printk(KERN_DEBUG) in nsm_mon_unmon() a dprintk,
and add another dprintk to note if creating an RPC client for the
upcall failed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNSM: Use C99 structure initializer to initialize nsm_args
Chuck Lever [Thu, 4 Dec 2008 19:20:23 +0000 (14:20 -0500)]
NSM: Use C99 structure initializer to initialize nsm_args

Clean up: Use a C99 structure initializer instead of open-coding the
initialization of nsm_args.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Add helper to handle IPv4 addresses
Chuck Lever [Thu, 4 Dec 2008 19:20:16 +0000 (14:20 -0500)]
NLM: Add helper to handle IPv4 addresses

Clean up: introduce a helper function to generate IPv4 addresses using
the same style as the IPv6 helper function we just added.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Support IPv6 scope IDs in nlm_display_address()
Chuck Lever [Thu, 4 Dec 2008 19:20:08 +0000 (14:20 -0500)]
NLM: Support IPv6 scope IDs in nlm_display_address()

Scope ID support is needed since the kernel's NSM implementation is
about to use these displayed addresses as a mon_name in some cases.

When nsm_use_hostnames is zero, without scope ID support NSM will fail
to handle peers that contact us via a link-local address.  Link-local
addresses do not work without an interface ID, which is stored in the
sockaddr's sin6_scope_id field.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Remove AF_UNSPEC arm in nlm_display_address()
Chuck Lever [Thu, 4 Dec 2008 19:20:01 +0000 (14:20 -0500)]
NLM: Remove AF_UNSPEC arm in nlm_display_address()

AF_UNSPEC support is no longer needed in nlm_display_address() now
that a presentation address is no longer generated for the h_srcaddr
field.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Remove address eye-catcher buffers from nlm_host
Chuck Lever [Thu, 4 Dec 2008 19:19:53 +0000 (14:19 -0500)]
NLM: Remove address eye-catcher buffers from nlm_host

The h_name field in struct nlm_host is a just copy of
h_nsmhandle->sm_name.  Likewise, the contents of the h_addrbuf field
should be identical to the sm_addrbuf field.

The h_srcaddrbuf field is used only in one place for debugging.  We can
live without this until we get %pI formatting for printk().

Currently these buffers are 48 bytes, but we need to support scope IDs
in IPv6 presentation addresses, which means making the buffers even
larger.  Instead, let's find ways to eliminate them to save space.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoNLM: Use modern style for pointer fields in nlm_host
Chuck Lever [Thu, 4 Dec 2008 19:19:45 +0000 (14:19 -0500)]
NLM: Use modern style for pointer fields in nlm_host

Clean up: I'm about to add another "char *" field to the nlm_host
structure.  The h_name field, for example, uses an older style of
declaring a "char *" field.  If I match that style for the new field,
checkpatch.pl will complain.

So, fix pointer fields to use the new style.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agolockd: set svc_serv->sv_maxconn to a more reasonable value (try #3)
Jeff Layton [Mon, 20 Oct 2008 15:51:58 +0000 (11:51 -0400)]
lockd: set svc_serv->sv_maxconn to a more reasonable value (try #3)

The default method for calculating the number of connections allowed
per RPC service arbitrarily limits single-threaded services to 80
connections. This is too low for services like lockd and artificially
limits the number of TCP clients that it can support.

Have lockd set a default sv_maxconn value to 1024 (which is the typical
default value for RLIMIT_NOFILE. Also add a module parameter to allow an
admin to set this to an arbitrary value.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agosunrpc: add sv_maxconn field to svc_serv (try #3)
Jeff Layton [Mon, 20 Oct 2008 15:51:57 +0000 (11:51 -0400)]
sunrpc: add sv_maxconn field to svc_serv (try #3)

svc_check_conn_limits() attempts to prevent denial of service attacks
by having the service close old connections once it reaches a
threshold. This threshold is based on the number of threads in the
service:

(serv->sv_nrthreads + 3) * 20

Once we reach this, we drop the oldest connections and a printk pops
to warn the admin that they should increase the number of threads.

Increasing the number of threads isn't an option however for services
like lockd. We don't want to eliminate this check entirely for such
services but we need some way to increase this limit.

This patch adds a sv_maxconn field to the svc_serv struct. When it's
set to 0, we use the current method to calculate the max number of
connections. RPC services can then set this on an as-needed basis.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agonfsd: document new filehandle fsid types
J. Bruce Fields [Mon, 20 Oct 2008 21:48:43 +0000 (17:48 -0400)]
nfsd: document new filehandle fsid types

Descriptions taken from mountd code (in nfs-utils/utils/mountd/cache.c).

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agonfsd: Fix leaked memory in nfs4_make_rec_clidname
Krishna Kumar [Mon, 20 Oct 2008 06:17:09 +0000 (11:47 +0530)]
nfsd: Fix leaked memory in nfs4_make_rec_clidname

cksum.data is not freed up in one error case. Compile tested.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agonfsd: Minor cleanup of find_stateid
Krishna Kumar [Mon, 20 Oct 2008 06:14:28 +0000 (11:44 +0530)]
nfsd: Minor cleanup of find_stateid

Minor cleanup/rewrite of find_stateid. Compile tested.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agonfsd: update fh_verify description
J. Bruce Fields [Mon, 20 Oct 2008 17:01:59 +0000 (13:01 -0400)]
nfsd: update fh_verify description

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
17 years agoBtrfs: tree logging checksum fixes
Yan Zheng [Tue, 6 Jan 2009 16:42:00 +0000 (11:42 -0500)]
Btrfs: tree logging checksum fixes

This patch contains following things.

1) Limit the max size of btrfs_ordered_sum structure to PAGE_SIZE.  This
struct is kmalloced so we want to keep it reasonable.

2) Replace copy_extent_csums by btrfs_lookup_csums_range.  This was
duplicated code in tree-log.c

3) Remove replay_one_csum. csum items are replayed at the same time as
   replaying file extents. This guarantees we only replay useful csums.

4) nbytes accounting fix.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
17 years agoMerge branches 'x86/cleanups', 'x86/mpparse', 'x86/numa' and 'x86/uv' into x86/urgent
Ingo Molnar [Tue, 6 Jan 2009 16:39:52 +0000 (17:39 +0100)]
Merge branches 'x86/cleanups', 'x86/mpparse', 'x86/numa' and 'x86/uv' into x86/urgent

17 years agoscc_pata: make use of scc_dma_sff_read_status()
Sergei Shtylyov [Tue, 6 Jan 2009 16:21:02 +0000 (17:21 +0100)]
scc_pata: make use of scc_dma_sff_read_status()

Make consistent use of scc_dma_sff_read_status() throughout the driver.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide-dma-sff: factor out ide_dma_sff_write_status()
Sergei Shtylyov [Tue, 6 Jan 2009 16:21:02 +0000 (17:21 +0100)]
ide-dma-sff: factor out ide_dma_sff_write_status()

Factor out ide_dma_sff_write_status(), symmetric to ide_dma_sff_read_status().

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: move read_sff_dma_status() method to 'struct ide_dma_ops'
Sergei Shtylyov [Tue, 6 Jan 2009 16:21:02 +0000 (17:21 +0100)]
ide: move read_sff_dma_status() method to 'struct ide_dma_ops'

Move apparently misplaced read_sff_dma_status() method from 'struct ide_tp_ops'
to 'struct ide_dma_ops', renaming it to dma_sff_read_status() and making only
required for SFF-8038i compatible IDE controller drivers (greatly cutting down
the number of initializers) as its only user (outside ide-dma-sff.c and such
drivers) appears to be ide_pci_check_simplex() which is only called for such
controllers...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: don't set hwif->dma_ops in init_dma() method
Sergei Shtylyov [Tue, 6 Jan 2009 16:21:01 +0000 (17:21 +0100)]
ide: don't set hwif->dma_ops in init_dma() method

Replace setting of 'hwif->dma_ops' in the 'alim15x3' and 'palm_bk3710' drivers'
init_dma() methods with initializing the corresponding member of their 'struct
ide_port_info' instances and remove such setting from the 'hpt366' driver that
just doesn't use 'sff_dma_ops'. Along with some code save, this prepares us for
the next patch...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoResurrect IT8172 IDE controller driver
Shane McDonald [Tue, 6 Jan 2009 16:21:01 +0000 (17:21 +0100)]
Resurrect IT8172 IDE controller driver

Support for the IT8172 IDE controller was removed from the kernel
sometime after 2.6.18.  Support for the only boards that used the IT8172
was removed from the kernel after 2.6.18, as they had never compiled
since 2.6.0.  However, there are a couple of platforms that use this
chip: the PMC-Sierra Xiao Hu thin-client computer, which is no longer
in production, and the Linksys NSS4000 Network Attached Storage box,
which is based on the Xiao Hu board.  I am attempting to add support
for the Xiao Hu to the kernel, and this IT8172 IDE controller is the
first bit of code in this effort.

This patch resurrects the IT8172 IDE controller code.  I began with
the 2.6.18 version of the it8172.c file, and have moved it forward so
that it works with the latest version of the kernel.  I have run this
driver on a PMC-Sierra Xiao Hu board with the 2.6.28 kernel, and
I have had no problems with it in my configuration.  The attached patch
applies cleanly against 2.6.28.

Signed-off-by: Shane McDonald <mcdonald.shane@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: alan@lxorguk.ukuu.org.uk
[bart: s/HWIF(drive)/drive->hwif/]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agopiix: sync ich_laptop[] with ata_piix.c
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:21:01 +0000 (17:21 +0100)]
piix: sync ich_laptop[] with ata_piix.c

Allows UDMA > 33 on ACER TM290 and ACER Aspire 1694WLMi.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: update warm-plug HOWTO
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:21:00 +0000 (17:21 +0100)]
ide: update warm-plug HOWTO

Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: fix ide_port_scan() to do ACPI setup after initializing request queues
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:21:00 +0000 (17:21 +0100)]
ide: fix ide_port_scan() to do ACPI setup after initializing request queues

This makes ide_port_scan()'s behavior match ide_host_register()'s
one and fixes OOPS in elv_may_queue() during port re-scan.

Reported-and-tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: remove now redundant ->cur_dev checks
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:20:59 +0000 (17:20 +0100)]
ide: remove now redundant ->cur_dev checks

* ->cur_dev should now be always valid if ->handler is set so
  remove redundant checks from ide_intr() and ide_timer_expiry().

* Apply CodingStyle fixups in ide_timer_expiry() while at it.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: remove unused ide_hwif_t.sg_mapped field
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:20:59 +0000 (17:20 +0100)]
ide: remove unused ide_hwif_t.sg_mapped field

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: struct ide_atapi_pc - remove unused fields and update documentation
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:20:59 +0000 (17:20 +0100)]
ide: struct ide_atapi_pc - remove unused fields and update documentation

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: remove superfluous hwif variable assignment from ide_timer_expiry()
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:20:58 +0000 (17:20 +0100)]
ide: remove superfluous hwif variable assignment from ide_timer_expiry()

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: use ide_pci_is_in_compatibility_mode() helper in setup-pci.c
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:20:58 +0000 (17:20 +0100)]
ide: use ide_pci_is_in_compatibility_mode() helper in setup-pci.c

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
17 years agoide: make "paranoia" ->handler check in ide_intr() more strict
Bartlomiej Zolnierkiewicz [Tue, 6 Jan 2009 16:20:58 +0000 (17:20 +0100)]
ide: make "paranoia" ->handler check in ide_intr() more strict

If ->handler is set while it shouldn't be it indicates deep problems
so BUG_ON()-ning and preventing further damage is much more appropriate
than merely printing an error message.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>