kernel/kernel-generic.git
13 years agobatman-adv: request the full table if tt_crc doesn't match
Antonio Quartulli [Thu, 7 Jul 2011 12:24:34 +0000 (14:24 +0200)]
batman-adv: request the full table if tt_crc doesn't match

In case of tt_crc mismatching for a certain orig_node after applying the
changes, the node must request the full table immediately.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: keep global table consistency in case of roaming
Antonio Quartulli [Wed, 6 Jul 2011 23:40:59 +0000 (01:40 +0200)]
batman-adv: keep global table consistency in case of roaming

To keep consistency of other originator tables, new clients detected as
roamed, are kept in the global table but are marked as TT_CLIENT_PENDING
They are purged only when the new ttvn is received by the corresponding
originator. Moreover they need to be considered as removed in case of global
transtable lookup.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: keep local table consistency for further TT_RESPONSE
Antonio Quartulli [Wed, 6 Jul 2011 23:40:58 +0000 (01:40 +0200)]
batman-adv: keep local table consistency for further TT_RESPONSE

To keep transtable consistency among all the nodes, an originator must
not send not yet announced clients within a full table TT_RESPONSE.
Instead, deleted client have to be kept in the table in order to be sent
within an immediate TT_RESPONSE. In this way all the nodes in the
network will always provide the same response for the same request.

All the modification are committed at the next ttvn increment event.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: initialise last_ttvn and tt_crc for the orig_node structure
Antonio Quartulli [Wed, 6 Jul 2011 23:40:57 +0000 (01:40 +0200)]
batman-adv: initialise last_ttvn and tt_crc for the orig_node structure

The last_ttvn and tt_crc fields of the orig_node structure were not
initialised causing an immediate TT_REQ/RES dialogue even if not needed.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: Replace version info instead of appending them
Sven Eckelmann [Tue, 5 Jul 2011 08:42:51 +0000 (10:42 +0200)]
batman-adv: Replace version info instead of appending them

The version number of modules build outside of the tree can get revision
numbers added. This is useful to give hints about the revision of a
distribution package and the used patchset. The prepended source number or
branch name doesn't add any additional information which would help to identify
problems and can therefore be omitted.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: aggregation checks should use the primary_if pointer
Marek Lindner [Sun, 26 Jun 2011 19:15:13 +0000 (21:15 +0200)]
batman-adv: aggregation checks should use the primary_if pointer

The packet aggregation needs to ensure that only compatible packets
are aggregated. Some of the checks are based on the interface number
while assuming that the first interface also is the primary interface
which is not always the case.
This patch addresses the issue by using the primary_if pointer.

Reported-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: broadcast primary OGM on all active hard-interfaces
Marek Lindner [Sun, 26 Jun 2011 13:26:18 +0000 (15:26 +0200)]
batman-adv: broadcast primary OGM on all active hard-interfaces

The primary interface OGM has to be broadcasted on all hard-interfaces
even if the primary interface is not the first interface (if_num = 0).
Therefore the code has to compare the originating interface with the
primary interface instead of checking the if_num.

Reported-by: Linus Luessing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: pass a unique flag arg instead of a sequence of bool ones
Antonio Quartulli [Wed, 29 Jun 2011 23:14:00 +0000 (01:14 +0200)]
batman-adv: pass a unique flag arg instead of a sequence of bool ones

now tt_local_event() takes a flags argument instead of a sequence of
boolean values which would grow up with the time.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: add_bcast_packet_to_list() takes the sending delay as parameter
Antonio Quartulli [Sat, 25 Jun 2011 17:09:12 +0000 (19:09 +0200)]
batman-adv: add_bcast_packet_to_list() takes the sending delay as parameter

In order to make possible to use the broadcast list for delayed sendings
the "delay" parameter is now provided instead of using 1 as hardcoded
value.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: unify flags for tt_change/tt_local_entry/tt_global_entry
Antonio Quartulli [Fri, 17 Jun 2011 14:11:27 +0000 (16:11 +0200)]
batman-adv: unify flags for tt_change/tt_local_entry/tt_global_entry

The tt_local_entry structure now has a 'flags' field. This helps to
unify the flags format to all the client related structures (tt_global_entry
and tt_change). The 'never_purge' field is now encoded in the 'flags' one.
To optimise the usage of this field, its length has been increased to 16bit
in order to use the eight leading bits (from 0 to 7) to store flags that
have to be sent on the wire, while the eight ending ones are used for local
computation only.

Moreover 'enum tt_change_flags' is now called 'enum tt_client_flags' and the
defined values apply to the tt_local_entry, tt_global_entry and the tt_change
'flags' field.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
13 years agobatman-adv: improved gateway tq-based selection
Antonio Quartulli [Tue, 26 Apr 2011 19:31:45 +0000 (21:31 +0200)]
batman-adv: improved gateway tq-based selection

If a client issues a DHCPREQUEST for renewal, the packet is dropped
if the old destination (the old gateway for the client) TQ is smaller
than the current best gateway TQ less GW_THRESHOLD

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: throw uevent in userspace on gateway add/change/del event
Antonio Quartulli [Sun, 12 Jun 2011 09:58:58 +0000 (11:58 +0200)]
batman-adv: throw uevent in userspace on gateway add/change/del event

In case of new default gw, changing the default gw or deleting the default gw a
uevent is triggered with type=gw, action=add/change/del and
data={GW_ORIG_ADDRESS} (if any).

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: gateway election code refactoring
Antonio Quartulli [Tue, 26 Apr 2011 22:22:00 +0000 (00:22 +0200)]
batman-adv: gateway election code refactoring

The gateway election mechanism has been a little revised. Now the
gw_election is trigered by an atomic_t flag (gw_reselect) which is set
to 1 in case of election needed, avoding to set curr_gw to NULL.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: add wrapper function to throw uevent in userspace
Antonio Quartulli [Tue, 26 Apr 2011 16:26:01 +0000 (18:26 +0200)]
batman-adv: add wrapper function to throw uevent in userspace

Using throw_uevent() is now possible to trigger uevent signal that can
be recognised in userspace. Uevents will be triggered through the
/devices/virtual/net/{MESH_IFACE} kobject.

A triggered uevent has three properties:
- type: the event class. Who generates the event (only 'gw' is currently
  defined). Corresponds to the BATTYPE uevent variable.
- action: the associated action with the event ('add'/'change'/'del' are
  currently defined). Corresponds to the BATACTION uevent variable.
- data: any useful data for the userspace. Corresponds to the BATDATA
  uevent variable.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: protect the local and the global trans-tables with rcu
