1. 17 9月, 2016 11 次提交
    • D
      rxrpc: Fix the parsing of soft-ACKs · d01dc4c3
      David Howells 提交于
      The soft-ACK parser doesn't increment the pointer into the soft-ACK list,
      resulting in the first ACK/NACK value being applied to all the relevant
      packets in the Tx queue.  This has the potential to miss retransmissions
      and cause excessive retransmissions.
      
      Fix this by incrementing the pointer.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      d01dc4c3
    • D
      rxrpc: Fix unexposed client conn release · 78883793
      David Howells 提交于
      If the last call on a client connection is release after the connection has
      had a bunch of calls allocated but before any DATA packets are sent (so
      that it's not yet marked RXRPC_CONN_EXPOSED), an assertion will happen in
      rxrpc_disconnect_client_call().
      
      	af_rxrpc: Assertion failed - 1(0x1) >= 2(0x2) is false
      	------------[ cut here ]------------
      	kernel BUG at ../net/rxrpc/conn_client.c:753!
      
      This is because it's expecting the conn to have been exposed and to have 2
      or more refs - but this isn't necessarily the case.
      
      Simply remove the assertion.  This allows the conn to be moved into the
      inactive state and deleted if it isn't resurrected before the final put is
      called.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      78883793
    • D
      rxrpc: Call rxrpc_release_call() on error in rxrpc_new_client_call() · 357f5ef6
      David Howells 提交于
      Call rxrpc_release_call() on getting an error in rxrpc_new_client_call()
      rather than trying to do the cleanup ourselves.  This isn't a problem,
      provided we set RXRPC_CALL_HAS_USERID only if we actually add the call to
      the calls tree as cleanup code fragments that would otherwise cause
      problems are conditional.
      
      Without this, we miss some of the cleanup.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      357f5ef6
    • D
      rxrpc: Fix the putting of client connections · 66d58af7
      David Howells 提交于
      In rxrpc_put_one_client_conn(), if a connection has RXRPC_CONN_COUNTED set
      on it, then it's accounted for in rxrpc_nr_client_conns and may be on
      various lists - and this is cleaned up correctly.
      
      However, if the connection doesn't have RXRPC_CONN_COUNTED set on it, then
      the put routine returns rather than just skipping the extra bit of cleanup.
      
      Fix this by making the extra bit of clean up conditional instead and always
      killing off the connection.
      
      This manifests itself as connections with a zero usage count hanging around
      in /proc/net/rxrpc_conns because the connection allocated, but discarded,
      due to a race with another process that set up a parallel connection, which
      was then shared instead.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      66d58af7
    • D
      rxrpc: Purge the to_be_accepted queue on socket release · 0360da6d
      David Howells 提交于
      Purge the queue of to_be_accepted calls on socket release.  Note that
      purging sock_calls doesn't release the ref owned by to_be_accepted.
      
      Probably the sock_calls list is redundant given a purges of the recvmsg_q,
      the to_be_accepted queue and the calls tree.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      0360da6d
    • D
      rxrpc: Record calls that need to be accepted · e6f3afb3
      David Howells 提交于
      Record calls that need to be accepted using sk_acceptq_added() otherwise
      the backlog counter goes negative because sk_acceptq_removed() is called.
      This causes the preallocator to malfunction.
      
      Calls that are preaccepted by AFS within the kernel aren't affected by
      this.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      e6f3afb3
    • D
      rxrpc: Fix handling of the last packet in rxrpc_recvmsg_data() · 816c9fce
      David Howells 提交于
      The code for determining the last packet in rxrpc_recvmsg_data() has been
      using the RXRPC_CALL_RX_LAST flag to determine if the rx_top pointer points
      to the last packet or not.  This isn't a good idea, however, as the input
      code may be running simultaneously on another CPU and that sets the flag
      *before* updating the top pointer.
      
      Fix this by the following means:
      
       (1) Restrict the use of RXRPC_CALL_RX_LAST to the input routines only.
           There's otherwise a synchronisation problem between detecting the flag
           and checking tx_top.  This could probably be dealt with by appropriate
           application of memory barriers, but there's a simpler way.
      
       (2) Set RXRPC_CALL_RX_LAST after setting rx_top.
      
       (3) Make rxrpc_rotate_rx_window() consult the flags header field of the
           DATA packet it's about to discard to see if that was the last packet.
           Use this as the basis for ending the Rx phase.  This shouldn't be a
           problem because the recvmsg side of things is guaranteed to see the
           packets in order.
      
       (4) Make rxrpc_recvmsg_data() return 1 to indicate the end of the data if:
      
           (a) the packet it has just processed is marked as RXRPC_LAST_PACKET
      
           (b) the call's Rx phase has been ended.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      816c9fce
    • D
      rxrpc: Check the return value of rxrpc_locate_data() · 2e2ea51d
      David Howells 提交于
      Check the return value of rxrpc_locate_data() in rxrpc_recvmsg_data().
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      2e2ea51d
    • D
      rxrpc: Move the check of rx_pkt_offset from rxrpc_locate_data() to caller · 4b22457c
      David Howells 提交于
      Move the check of rx_pkt_offset from rxrpc_locate_data() to the caller,
      rxrpc_recvmsg_data(), so that it's more clear what's going on there.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      4b22457c
    • D
      rxrpc: Remove some whitespace. · fabf9201
      David Howells 提交于
      Remove a tab that's on a line that should otherwise be blank.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      fabf9201
    • D
      rxrpc: Make IPv6 support conditional on CONFIG_IPV6 · d1912747
      David Howells 提交于
      Add CONFIG_AF_RXRPC_IPV6 and make the IPv6 support code conditional on it.
      This is then made conditional on CONFIG_IPV6.
      
      Without this, the following can be seen:
      
         net/built-in.o: In function `rxrpc_init_peer':
      >> peer_object.c:(.text+0x18c3c8): undefined reference to `ip6_route_output_flags'
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1912747
  2. 16 9月, 2016 9 次提交
  3. 14 9月, 2016 14 次提交
    • D
      rxrpc: Add IPv6 support · 75b54cb5
      David Howells 提交于
      Add IPv6 support to AF_RXRPC.  With this, AF_RXRPC sockets can be created:
      
      	service = socket(AF_RXRPC, SOCK_DGRAM, PF_INET6);
      
      instead of:
      
      	service = socket(AF_RXRPC, SOCK_DGRAM, PF_INET);
      
      The AFS filesystem doesn't support IPv6 at the moment, though, since that
      requires upgrades to some of the RPC calls.
      
      Note that a good portion of this patch is replacing "%pI4:%u" in print
      statements with "%pISpc" which is able to handle both protocols and print
      the port.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      75b54cb5
    • D
      rxrpc: Use rxrpc_extract_addr_from_skb() rather than doing this manually · 1c2bc7b9
      David Howells 提交于
      There are two places that want to transmit a packet in response to one just
      received and manually pick the address to reply to out of the sk_buff.
      Make them use rxrpc_extract_addr_from_skb() instead so that IPv6 is handled
      automatically.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      1c2bc7b9
    • D
      rxrpc: Don't specify protocol to when creating transport socket · aaa31cbc
      David Howells 提交于
      Pass 0 as the protocol argument when creating the transport socket rather
      than IPPROTO_UDP.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      aaa31cbc
    • D
      rxrpc: Create an address for sendmsg() to bind unbound socket with · cd5892c7
      David Howells 提交于
      Create an address for sendmsg() to bind unbound socket with rather than
      using a completely blank address otherwise the transport socket creation
      will fail because it will try to use address family 0.
      
      We use the address family specified in the protocol argument when the
      AF_RXRPC socket was created and SOCK_DGRAM as the default.  For anything
      else, bind() must be used.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cd5892c7
    • D
      rxrpc: Correctly initialise, limit and transmit call->rx_winsize · 75e42126
      David Howells 提交于
      call->rx_winsize should be initialised to the sysctl setting and the sysctl
      setting should be limited to the maximum we want to permit.  Further, we
      need to place this in the ACK info instead of the sysctl setting.
      
      Furthermore, discard the idea of accepting the subpackets of a jumbo packet
      that lie beyond the receive window when the first packet of the jumbo is
      within the window.  Just discard the excess subpackets instead.  This
      allows the receive window to be opened up right to the buffer size less one
      for the dead slot.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      75e42126
    • D
      rxrpc: Fix prealloc refcounting · 3432a757
      David Howells 提交于
      The preallocated call buffer holds a ref on the calls within that buffer.
      The ref was being released in the wrong place - it worked okay for incoming
      calls to the AFS cache manager service, but doesn't work right for incoming
      calls to a userspace service.
      
      Instead of releasing an extra ref service calls in rxrpc_release_call(),
      the ref needs to be released during the acceptance/rejectance process.  To
      this end:
      
       (1) The prealloc ref is now normally released during
           rxrpc_new_incoming_call().
      
       (2) For preallocated kernel API calls, the kernel API's ref needs to be
           released when the call is discarded on socket close.
      
       (3) We shouldn't take a second ref in rxrpc_accept_call().
      
       (4) rxrpc_recvmsg_new_call() needs to get a ref of its own when it adds
           the call to the to_be_accepted socket queue.
      
      In doing (4) above, we would prefer not to put the call's refcount down to
      0 as that entails doing cleanup in softirq context, but it's unlikely as
      there are several refs held elsewhere, at least one of which must be put by
      someone in process context calling rxrpc_release_call().  However, it's not
      a problem if we do have to do that.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      3432a757
    • D
      rxrpc: Adjust the call ref tracepoint to show kernel API refs · cbd00891
      David Howells 提交于
      Adjust the call ref tracepoint to show references held on a call by the
      kernel API separately as much as possible and add an additional trace to at
      the allocation point from the preallocation buffer for an incoming call.
      
      Note that this doesn't show the allocation of a client call for the kernel
      separately at the moment.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cbd00891
    • D
      rxrpc: Allow tx_winsize to grow in response to an ACK · 01fd0742
      David Howells 提交于
      Allow tx_winsize to grow when the ACK info packet shows a larger receive
      window at the other end rather than only permitting it to shrink.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      01fd0742
    • D
      rxrpc: Use skb->len not skb->data_len · 89a80ed4
      David Howells 提交于
      skb->len should be used rather than skb->data_len when referring to the
      amount of data in a packet.  This will only cause a malfunction in the
      following cases:
      
       (1) We receive a jumbo packet (validation and splitting both are wrong).
      
       (2) We see if there's extra ACK info in an ACK packet (we think it's not
           there and just ignore it).
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      89a80ed4
    • D
      rxrpc: Add missing unlock in rxrpc_call_accept() · b25de360
      David Howells 提交于
      Add a missing unlock in rxrpc_call_accept() in the path taken if there's no
      call to wake up.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      b25de360
    • D
      rxrpc: Requeue call for recvmsg if more data · 33b603fd
      David Howells 提交于
      rxrpc_recvmsg() needs to make sure that the call it has just been
      processing gets requeued for further attention if the buffer has been
      filled and there's more data to be consumed.  The softirq producer only
      queues the call and wakes the socket if it fills the first slot in the
      window, so userspace might end up sleeping forever otherwise, despite there
      being data available.
      
      This is not a problem provided the userspace buffer is big enough or it
      empties the buffer completely before more data comes in.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      33b603fd
    • D
      rxrpc: The IDLE ACK packet should use rxrpc_idle_ack_delay · 91c2c7b6
      David Howells 提交于
      The IDLE ACK packet should use the rxrpc_idle_ack_delay setting when the
      timer is set for it.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      91c2c7b6
    • D
      rxrpc: Add missing wakeup on Tx window rotation · bc4abfcf
      David Howells 提交于
      We need to wake up the sender when Tx window rotation due to an incoming
      ACK makes space in the buffer otherwise the sender is liable to just hang
      endlessly.
      
      This problem isn't noticeable if the Tx phase transfers no more than will
      fit in a single window or the Tx window rotates fast enough that it doesn't
      get full.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      bc4abfcf
    • D
      rxrpc: Make sure we initialise the peer hash key · 08a39685
      David Howells 提交于
      Peer records created for incoming connections weren't getting their hash
      key set.  This meant that incoming calls wouldn't see more than one DATA
      packet - which is not a problem for AFS CM calls with small request data
      blobs.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      08a39685
  4. 13 9月, 2016 2 次提交
  5. 11 9月, 2016 4 次提交