13 May, 2010

15 commits


21 Apr, 2010

1 commit

  • Define a new function to return the waitqueue of a "struct sock".

    static inline wait_queue_head_t *sk_sleep(struct sock *sk)
    {
    return sk->sk_sleep;
    }

    Change all read occurrences of sk_sleep by a call to this function.

    Needed for a future RCU conversion. sk_sleep wont be a field directly
    available.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

12 Apr, 2010

1 commit


07 Apr, 2010

1 commit

  • This patch makes it explicit in the API that all fields in subscriptions and events exchanged with the Topology Server must be in
    network byte order.
    It also ensures that all fields of a subscription are compared when cancelling a subscription, in order to avoid inadvertent
    cancelling of the wrong subscription.
    Finally, the tipc module version is updated to 2.0.0, to reflect the API change.

    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller

    Jon Paul Maloy
     

31 Mar, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

25 Mar, 2010

1 commit


17 Mar, 2010

3 commits

  • Forward port commit
    fc477e160af086f6e30c3d4fdf5f5c000d29beb5
    from git://tipc.cslab.ericsson.net/pub/git/people/allan/tipc.git

    Origional commit message:

    Allow retransmission of cloned buffers

    This patch fixes an issue with TIPC's message retransmission logic
    that prevented retransmission of clone sk_buffs. Originally intended
    as a means of avoiding wasted work in retransmitting messages that
    were still on the driver's outbound queue, it also prevented TIPC
    from retransmitting messages through other means -- such as the
    secondary bearer of the broadcast link, or another interface in a
    set of bonded interfaces. This fix removes existing checks for
    cloned sk_buffs that prevented such retransmission.

    Origionally-Signed-off-by: Allan Stephens
    Signed-off-by: Neil Horman
    Signed-off-by: David S. Miller

    Neil Horman
     
  • Forward port commit 29eb572941501c40ac6e62dbc5043bf9ee76ee56
    from git://tipc.cslab.ericsson.net/pub/git/people/allan/tipc.git

    Origional commit message:
    Increase frequency of load distribution over broadcast link

    This patch enhances the behavior of TIPC's broadcast link so that it
    alternates between redundant bearers (if available) after every
    message sent, rather than after every 10 messages. This change helps
    to speed up delivery of retransmitted messages by ensuring that
    they are not sent repeatedly over a bearer that is no longer working,
    but not yet recognized as failed.

    Tested by myself in the latest net-2.6 tree using the tipc sanity test suite

    Origionally-signed-off-by: Allan Stephens
    Signed-off-by: Neil Horman

    bcast.c | 35 ++++++++++++++---------------------
    1 file changed, 14 insertions(+), 21 deletions(-)
    Signed-off-by: David S. Miller

    Neil Horman
     
  • So in the forward porting of various tipc packages, I was constantly
    getting this lockdep warning everytime I used tipc-config to set a network
    address for the protocol:

    [ INFO: possible circular locking dependency detected ]
    2.6.33 #1
    tipc-config/1326 is trying to acquire lock:
    (ref_table_lock){+.-...}, at: [] tipc_ref_discard+0x53/0xd4 [tipc]

    but task is already holding lock:
    (&(&entry->lock)->rlock#2){+.-...}, at: [] tipc_ref_lock+0x43/0x63 [tipc]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&(&entry->lock)->rlock#2){+.-...}:
    [] __lock_acquire+0xb67/0xd0f
    [] lock_acquire+0xdc/0x102
    [] _raw_spin_lock_bh+0x3b/0x6e
    [] tipc_ref_acquire+0xe8/0x11b [tipc]
    [] tipc_createport_raw+0x78/0x1b9 [tipc]
    [] tipc_createport+0x8b/0x125 [tipc]
    [] tipc_subscr_start+0xce/0x126 [tipc]
    [] process_signal_queue+0x47/0x7d [tipc]
    [] tasklet_action+0x8c/0xf4
    [] __do_softirq+0xf8/0x1cd
    [] call_softirq+0x1c/0x30
    [] _local_bh_enable_ip+0xb8/0xd7
    [] local_bh_enable_ip+0xe/0x10
    [] _raw_spin_unlock_bh+0x34/0x39
    [] spin_unlock_bh.clone.0+0x15/0x17 [tipc]
    [] tipc_k_signal+0x8d/0xb1 [tipc]
    [] tipc_core_start+0x8a/0xad [tipc]
    [] 0xffffffffa01b1087
    [] do_one_initcall+0x72/0x18a
    [] sys_init_module+0xd8/0x23a
    [] system_call_fastpath+0x16/0x1b

    -> #0 (ref_table_lock){+.-...}:
    [] __lock_acquire+0xa11/0xd0f
    [] lock_acquire+0xdc/0x102
    [] _raw_write_lock_bh+0x3b/0x6e
    [] tipc_ref_discard+0x53/0xd4 [tipc]
    [] tipc_deleteport+0x40/0x119 [tipc]
    [] release+0xeb/0x137 [tipc]
    [] sock_release+0x1f/0x6f
    [] sock_close+0x27/0x2b
    [] __fput+0x12a/0x1df
    [] fput+0x1a/0x1c
    [] filp_close+0x68/0x72
    [] sys_close+0xad/0xe7
    [] system_call_fastpath+0x16/0x1b

    Finally decided I should fix this. Its a straightforward inversion,
    tipc_ref_acquire takes two locks in this order:
    ref_table_lock
    entry->lock

    while tipc_deleteport takes them in this order:
    entry->lock (via tipc_port_lock())
    ref_table_lock (via tipc_ref_discard())

    when the same entry is referenced, we get the above warning. The fix is equally
    straightforward. Theres no real relation between the entry->lock and the
    ref_table_lock (they just are needed at the same time), so move the entry->lock
    aquisition in tipc_ref_acquire down, after we unlock ref_table_lock (this is
    safe since the ref_table_lock guards changes to the reference table, and we've
    already claimed a slot there. I've tested the below fix and confirmed that it
    clears up the lockdep issue

    Signed-off-by: Neil Horman
    CC: Allan Stephens
    Signed-off-by: David S. Miller

    Neil Horman
     

09 Mar, 2010

2 commits

  • Port commit 20deb48d16fdd07ce2fdc8d03ea317362217e085
    from git://tipc.cslab.ericsson.net/pub/git/people/allan/tipc.git

    Part of the large effort I'm trying to help with getting all the downstreamed
    code from windriver forward ported to the upstream tree

    Origional commit message
    Restore check to filter out inadverdently received messages
    This patch reimplements a check that allows TIPC to discard messages
    that are not intended for it. This check was present in TIPC 1.5/1.6,
    but was removed by accident during the development of TIPC 1.7; it has
    now been updated to account for new features present in TIPC 1.7 and
    reinserted into TIPC. The main benefit of this check is to filter
    out messages arriving from orphaned link endpoints, which can arise
    when a node exits the network and then re-enters it with a different
    TIPC network address (i.e. value).

    Signed-off-by: Neil Horman
    Origionally-authored-by: Allan Stephens
    Signed-off-by: David S. Miller

    Neil Horman
     
  • Remove htohl implementation from tipc

    I was working on forward porting the downstream commits for TIPC and ran accross this one:
    http://tipc.cslab.ericsson.net/cgi-bin/gitweb.cgi?p=people/allan/tipc.git;a=commitdiff;h=894279b9437b63cbb02405ad5b8e033b51e4e31e

    I was going to just take it, when I looked closer and noted what it was doing.
    This is basically a routine to byte swap fields of data in sent/received packets
    for tipc, dependent upon the receivers guessed endianness of the peer when a
    connection is established. Asside from just seeming silly to me, it appears to
    violate the latest RFC draft for tipc:
    http://tipc.sourceforge.net/doc/draft-spec-tipc-02.txt
    Which, according to section 4.2 and 4.3.3, requires that all fields of all
    commands be sent in network byte order. So instead of just taking this patch,
    instead I'm removing the htohl function and replacing the calls with calls to
    ntohl in the rx path and htonl in the send path.

    As part of this fix, I'm also changing the subscr_cancel function, which
    searches the list of subscribers, using a memcmp of the entire subscriber list,
    for the entry to tear down. unfortunately it memcmps the entire tipc_subscr
    structure which has several bits that are private to the local side, so nothing
    will ever match. section 5.2 of the draft spec indicates the
    tuple should uniquely identify a subscriber, so convert subscr_cancel to just
    match on those fields (properly endian swapped).

    I've tested this using the tipc test suite, and its passed without issue.

    Signed-off-by: Neil Horman
    Signed-off-by: David S. Miller

    Neil Horman
     

06 Mar, 2010

2 commits


04 Mar, 2010

1 commit

  • Fix TIPC to disallow sending to remote addresses prior to entering NET_MODE

    user programs can oops the kernel by sending datagrams via AF_TIPC prior to
    entering networked mode. The following backtrace has been observed:

    ID: 13459 TASK: ffff810014640040 CPU: 0 COMMAND: "tipc-client"
    [exception RIP: tipc_node_select_next_hop+90]
    RIP: ffffffff8869d3c3 RSP: ffff81002d9a5ab8 RFLAGS: 00010202
    RAX: 0000000000000001 RBX: 0000000000000001 RCX: 0000000000000001
    RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000001001001
    RBP: 0000000001001001 R8: 0074736575716552 R9: 0000000000000000
    R10: ffff81003fbd0680 R11: 00000000000000c8 R12: 0000000000000008
    R13: 0000000000000001 R14: 0000000000000001 R15: ffff810015c6ca00
    ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
    RIP: 0000003cbd8d49a3 RSP: 00007fffc84e0be8 RFLAGS: 00010206
    RAX: 000000000000002c RBX: ffffffff8005d116 RCX: 0000000000000000
    RDX: 0000000000000008 RSI: 00007fffc84e0c00 RDI: 0000000000000003
    RBP: 0000000000000000 R8: 00007fffc84e0c10 R9: 0000000000000010
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 00007fffc84e0d10 R14: 0000000000000000 R15: 00007fffc84e0c30
    ORIG_RAX: 000000000000002c CS: 0033 SS: 002b

    What happens is that, when the tipc module in inserted it enters a standalone
    node mode in which communication to its own address is allowed but not
    to other addresses, since the appropriate data structures have not been
    allocated yet (specifically the tipc_net pointer). There is nothing stopping a
    client from trying to send such a message however, and if that happens, we
    attempt to dereference tipc_net.zones while the pointer is still NULL, and
    explode. The fix is pretty straightforward. Since these oopses all arise from
    the dereference of global pointers prior to their assignment to allocated
    values, and since these allocations are small (about 2k total), lets convert
    these pointers to static arrays of the appropriate size. All the accesses to
    these bits consider 0/NULL to be a non match when searching, so all the lookups
    still work properly, and there is no longer a chance of a bad dererence
    anywhere. As a bonus, this lets us eliminate the setup/teardown routines for
    those pointers, and elimnates the need to preform any locking around them to
    prevent access while their being allocated/freed.

    I've updated the tipc_net structure to behave this way to fix the exact reported
    problem, and also fixed up the tipc_bearers and media_list arrays to fix an
    obvious simmilar problem that arises from issuing tipc-config commands to
    manipulate bearers/links prior to entering networked mode

    I've tested this for a few hours by running the sanity tests and stress test
    with the tipcutils suite, and nothing has fallen over. There have been a few
    lockdep warnings, but those were there before, and can be addressed later, as
    they didn't actually result in any deadlock.

    Signed-off-by: Neil Horman
    CC: Allan Stephens
    CC: David S. Miller
    CC: tipc-discussion@lists.sourceforge.net

    bearer.c | 37 ++++++-------------------------------
    bearer.h | 2 +-
    net.c | 25 ++++---------------------
    3 files changed, 11 insertions(+), 53 deletions(-)
    Signed-off-by: David S. Miller

    Neil Horman
     

20 Jan, 2010

1 commit

  • This patch addresses a number of minor (mostly cosmetic) issues relating
    to the configuration of TIPC, including the following:

    - Corrects range limits for maximum number of ports per node
    - Adds missing range limits for size of log buffer
    - Removes configuration setting relating to unsupported slave node capability
    - Standardizes description and help text wording for configuration settings
    - Removes unneeded blank spaces

    Signed-off-by: Allan Stephens
    Signed-off-by: David S. Miller

    Allan Stephens
     

04 Jan, 2010

1 commit

  • We can rely on kconfig to limit these numbers,
    no need to limit them at compile time/run time.

    Users who modify these numbers manually should
    be responsible for themself. :)

    Signed-off-by: WANG Cong
    Cc: Per Liden
    Cc: Jon Maloy
    Cc: Allan Stephens
    Cc: David S. Miller
    Signed-off-by: David S. Miller

    Amerigo Wang
     

30 Nov, 2009

1 commit


26 Nov, 2009

1 commit

  • Generated with the following semantic patch

    @@
    struct net *n1;
    struct net *n2;
    @@
    - n1 == n2
    + net_eq(n1, n2)

    @@
    struct net *n1;
    struct net *n2;
    @@
    - n1 != n2
    + !net_eq(n1, n2)

    applied over {include,net,drivers/net}.

    Signed-off-by: Octavian Purdila
    Signed-off-by: David S. Miller

    Octavian Purdila
     

06 Nov, 2009

1 commit

  • The generic __sock_create function has a kern argument which allows the
    security system to make decisions based on if a socket is being created by
    the kernel or by userspace. This patch passes that flag to the
    net_proto_family specific create function, so it can do the same thing.

    Signed-off-by: Eric Paris
    Acked-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Eric Paris
     

01 Oct, 2009

1 commit

  • This provides safety against negative optlen at the type
    level instead of depending upon (sometimes non-trivial)
    checks against this sprinkled all over the the place, in
    each and every implementation.

    Based upon work done by Arjan van de Ven and feedback
    from Linus Torvalds.

    Signed-off-by: David S. Miller

    David S. Miller
     

29 Aug, 2009

1 commit


13 Jul, 2009

1 commit

  • This makes generic netlink network namespace aware. No
    generic netlink families except for the controller family
    are made namespace aware, they need to be checked one by
    one and then set the family->netnsok member to true.

    A new function genlmsg_multicast_netns() is introduced to
    allow sending a multicast message in a given namespace,
    for example when it applies to an object that lives in
    that namespace, a new function genlmsg_multicast_allns()
    to send a message to all network namespaces (for objects
    that do not have an associated netns).

    The function genlmsg_multicast() is changed to multicast
    the message in just init_net, which is currently correct
    for all generic netlink families since they only work in
    init_net right now. Some will later want to work in all
    net namespaces because they do not care about the netns
    at all -- those will have to be converted to use one of
    the new functions genlmsg_multicast_allns() or
    genlmsg_multicast_netns() whenever they are made netns
    aware in some way.

    After this patch families can easily decide whether or
    not they should be available in all net namespaces. Many
    genl families us it for objects not related to networking
    and should therefore be available in all namespaces, but
    that will have to be done on a per family basis.

    Note that this doesn't touch on the checkpoint/restart
    problem where network namespaces could be used, genl
    families and multicast groups are numbered globally and
    I see no easy way of changing that, especially since it
    must be possible to multicast to all network namespaces
    for those families that do not care about netns.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

06 Jul, 2009

1 commit


22 May, 2009

1 commit


18 May, 2009

1 commit