Antonio Quartulli [Wed, 27 Apr 2011 12:28:07 +0000 (14:28 +0200)]
batman-adv: protect the local and the global trans-tables with rcu

The local and the global translation-tables are now lock free and rcu
protected.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: improved roaming mechanism
Antonio Quartulli [Wed, 27 Apr 2011 12:27:57 +0000 (14:27 +0200)]
batman-adv: improved roaming mechanism

With the current client announcement implementation, in case of roaming,
an update is triggered on the new AP serving the client. At that point
the new information is spread around by means of the OGM broadcasting
mechanism. Until this operations is not executed, no node is able to
correctly route traffic towards the client. This obviously causes packet
drops and introduces a delay in the time needed by the client to recover
its connections.

A new packet type called ROAMING_ADVERTISEMENT is added to account this
issue.

This message is sent in case of roaming from the new AP serving the
client to the old one and will contain the client MAC address. In this
way an out-of-OGM update is immediately committed, so that the old node
can update its global translation table. Traffic reaching this node will
then be redirected to the correct destination utilising the fresher
information. Thus reducing the packet drops and the connection recovery
delay.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: improved client announcement mechanism
Antonio Quartulli [Wed, 27 Apr 2011 12:27:44 +0000 (14:27 +0200)]
batman-adv: improved client announcement mechanism

The client announcement mechanism informs every mesh node in the network
of any connected non-mesh client, in order to find the path towards that
client from any given point in the mesh.

The old implementation was based on the simple idea of appending a data
buffer to each OGM containing all the client MAC addresses the node is
serving. All other nodes can populate their global translation tables
(table which links client MAC addresses to node addresses) using this
MAC address buffer and linking it to the node's address contained in the
OGM. A node that wants to contact a client has to lookup the node the
client is connected to and its address in the global translation table.

It is easy to understand that this implementation suffers from several
issues:
 - big overhead (each and every OGM contains the entire list of
   connected clients)
 - high latencies for client route updates due to long OGM trip time and
   OGM losses

The new implementation addresses these issues by appending client
changes (new client joined or a client left) to the OGM instead of
filling it with all the client addresses each time. In this way nodes
can modify their global tables by means of "updates", thus reducing the
overhead within the OGMs.

To keep the entire network in sync each node maintains a translation
table version number (ttvn) and a translation table checksum. These
values are spread with the OGM to allow all the network participants to
determine whether or not they need to update their translation table
information.

When a translation table lookup is performed in order to send a packet
to a client attached to another node, the destination's ttvn is added to
the payload packet. Forwarding nodes can compare the packet's ttvn with
their destination's ttvn (this node could have a fresher information
than the source) and re-route the packet if necessary. This greatly
reduces the packet loss of clients roaming from one AP to the next.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Unify the first 3 bytes in each packet
Antonio Quartulli [Sat, 28 May 2011 12:51:06 +0000 (14:51 +0200)]
batman-adv: Unify the first 3 bytes in each packet

The amount of duplicated code in the receive and routing code can be
reduced when all headers provide the packet type, version and ttl in the
same first bytes.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Reduce usage of char
Sven Eckelmann [Wed, 15 Jun 2011 07:41:37 +0000 (09:41 +0200)]
batman-adv: Reduce usage of char

char was used in different places to store information without really
using the characteristics of that data type or by ignoring the fact that
char has not a well defined signedness.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: count_real_packets() in batman-adv assumes char is signed
David Howells [Wed, 15 Jun 2011 07:41:36 +0000 (09:41 +0200)]
batman-adv: count_real_packets() in batman-adv assumes char is signed

count_real_packets() in batman-adv assumes char is signed, and returns -1
through it:

net/batman-adv/routing.c: In function 'receive_bat_packet':
net/batman-adv/routing.c:739: warning: comparison is always false due to limited range of data type

Use int instead.

Signed-off-by: David Howells <dhowells@redhat.com>
[sven@narfation.org: Rebase on top of current version]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Keep interface_tx as local function
Sven Eckelmann [Wed, 15 Jun 2011 13:17:21 +0000 (15:17 +0200)]
batman-adv: Keep interface_tx as local function

interface_tx is not used outside of soft-interface.c and thus doesn't
need to be declared inside soft-interface.h

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Move compare_orig to originator.c
Sven Eckelmann [Wed, 15 Jun 2011 13:08:59 +0000 (15:08 +0200)]
batman-adv: Move compare_orig to originator.c

compare_orig is only used in context of orig_node which is managed
inside originator.c. It is not necessary to keep that function inside
the header originator.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: use NO_FLAGS define instead of hard-coding 0
Marek Lindner [Thu, 9 Jun 2011 15:13:09 +0000 (17:13 +0200)]
batman-adv: use NO_FLAGS define instead of hard-coding 0

The definition NO_FLAGS was introduced to make the code more
readable and shall be used to initialize flag fields.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Use enums for related constants
Sven Eckelmann [Sat, 4 Jun 2011 09:26:00 +0000 (11:26 +0200)]
batman-adv: Use enums for related constants

CodingStyle "Chapter 12: Macros, Enums and RTL" recommends to use enums
for several related constants. Internal states can be used without
defining the actual value, but all values which are visible to the
outside must be defined as before. Normal values are assigned as usual
and flags are defined by shifts of a bit.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Rewrite debugfs kobj_to_* helpers as functions
Sven Eckelmann [Sun, 5 Jun 2011 08:20:19 +0000 (10:20 +0200)]
batman-adv: Rewrite debugfs kobj_to_* helpers as functions

CodingStyle "Chapter 12: Macros, Enums and RTL" highly recommends to use
functions instead of macros were possible. This ensures type safety and
prevents shadowing of other variables.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Fix signedness problem in parse_gw_bandwidth
Sven Eckelmann [Sat, 4 Jun 2011 12:00:49 +0000 (14:00 +0200)]
batman-adv: Fix signedness problem in parse_gw_bandwidth

strict_strtoul as used in parse_gw_bandwidth is defined for unsigned
long and strict_strtol should be used instead for long.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Don't return value in void function
Sven Eckelmann [Sat, 4 Jun 2011 10:40:37 +0000 (12:40 +0200)]
batman-adv: Don't return value in void function

gw_node_delete is defined with "void" as return type, but still tries to
return a value. The called function gw_node_delete is also return as
void and thus doesn't provide a value for us.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: accept delayed rebroadcasts to avoid bogus routing under heavy load
Daniele Furlan [Mon, 6 Jun 2011 22:45:55 +0000 (00:45 +0200)]
batman-adv: accept delayed rebroadcasts to avoid bogus routing under heavy load

When a link is saturated (re)broadcasts of OGMs are delayed. Under heavy
load this delay may exceed the orig interval which leads to OGMs being
dropped (the code would only accept an OGM rebroadcast if it arrived
before the next OGM was broadcasted). With this patch batman-adv will
also accept delayed OGMs in order to avoid a bogus influence on the
routing metric.

Signed-off-by: Daniele Furlan <daniele.furlan@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Ensure that we really have route changes in update_route
Sven Eckelmann [Tue, 10 May 2011 09:22:37 +0000 (11:22 +0200)]
batman-adv: Ensure that we really have route changes in update_route

The debug output of update_route has tests for "route deleted" and "route
added". All other situations are handled as "route changed". This is not
true because neigh_node and curr_router could be both NULL.

The function is not called in this situation, but the code might be
interpreted wrong when reading it without this test.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: a multiline comment should precede the variable it is describing
Antonio Quartulli [Wed, 18 May 2011 14:47:23 +0000 (16:47 +0200)]
batman-adv: a multiline comment should precede the variable it is describing

This comment has been wrongly put after the variable it refers to and was also bad indented

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Acked-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: use is_broadcast_ether_addr() instead of compare_eth(.., brd_addr)
Antonio Quartulli [Fri, 20 May 2011 23:33:07 +0000 (01:33 +0200)]
batman-adv: use is_broadcast_ether_addr() instead of compare_eth(.., brd_addr)

Instead of comparing mac addresses with the broadcast address by means
of compare_eth(), the is_broadcast_ether_addr() kernel function has to be
used.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Acked-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Check type of x and y in seq_(before|after)
Sven Eckelmann [Thu, 19 May 2011 19:43:08 +0000 (21:43 +0200)]
batman-adv: Check type of x and y in seq_(before|after)

seq_before and seq_after depend on the fact that both sequence numbers
have the same type and thus the same bitwidth. We can ensure that by
compile time checking using a compare between the pointer to the
temporary buffers which were created using the typeof of both
parameters. For example gcc would create a warning like
"warning: comparison of distinct pointer types lacks a cast".

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: move smallest_signed_int(), seq_before() and seq_after() into main.h
Antonio Quartulli [Wed, 18 May 2011 07:20:50 +0000 (09:20 +0200)]
batman-adv: move smallest_signed_int(), seq_before() and seq_after() into main.h

smallest_signed_int(), seq_before() and seq_after() are very useful
functions that help to handle comparisons between sequence numbers.
However they were only defined in vis.c. With this patch every
batman-adv function will be able to use them.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Use rcu_dereference_protected by update-side
Sven Eckelmann [Sat, 14 May 2011 22:50:21 +0000 (00:50 +0200)]
batman-adv: Use rcu_dereference_protected by update-side

Usually rcu_dereference isn't necessary in situations were the
RCU-protected data structure cannot change, but sparse and lockdep still
need a similar functionality for analysis. rcu_dereference_protected
implements the reduced version which should be used to support the
dynamic and static analysis.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Calculate sizeof using variable insead of types
Sven Eckelmann [Sat, 14 May 2011 21:14:54 +0000 (23:14 +0200)]
batman-adv: Calculate sizeof using variable insead of types

Documentation/CodingStyle recommends to use the form

p = kmalloc(sizeof(*p), ...);

to calculate the size of a struct and not the version where the struct
name is spelled out to prevent bugs when the type of p changes. This
also seems appropriate for manipulation of buffers when they are
directly associated with p.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Remove casts from type x to type x
Sven Eckelmann [Sat, 14 May 2011 21:14:53 +0000 (23:14 +0200)]
batman-adv: Remove casts from type x to type x

Casting from pointer like 'struct orig_node*' to 'struct orig_node *'
doesn't provide any additional functionality and can be savely removed.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Remove explicit casts cast from void* for store
Sven Eckelmann [Sat, 14 May 2011 21:14:52 +0000 (23:14 +0200)]
batman-adv: Remove explicit casts cast from void* for store

It is not necessary to cast a void* to the pointer type when we just
store it and don't want to do pointer arithmetic before the actual
assignment.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Only use int up and down gw representation
Sven Eckelmann [Sat, 14 May 2011 21:14:51 +0000 (23:14 +0200)]
batman-adv: Only use int up and down gw representation

It is not save to provide memory for an int and then cast the pointer to
it to long*. It is better to standardize the up and down gateway
bandwith representation to simple ints and only use long inside
conversation routines.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Add const type qualifier for pointers
Sven Eckelmann [Sat, 14 May 2011 21:14:50 +0000 (23:14 +0200)]
batman-adv: Add const type qualifier for pointers

batman-adv uses pointers which are marked as const and should not
violate that type qualifier by passing it to functions which force a
cast to the non-const version.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Don't do pointer arithmetic with void*
Sven Eckelmann [Sat, 14 May 2011 21:14:49 +0000 (23:14 +0200)]
batman-adv: Don't do pointer arithmetic with void*

The size of void is currently set by gcc to 1, but is not well defined
in general. Therefore it is more advisable to cast it to char* before
doing pointer arithmetic.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Remove comparising < 0 for unsigned type
Sven Eckelmann [Sat, 14 May 2011 21:14:48 +0000 (23:14 +0200)]
batman-adv: Remove comparising < 0 for unsigned type

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Print jiffies as unsigned long
Sven Eckelmann [Sat, 14 May 2011 21:14:47 +0000 (23:14 +0200)]
batman-adv: Print jiffies as unsigned long

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Annotate functions with format strings
Sven Eckelmann [Sat, 14 May 2011 21:14:46 +0000 (23:14 +0200)]
batman-adv: Annotate functions with format strings

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: Use kzalloc rather than kmalloc followed by memset with 0
Sven Eckelmann [Tue, 10 May 2011 09:17:40 +0000 (11:17 +0200)]
batman-adv: Use kzalloc rather than kmalloc followed by memset with 0

Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agobatman-adv: move neigh_node->if_incoming->if_status check in find_router()
Antonio Quartulli [Sun, 8 May 2011 18:52:57 +0000 (20:52 +0200)]
batman-adv: move neigh_node->if_incoming->if_status check in find_router()

Every time that find_router() is invoked, if_status has to be compared with
IF_ACTIVE. Moving this comparison inside find_router() will avoid to write it
each time.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
13 years agoLinux 3.0-rc1
Linus Torvalds [Mon, 30 May 2011 00:43:36 +0000 (17:43 -0700)]
Linux 3.0-rc1

.. except there are various scripts that really know that there are
three numbers, so it calls itself "3.0.0-rc1".

Hopefully by the time the final 3.0 is out, we'll have that extra zero
all figured out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs...
Linus Torvalds [Sun, 29 May 2011 21:13:25 +0000 (14:13 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/ecryptfs/ecryptfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6:
  eCryptfs: Remove ecryptfs_header_cache_2
  eCryptfs: Cleanup and optimize ecryptfs_lookup_interpose()
  eCryptfs: Return useful code from contains_ecryptfs_marker
  eCryptfs: Fix new inode race condition
  eCryptfs: Cleanup inode initialization code
  eCryptfs: Consolidate inode functions into inode.c

13 years agoMerge branch 'pnfs-submit' of git://git.open-osd.org/linux-open-osd
Linus Torvalds [Sun, 29 May 2011 21:10:13 +0000 (14:10 -0700)]
Merge branch 'pnfs-submit' of git://git.open-osd.org/linux-open-osd

* 'pnfs-submit' of git://git.open-osd.org/linux-open-osd: (32 commits)
  pnfs-obj: pg_test check for max_io_size
  NFSv4.1: define nfs_generic_pg_test
  NFSv4.1: use pnfs_generic_pg_test directly by layout driver
  NFSv4.1: change pg_test return type to bool
  NFSv4.1: unify pnfs_pageio_init functions
  pnfs-obj: objlayout_encode_layoutcommit implementation
  pnfs: encode_layoutcommit
  pnfs-obj: report errors and .encode_layoutreturn Implementation.
  pnfs: encode_layoutreturn
  pnfs: layoutret_on_setattr
  pnfs: layoutreturn
  pnfs-obj: osd raid engine read/write implementation
  pnfs: support for non-rpc layout drivers
  pnfs-obj: define per-inode private structure
  pnfs: alloc and free layout_hdr layoutdriver methods
  pnfs-obj: objio_osd device information retrieval and caching
  pnfs-obj: decode layout, alloc/free lseg
  pnfs-obj: pnfs_osd XDR client implementation
  pnfs-obj: pnfs_osd XDR definitions
  pnfs-obj: objlayoutdriver module skeleton
  ...

13 years agoarm gpio drivers: make them 'depends on ARM'
Linus Torvalds [Sun, 29 May 2011 21:06:42 +0000 (14:06 -0700)]
arm gpio drivers: make them 'depends on ARM'

We had a few drivers move from arch/arm into drivers/gpio, but they
don't actually compile without the ARM platform headers etc.  As a
result they were messing up allyesconfig on x86.

Make them depend on ARM.

Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoeCryptfs: Remove ecryptfs_header_cache_2
Tyler Hicks [Tue, 24 May 2011 10:11:12 +0000 (05:11 -0500)]
eCryptfs: Remove ecryptfs_header_cache_2

Now that ecryptfs_lookup_interpose() is no longer using
ecryptfs_header_cache_2 to read in metadata, the kmem_cache can be
removed and the ecryptfs_header_cache_1 kmem_cache can be renamed to
ecryptfs_header_cache.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: Cleanup and optimize ecryptfs_lookup_interpose()
Tyler Hicks [Tue, 24 May 2011 09:56:23 +0000 (04:56 -0500)]
eCryptfs: Cleanup and optimize ecryptfs_lookup_interpose()

ecryptfs_lookup_interpose() has turned into spaghetti code over the
years. This is an effort to clean it up.

 - Shorten overly descriptive variable names such as ecryptfs_dentry
 - Simplify gotos and error paths
 - Create helper function for reading plaintext i_size from metadata

It also includes an optimization when reading i_size from the metadata.
A complete page-sized kmem_cache_alloc() was being done to read in 16
bytes of metadata. The buffer for that is now statically declared.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: Return useful code from contains_ecryptfs_marker
Tyler Hicks [Mon, 2 May 2011 05:39:54 +0000 (00:39 -0500)]
eCryptfs: Return useful code from contains_ecryptfs_marker

Instead of having the calling functions translate the true/false return
code to either 0 or -EINVAL, have contains_ecryptfs_marker() return 0 or
-EINVAL so that the calling functions can just reuse the return code.

Also, rename the function to ecryptfs_validate_marker() to avoid callers
mistakenly thinking that it returns true/false codes.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
13 years agoeCryptfs: Fix new inode race condition
Tyler Hicks [Tue, 24 May 2011 08:49:02 +0000 (03:49 -0500)]
eCryptfs: Fix new inode race condition

Only unlock and d_add() new inodes after the plaintext inode size has
been read from the lower filesystem. This fixes a race condition that
was sometimes seen during a multi-job kernel build in an eCryptfs mount.

https://bugzilla.kernel.org/show_bug.cgi?id=36002

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Reported-by: David <david@unsolicited.net>
Tested-by: David <david@unsolicited.net>
13 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platf...
Linus Torvalds [Sun, 29 May 2011 18:44:33 +0000 (11:44 -0700)]
Merge branch 'for_linus' of git://git./linux/kernel/git/mjg59/platform-drivers-x86

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86: (43 commits)
  acer-wmi: support integer return type from WMI methods
  msi-laptop: fix section mismatch in reference from the function load_scm_model_init
  acer-wmi: support to set communication device state by new wmid method
  acer-wmi: allow 64-bits return buffer from WMI methods
  acer-wmi: check the existence of internal 3G device when set capability
  platform/x86:delete two unused variables
  support wlan hotkey on Acer Travelmate 5735Z
  platform-x86: intel_mid_thermal: Fix memory leak
  platform/x86: Fix Makefile for intel_mid_powerbtn
  platform/x86: Simplify intel_mid_powerbtn
  acer-wmi: Delete out-of-date documentation
  acerhdf: Clean up includes
  acerhdf: Drop pointless dependency on THERMAL_HWMON
  acer-wmi: Update MAINTAINERS
  wmi: Orphan ACPI-WMI driver
  tc1100-wmi: Orphan driver
  acer-wmi: does not allow negative number set to initial device state
  platform/oaktrail: ACPI EC Extra driver for Oaktrail
  thinkpad_acpi: Convert printks to pr_<level>
  thinkpad_acpi: Correct !CONFIG_THINKPAD_ACPI_VIDEO warning
  ...

13 years agomm: Fix boot crash in mm_alloc()
Linus Torvalds [Sun, 29 May 2011 18:32:28 +0000 (11:32 -0700)]
mm: Fix boot crash in mm_alloc()

Thomas Gleixner reports that we now have a boot crash triggered by
CONFIG_CPUMASK_OFFSTACK=y:

    BUG: unable to handle kernel NULL pointer dereference at   (null)
    IP: [<c11ae035>] find_next_bit+0x55/0xb0
    Call Trace:
     [<c11addda>] cpumask_any_but+0x2a/0x70
     [<c102396b>] flush_tlb_mm+0x2b/0x80
     [<c1022705>] pud_populate+0x35/0x50
     [<c10227ba>] pgd_alloc+0x9a/0xf0
     [<c103a3fc>] mm_init+0xec/0x120
     [<c103a7a3>] mm_alloc+0x53/0xd0

which was introduced by commit de03c72cfce5 ("mm: convert
mm->cpu_vm_cpumask into cpumask_var_t"), and is due to wrong ordering of
mm_init() vs mm_init_cpumask

Thomas wrote a patch to just fix the ordering of initialization, but I
hate the new double allocation in the fork path, so I ended up instead
doing some more radical surgery to clean it all up.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
Linus Torvalds [Sun, 29 May 2011 18:30:20 +0000 (11:30 -0700)]
Merge branch 'for-linus' of git://git390.marist.edu/linux-2.6

* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
  [S390] mm: fix mmu_gather rework
  [S390] mm: fix storage key handling

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
Linus Torvalds [Sun, 29 May 2011 18:29:28 +0000 (11:29 -0700)]
Merge git://git./linux/kernel/git/cmetcalf/linux-tile

* git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
  arch/tile: more /proc and /sys file support

13 years agoMerge branch 'x86-platform-next' into x86-platform
Matthew Garrett [Sun, 29 May 2011 18:27:13 +0000 (14:27 -0400)]
Merge branch 'x86-platform-next' into x86-platform

13 years agoMerge branch 'for-2.6.40' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Sun, 29 May 2011 18:21:12 +0000 (11:21 -0700)]
Merge branch 'for-2.6.40' of git://linux-nfs.org/~bfields/linux

* 'for-2.6.40' of git://linux-nfs.org/~bfields/linux: (22 commits)
  nfsd: make local functions static
  NFSD: Remove unused variable from nfsd4_decode_bind_conn_to_session()
  NFSD: Check status from nfsd4_map_bcts_dir()
  NFSD: Remove setting unused variable in nfsd_vfs_read()
  nfsd41: error out on repeated RECLAIM_COMPLETE
  nfsd41: compare request's opcnt with session's maxops at nfsd4_sequence
  nfsd v4.1 lOCKT clientid field must be ignored
  nfsd41: add flag checking for create_session
  nfsd41: make sure nfs server process OPEN with EXCLUSIVE4_1 correctly
  nfsd4: fix wrongsec handling for PUTFH + op cases
  nfsd4: make fh_verify responsibility of nfsd_lookup_dentry caller
  nfsd4: introduce OPDESC helper
  nfsd4: allow fh_verify caller to skip pseudoflavor checks
  nfsd: distinguish functions of NFSD_MAY_* flags
  svcrpc: complete svsk processing on cb receive failure
  svcrpc: take advantage of tcp autotuning
  SUNRPC: Don't wait for full record to receive tcp data
  svcrpc: copy cb reply instead of pages
  svcrpc: close connection if client sends short packet
  svcrpc: note network-order types in svc_process_calldir
  ...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
Linus Torvalds [Sun, 29 May 2011 18:20:48 +0000 (11:20 -0700)]
Merge git://git./linux/kernel/git/agk/linux-2.6-dm

* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
  dm kcopyd: return client directly and not through a pointer
  dm kcopyd: reserve fewer pages
  dm io: use fixed initial mempool size
  dm kcopyd: alloc pages from the main page allocator
  dm kcopyd: add gfp parm to alloc_pl
  dm kcopyd: remove superfluous page allocation spinlock
  dm kcopyd: preallocate sub jobs to avoid deadlock
  dm kcopyd: avoid pointless job splitting
  dm mpath: do not fail paths after integrity errors
  dm table: reject devices without request fns
  dm table: allow targets to support discards internally

13 years agoMerge branch 'nfs-for-2.6.40' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
Linus Torvalds [Sun, 29 May 2011 18:20:02 +0000 (11:20 -0700)]
Merge branch 'nfs-for-2.6.40' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'nfs-for-2.6.40' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  SUNRPC: Support for RPC over AF_LOCAL transports
  SUNRPC: Remove obsolete comment
  SUNRPC: Use AF_LOCAL for rpcbind upcalls
  SUNRPC: Clean up use of curly braces in switch cases
  NFS: Revert NFSROOT default mount options
  SUNRPC: Rename xs_encode_tcp_fragment_header()
  nfs,rcu: convert call_rcu(nfs_free_delegation_callback) to kfree_rcu()
  nfs41: Correct offset for LAYOUTCOMMIT
  NFS: nfs_update_inode: print current and new inode size in debug output
  NFSv4.1: Fix the handling of NFS4ERR_SEQ_MISORDERED errors
  NFSv4: Handle expired stateids when the lease is still valid
  SUNRPC: Deal with the lack of a SYN_SENT sk->sk_state_change callback...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
Linus Torvalds [Sun, 29 May 2011 18:19:45 +0000 (11:19 -0700)]
Merge git://git./linux/kernel/git/pkl/squashfs-linus

* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus:
  Squashfs: Fix sanity check patches on big-endian systems

13 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
Linus Torvalds [Sun, 29 May 2011 18:19:16 +0000 (11:19 -0700)]
Merge branch 'release' of git://git./linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  ACPI EC: remove redundant code
  ACPI: Add D3 cold state
  ACPI: processor: fix processor_physically_present in UP kernel
  ACPI: Split out custom_method functionality into an own driver
  ACPI: Cleanup custom_method debug stuff
  ACPI EC: enable MSI workaround for Quanta laptops
  ACPICA: Update to version 20110413
  ACPICA: Execute an orphan _REG method under the EC device
  ACPICA: Move ACPI_NUM_PREDEFINED_REGIONS to a more appropriate place
  ACPICA: Update internal address SpaceID for DataTable regions
  ACPICA: Add more methods eligible for NULL package element removal
  ACPICA: Split all internal Global Lock functions to new file - evglock
  ACPI: EC: add another DMI check for ASUS hardware
  ACPI EC: remove dead code
  ACPICA: Fix code divergence of global lock handling
  ACPICA: Use acpi_os_create_lock interface
  ACPI: osl, add acpi_os_create_lock interface
  ACPI:Fix goto flows in thermal-sys

13 years agoMerge branch 'idle-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb...
Linus Torvalds [Sun, 29 May 2011 18:18:09 +0000 (11:18 -0700)]
Merge branch 'idle-release' of git://git./linux/kernel/git/lenb/linux-idle-2.6

* 'idle-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6:
  x86 idle: deprecate mwait_idle() and "idle=mwait" cmdline param
  x86 idle: deprecate "no-hlt" cmdline param
  x86 idle APM: deprecate CONFIG_APM_CPU_IDLE
  x86 idle floppy: deprecate disable_hlt()
  x86 idle: EXPORT_SYMBOL(default_idle, pm_idle) only when APM demands it
  x86 idle: clarify AMD erratum 400 workaround
  idle governor: Avoid lock acquisition to read pm_qos before entering idle
  cpuidle: menu: fixed wrapping timers at 4.294 seconds

13 years agocifs/ubifs: Fix shrinker API change fallout
Al Viro [Sun, 29 May 2011 12:46:08 +0000 (13:46 +0100)]
cifs/ubifs: Fix shrinker API change fallout

Commit 1495f230fa77 ("vmscan: change shrinker API by passing
shrink_control struct") changed the API of ->shrink(), but missed ubifs
and cifs instances.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agopnfs-obj: pg_test check for max_io_size
Boaz Harrosh [Wed, 25 May 2011 18:25:29 +0000 (21:25 +0300)]
pnfs-obj: pg_test check for max_io_size

Implement pg_test vector to test for max IO sizes. We calculate
a max_io_size member only once, and cache it in lseg so to not
do so on every page insert.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[simplify logic]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoNFSv4.1: define nfs_generic_pg_test
Boaz Harrosh [Sun, 29 May 2011 08:45:39 +0000 (11:45 +0300)]
NFSv4.1: define nfs_generic_pg_test

By default, unless pnfs is used coalesce pages until pg_bsize
(rsize or wsize) is reached.

pnfs layout drivers define their own pg_test methods that use
pnfs_generic_pg_test and need to define their own I/O size
limits (e.g. based on the file stripe size).

[Move a check from nfs_pageio_do_add_request to nfs_generic_pg_test]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoNFSv4.1: use pnfs_generic_pg_test directly by layout driver
Benny Halevy [Wed, 25 May 2011 17:54:40 +0000 (20:54 +0300)]
NFSv4.1: use pnfs_generic_pg_test directly by layout driver

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoNFSv4.1: change pg_test return type to bool
Benny Halevy [Wed, 25 May 2011 18:03:56 +0000 (21:03 +0300)]
NFSv4.1: change pg_test return type to bool

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoNFSv4.1: unify pnfs_pageio_init functions
Benny Halevy [Wed, 25 May 2011 17:25:22 +0000 (20:25 +0300)]
NFSv4.1: unify pnfs_pageio_init functions

Use common code for pnfs_pageio_init_{read,write} and use
a common generic pg_test function.

Note that this function always assumes the the layout driver's
pg_test method is implemented.

[Fix BUG]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: objlayout_encode_layoutcommit implementation
Boaz Harrosh [Sun, 22 May 2011 16:54:13 +0000 (19:54 +0300)]
pnfs-obj: objlayout_encode_layoutcommit implementation

* Define API for io-engines to report delta_space_used in IOs
* Encode the osd-layout specific information of the layoutcommit
  XDR buffer.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: encode_layoutcommit
Benny Halevy [Sun, 22 May 2011 16:53:48 +0000 (19:53 +0300)]
pnfs: encode_layoutcommit

Add a layout driver method to encode the layout type specific
opaque part of layout commit in-line in the xdr stream.

Currently, the pnfs-objects layout driver uses it to encode metadata hints
to the MDS and the blocks layout driver to commit provisionally allocated
extents to the file.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: report errors and .encode_layoutreturn Implementation.
Boaz Harrosh [Thu, 26 May 2011 18:49:46 +0000 (21:49 +0300)]
pnfs-obj: report errors and .encode_layoutreturn Implementation.

An io_state pre-allocates an error information structure for each
possible osd-device that might error during IO. When IO is done if all
was well the io_state is freed. (as today). If the I/O has ended with an
error, the io_state is queued on a per-layout err_list. When eventually
encode_layoutreturn() is called, each error is properly encoded on the
XDR buffer and only then the io_state is removed from err_list and
de-allocated.

It is up to the io_engine to fill in the segment that fault and the type
of osd_error that occurred. By calling objlayout_io_set_result() for
each failing device.

In objio_osd:
* Allocate io-error descriptors space as part of io_state
* Use generic objlayout error reporting at end of io.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: encode_layoutreturn
Andy Adamson [Sun, 22 May 2011 16:53:10 +0000 (19:53 +0300)]
pnfs: encode_layoutreturn

Add a layout driver method to encode the layout type specific
opaque part of layout return in-line in the xdr stream.

Currently the pnfs-objects layout driver uses it to encode i/o error
information on LAYOUTRETURN.

Signed-off-by: Andy Adamson <andros@netapp.com>
[fixup layout header pointer for encode_layoutreturn]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: layoutret_on_setattr
Benny Halevy [Wed, 14 Jul 2010 19:43:57 +0000 (15:43 -0400)]
pnfs: layoutret_on_setattr

With the objects layout security model, we have object capabilities
that are associated with the layout and we anticipate that the server
will issue a cb_layoutrecall for any setattr that changes security
related attributes (user/group/mode/acl) or truncates the file.

Therefore, the layout is returned before issuing the setattr to avoid
the anticipated cb_layoutrecall.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: layoutreturn
Benny Halevy [Sun, 22 May 2011 16:52:37 +0000 (19:52 +0300)]
pnfs: layoutreturn

NFSv4.1 LAYOUTRETURN implementation

Currently, does not support layout-type payload encoding.

Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Dean Hildebrand <dhildeb@us.ibm.com>
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>
[call pnfs_return_layout right before pnfs_destroy_layout]
[remove assert_spin_locked from pnfs_clear_lseg_list]
[remove wait parameter from the layoutreturn path.]
[remove return_type field from nfs4_layoutreturn_args]
[remove range from nfs4_layoutreturn_args]
[no need to send layoutcommit from _pnfs_return_layout]
[don't wait on sync layoutreturn]
[fix layout stateid in layoutreturn args]
[fixed NULL deref in _pnfs_return_layout]
[removed recaim member of nfs4_layoutreturn_args]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: osd raid engine read/write implementation
Boaz Harrosh [Sun, 22 May 2011 16:52:19 +0000 (19:52 +0300)]
pnfs-obj: osd raid engine read/write implementation

With the use of the in-kernel osd library. Implement read/write
of data from/to osd-objects according to information specified
in the objects-layout.

Support for stripping over mirrors with a received stripe_unit.
There are however a few constrains which are not supported:
 1. Stripe Unit must be a multiple of PAGE_SIZE
 2. stripe length (stripe_unit * number_of_stripes) can not be
    bigger then 32bit.

Also support raid-groups and partial-layout. Partial-layout is
when not all the groups are received on the line, addressing
only a partial range of the file.

TODO:
  Only raid0! raid 4/5/6 support will come at later stage

A none supported layout will send IO through the MDS

[Important fallout from the last rebase]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[gfp_flags]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: support for non-rpc layout drivers
Benny Halevy [Sun, 22 May 2011 16:52:03 +0000 (19:52 +0300)]
pnfs: support for non-rpc layout drivers

Non-rpc layout driver such as for objects and blocks
implement their own I/O path and error handling logic.
Therefore bypass NFS-based error handling for these layout drivers.

[fix lseg ref-count bugs, and null de-refs]
[Fall out from: non-rpc layout drivers]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[get rid of PNFS_USE_RPC_CODE]
[get rid of __nfs4_write_done_cb]
[revert useless change in nfs4_write_done_cb]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: define per-inode private structure
Benny Halevy [Sun, 22 May 2011 16:51:48 +0000 (19:51 +0300)]
pnfs-obj: define per-inode private structure

allocate and deallocate per-inode private pnfs_layout_hdr
in preparation for I/O implementation.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: alloc and free layout_hdr layoutdriver methods
Benny Halevy [Sun, 22 May 2011 16:51:33 +0000 (19:51 +0300)]
pnfs: alloc and free layout_hdr layoutdriver methods

[gfp_flags]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: objio_osd device information retrieval and caching
Boaz Harrosh [Thu, 26 May 2011 18:45:34 +0000 (21:45 +0300)]
pnfs-obj: objio_osd device information retrieval and caching

When a new layout is received in objio_alloc_lseg all device_ids
referenced are retrieved. The device information is queried for from MDS
and then the osd_device is looked-up from the osd-initiator library. The
devices are cached in a per-mount-point list, for later use. At unmount
all devices are "put" back to the library.

objlayout_get_deviceinfo(), objlayout_put_deviceinfo() middleware
API for retrieving device information given a device_id.

TODO: The device cache can get big. Cap its size. Keep an LRU and start
      to return devices which were not used, when list gets to big, or
      when new entries allocation fail.

[pnfs-obj: Bugs in new global-device-cache code]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[gfp_flags]
[use global device cache]
[use layout driver in global device cache]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: decode layout, alloc/free lseg
Boaz Harrosh [Sun, 22 May 2011 16:50:20 +0000 (19:50 +0300)]
pnfs-obj: decode layout, alloc/free lseg

objlayout_alloc_lseg prepares an xdr_stream and calls the
raid engins objio_alloc_lseg() to allocate a private
pnfs_layout_segment.

objio_osd.c::objio_alloc_lseg() uses passed xdr_stream to
decode and store the layout_segment information in an
objio_segment struct, using the pnfs_osd_xdr.h API for
the actual parsing the layout xdr.

objlayout_free_lseg calls objio_free_lseg() to free the
allocated space.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[gfp_flags]
[removed "extern" from function definitions]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: pnfs_osd XDR client implementation
Boaz Harrosh [Sun, 22 May 2011 16:49:57 +0000 (19:49 +0300)]
pnfs-obj: pnfs_osd XDR client implementation

* Add the fs/nfs/objlayout/pnfs_osd_xdr_cli.c file, which will
  include the XDR encode/decode implementations for the pNFS
  client objlayout driver.

[Wrong type in comments]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: pnfs_osd XDR definitions
Benny Halevy [Sun, 22 May 2011 16:49:32 +0000 (19:49 +0300)]
pnfs-obj: pnfs_osd XDR definitions

* Add the pnfs_osd_xdr.h header

* defintions the pnfs_osd_layout structure including all it's
  sub-types and constants.
* Declare the pnfs_osd_xdr_decode_layout API + all needed
  inline helpers.

* Define the pnfs_osd_deviceaddr structure and all its subtypes and
  constants.
* Declare API for decoding of a pnfs_osd_deviceaddr from XDR stream.

* Define the pnfs_osd_ioerr structure, its substructures and constants.
* Declare API for encoding of a pnfs_osd_ioerr into XDR stream.

* Define the pnfs_osd_layoutupdate structure and its substructures.
* Declare API for encoding of a pnfs_osd_layoutupdate into XDR stream.

[Remove server definitions]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs-obj: objlayoutdriver module skeleton
Benny Halevy [Sun, 22 May 2011 16:49:06 +0000 (19:49 +0300)]
pnfs-obj: objlayoutdriver module skeleton

* Define the PNFS_OBJLAYOUT Kconfig option in the nfs
  master Kconfig file.
* Add the objlayout driver to the Kernel's Kbuild system.
* Add the fs/nfs/objlayout/Kbuild file for building the
  objlayoutdriver.ko driver
* Define fs/nfs/objlayout/objio_osd.c, register the driver on module
  initialization and unregister on exit.

[pnfs-obj: remove of CONFIG_PNFS fallout]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[added "unsure" clause]
[depend on NFS_V4_1]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: client stats
J. Bruce Fields [Sun, 22 May 2011 16:48:21 +0000 (19:48 +0300)]
pnfs: client stats

A pNFS client auto-negotiates a lot of features (minorversion level,
pNFS layout type, etc.).  This is convenient, but makes certain kinds of
failures hard for a user to detect.

For example, if the client falls back on 4.0, or falls back to MDS IO
because the user didn't connect to the right iscsi disks before
mounting, the only symptoms may be reduced performance, which may not be
noticed till long after the actual failure, and may be difficult for a
user to diagnose.

However, such "failures" may also be perfectly normal in some cases, so
we don't want to spam the system logs with them.

One approach would be to put some more information into
/proc/self/mountstats.

Signed-off-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[pnfs: add commit client stats]
[fixup data types for "ret" variables in pnfs_try_to* inline funcs.]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[fix definition of show_pnfs for !CONFIG_PNFS]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: Fix show_sessions in the not CONFIG_NFS_V4_1 case]
    There is a build error when CONFIG_NFS_V4 is set but
    CONFIG_NFS_V4_1 is *not* set. show_sessions() prototype
    was unbalanced between the two cases.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[pnfs: super.c remove CONFIG_PNFS]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: Use byte-range for cb_layoutrecall
Benny Halevy [Sun, 22 May 2011 16:48:02 +0000 (19:48 +0300)]
pnfs: Use byte-range for cb_layoutrecall

Use recalled range to invalidate particular layout segments in the layout cache.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: align layoutget requests on page boundaries
Benny Halevy [Sun, 22 May 2011 16:47:46 +0000 (19:47 +0300)]
pnfs: align layoutget requests on page boundaries

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: Use byte-range for layoutget
Benny Halevy [Sun, 22 May 2011 16:47:26 +0000 (19:47 +0300)]
pnfs: Use byte-range for layoutget

Add offset and count parameters to pnfs_update_layout and use them to get
the layout in the pageio path.

Order cache layout segments in the following order:
* offset (ascending)
* length (descending)
* iomode (RW before READ)

Test byte range against the layout segment in use in pnfs_{read,write}_pg_test
so not to coalesce pages not using the same layout segment.

[fix lseg ordering]
[clean up pnfs_find_lseg lseg arg]
[remove unnecessary FIXME]
[fix ordering in pnfs_insert_layout]
[clean up pnfs_insert_layout]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoSUNRPC: introduce xdr_init_decode_pages
Benny Halevy [Thu, 19 May 2011 18:16:47 +0000 (14:16 -0400)]
SUNRPC: introduce xdr_init_decode_pages

Initialize xdr_stream and xdr_buf using an array of page pointers
and length of buffer.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoNFSv4.1: use layout driver in global device cache
Benny Halevy [Tue, 24 May 2011 15:04:02 +0000 (18:04 +0300)]
NFSv4.1: use layout driver in global device cache

pnfs deviceids are unique per server, per layout type.
struct nfs_client is currently used to distinguish deviceids from
different nfs servers, yet these may clash between different layout
types on the same server.  Therefore, use the layout driver associated
with each deviceid at insertion time to look it up, unhash, or
delete it.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agopnfs: CB_NOTIFY_DEVICEID
Marc Eshel [Sun, 22 May 2011 16:47:09 +0000 (19:47 +0300)]
pnfs: CB_NOTIFY_DEVICEID

Note: This functionlaity is incomplete as all layout segments referring to
the 'to be removed device id' need to be reaped, and all in flight I/O drained.

[use be32 res in nfs4_callback_devicenotify]
[use nfs_client to qualify deviceid for cb_notify_deviceid]
[use global deviceid cache for CB_NOTIFY_DEVICEID]
[refactor device cache _lookup_deviceid]
[refactor device cache _find_get_deviceid]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[Bug in new global-device-cache code]
[layout_driver MUST set free_deviceid_node if using dev-cache]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoeCryptfs: Cleanup inode initialization code
Tyler Hicks [Tue, 24 May 2011 07:16:51 +0000 (02:16 -0500)]
eCryptfs: Cleanup inode initialization code

The eCryptfs inode get, initialization, and dentry interposition code
has two separate paths. One is for when dentry interposition is needed
after doing things like a mkdir in the lower filesystem and the other
is needed after a lookup. Unlocking new inodes and doing a d_add() needs
to happen at different times, depending on which type of dentry
interposing is being done.

This patch cleans up the inode get and initialization code paths and
splits them up so that the locking and d_add() differences mentioned
above can be handled appropriately in a later patch.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Tested-by: David <david@unsolicited.net>
13 years agoNFSv4.1: purge deviceid cache on nfs_free_client
Benny Halevy [Fri, 20 May 2011 11:47:33 +0000 (13:47 +0200)]
NFSv4.1: purge deviceid cache on nfs_free_client

Use the pnfs_layoutdriver_type both as a qualifier for the deviceid,
distinguishing deviceid from different layout types on the server,
and for freeing the layout-driver allocated structure containing the
nfs4_deviceid_node.

[BUG in _deviceid_purge_client]
[layout_driver MUST set free_deviceid_node if using dev-cache]
[let ver < 4.1 compile]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[removed EXPORT_SYMBOL_GPL(nfs4_deviceid_purge_client)]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
13 years agoeCryptfs: Consolidate inode functions into inode.c
Tyler Hicks [Tue, 24 May 2011 02:18:20 +0000 (21:18 -0500)]
eCryptfs: Consolidate inode functions into inode.c

These functions should live in inode.c since their focus is on inodes
and they're primarily used by functions in inode.c.

Also does a simple cleanup of ecryptfs_inode_test() and rolls
ecryptfs_init_inode() into ecryptfs_inode_set().

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Tested-by: David <david@unsolicited.net>
13 years agomm, rmap: Add yet more comments to page_get_anon_vma/page_lock_anon_vma
Peter Zijlstra [Sun, 29 May 2011 08:33:44 +0000 (10:33 +0200)]
mm, rmap: Add yet more comments to page_get_anon_vma/page_lock_anon_vma

Inspired by an analysis from Hugh on why again all this doesn't explode
in our face.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodm kcopyd: return client directly and not through a pointer
Mikulas Patocka [Sun, 29 May 2011 12:03:13 +0000 (13:03 +0100)]
dm kcopyd: return client directly and not through a pointer

Return client directly from dm_kcopyd_client_create, not through a
parameter, making it consistent with dm_io_client_create.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm kcopyd: reserve fewer pages
Mikulas Patocka [Sun, 29 May 2011 12:03:11 +0000 (13:03 +0100)]
dm kcopyd: reserve fewer pages

Reserve just the minimum of pages needed to process one job.

Because we allocate pages from page allocator, we don't need to reserve
a large number of pages.  The maximum job size is SUB_JOB_SIZE and we
calculate the number of reserved pages based on this.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm io: use fixed initial mempool size
Mikulas Patocka [Sun, 29 May 2011 12:03:09 +0000 (13:03 +0100)]
dm io: use fixed initial mempool size

Replace the arbitrary calculation of an initial io struct mempool size
with a constant.

The code calculated the number of reserved structures based on the request
size and used a "magic" multiplication constant of 4.  This patch changes
it to reserve a fixed number - itself still chosen quite arbitrarily.
Further testing might show if there is a better number to choose.

Note that if there is no memory pressure, we can still allocate an
arbitrary number of "struct io" structures.  One structure is enough to
process the whole request.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm kcopyd: alloc pages from the main page allocator
Mikulas Patocka [Sun, 29 May 2011 12:03:07 +0000 (13:03 +0100)]
dm kcopyd: alloc pages from the main page allocator

This patch changes dm-kcopyd so that it allocates pages from the main
page allocator with __GFP_NOWARN | __GFP_NORETRY flags (so that it can
fail in case of memory pressure). If the allocation fails, dm-kcopyd
allocates pages from its own reserve.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>