20 Aug, 2011

1 commit

  • Use NUMA aware allocations to reduce latencies and increase throughput.

    sunrpc kthreads can use kthread_create_on_node() if pool_mode is
    "percpu" or "pernode", and svc_prepare_thread()/svc_init_buffer() can
    also take into account NUMA node affinity for memory allocations.

    Signed-off-by: Eric Dumazet
    CC: "J. Bruce Fields"
    CC: Neil Brown
    CC: David Miller
    Reviewed-by: Greg Banks
    [bfields@redhat.com: fix up caller nfs41_callback_up]
    Signed-off-by: J. Bruce Fields

    Eric Dumazet
     

26 Jan, 2011

1 commit

  • The information required to find the nfs_client cooresponding to the incoming
    back channel request is contained in the NFS layer. Perform minimal checking
    in the RPC layer pg_authenticate method, and push more detailed checking into
    the NFS layer where the nfs_client can be found.

    Signed-off-by: Andy Adamson
    Signed-off-by: Trond Myklebust

    Andy Adamson
     

07 Jan, 2011

5 commits

  • Differentiate from server backchannel

    Signed-off-by: Andy Adamson
    Acked-by: Bruce Fields
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • Signed-off-by: Andy Adamson
    Acked-by: Bruce Fields
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • Fixes a bug where the nfs_client could be freed during callback processing.
    Refactor nfs_find_client to use minorversion specific means to locate the
    correct nfs_client structure.

    In the NFS layer, V4.0 clients are found using the callback_ident field in the
    CB_COMPOUND header. V4.1 clients are found using the sessionID in the
    CB_SEQUENCE operation which is also compared against the sessionID associated
    with the back channel thread after a successful CREATE_SESSION.

    Each of these methods finds the one an only nfs_client associated
    with the incoming callback request - so nfs_find_client_next is not needed.

    In the RPC layer, the pg_authenticate call needs to find the nfs_client. For
    the v4.0 callback service, the callback identifier has not been decoded so a
    search by address, version, and minorversion is used. The sessionid for the
    sessions based callback service has (usually) not been set for the
    pg_authenticate on a CB_NULL call which can be sent prior to the return
    of a CREATE_SESSION call, so the sessionid associated with the back channel
    thread is not used to find the client in pg_authenticate for CB_NULL calls.

    Pass the referenced nfs_client to each CB_COMPOUND operation being proceesed
    via the new cb_process_state structure. The reference is held across
    cb_compound processing.

    Use the new cb_process_state struct to move the NFS4ERR_RETRY_UNCACHED_REP
    processing from process_op into nfs4_callback_sequence where it belongs.

    Signed-off-by: Andy Adamson
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • The sessions based callback service is started prior to the CREATE_SESSION call
    so that it can handle CB_NULL requests which can be sent before the
    CREATE_SESSION call returns and the session ID is known.

    Set the callback sessionid after a sucessful CREATE_SESSION.

    Signed-off-by: Andy Adamson
    Signed-off-by: Trond Myklebust

    Andy Adamson
     
  • The new back channel transport means we call the normal creation routine as
    well as svc_xprt_put.

    Signed-off-by: Andy Adamson
    Signed-off-by: Trond Myklebust

    Andy Adamson
     

18 Nov, 2010

1 commit


02 Oct, 2010

1 commit


11 Aug, 2010

1 commit

  • This is more kernel-ish, saves some space, and also allows us to
    expand the ops without breaking all the callers who are happy for the
    new members to be NULL.

    The few places which defined their own param types are changed to the
    new scheme (more which crept in recently fixed in following patches).

    Since we're touching them anyway, we change get() and set() to take a
    const struct kernel_param (which they really are). This causes some
    harmless warnings until we fix them (in following patches).

    To reduce churn, module_param_call creates the ops struct so the callers
    don't have to change (and casts the functions to reduce warnings).
    The modern version which takes an ops struct is called module_param_cb.

    Signed-off-by: Rusty Russell
    Reviewed-by: Takashi Iwai
    Tested-by: Phil Carmody
    Cc: "David S. Miller"
    Cc: Ville Syrjala
    Cc: Dmitry Torokhov
    Cc: Alessandro Rubini
    Cc: Michal Januszewski
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: Neil Brown
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-input@vger.kernel.org
    Cc: linux-fbdev-devel@lists.sourceforge.net
    Cc: linux-nfs@vger.kernel.org
    Cc: netdev@vger.kernel.org

    Rusty Russell
     

27 Jan, 2010

1 commit

  • Clean up: Bruce observed we have more or less common logic in each of
    svc_create_xprt()'s callers: the check to create an IPv6 RPC listener
    socket only if CONFIG_IPV6 is set. I'm about to add another case
    that does just the same.

    If we move the ifdefs into __svc_xpo_create(), then svc_create_xprt()
    call sites can get rid of the "#ifdef" ugliness, and can use the same
    logic with or without IPv6 support available in the kernel.

    Signed-off-by: Chuck Lever
    Signed-off-by: J. Bruce Fields

    Chuck Lever
     

06 Dec, 2009

1 commit


04 Dec, 2009

1 commit


10 Aug, 2009

1 commit


19 Jun, 2009

1 commit


18 Jun, 2009

5 commits

  • Clear "ret" if the error return from svc_create_xprt(AF_INET6) was
    -EAFNOSUPORT. Otherwise, callback start-up will succeed, but
    nfs_callback_up() will return -EAFNOSUPPORT anyway, and the first
    NFSv4 mount attempt after a reboot will fail.

    Bug introduced by commit f738f517 in 2.6.30-rc1.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Tracks the nfs_callback_info for both versions, enabling the callback
    service for v4 and v4.1 to run concurrently and be stopped independently
    of each other.

    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy

    Andy Adamson
     
  • Signed-off-by: Benny Halevy

    Benny Halevy
     
  • nfs41_callback_up() initializes the necessary queues and creates the new
    nfs41_callback_svc thread. This thread executes the callback service which
    waits for requests to arrive on the svc_serv->sv_cb_list.

    NFS41_BC_MIN_CALLBACKS is set to 1 because we expect callbacks to not
    cause substantial latency.

    The actual processing of the callback will be implemented as a separate patch.

    There is only one NFSv4.1 callback service. The first caller of
    nfs4_callback_up() creates the service, subsequent callers increment a
    reference count on the service. The service is destroyed when the last
    caller invokes nfs_callback_down().

    The transport needs to hold a reference to the callback service in order
    to invoke it during callback processing. Currently this reference is only
    obtained when the service is first created. This is incorrect, since
    subsequent registrations for other transports will leave the xprt->serv
    pointer uninitialized, leading to an oops when a callback arrives on
    the "unreferenced" transport.

    This patch fixes the problem by ensuring that a reference to the service
    is saved in xprt->serv, either because the service is created by this
    invocation to nfs4_callback_up() or by a prior invocation.

    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy
    [nfs41: Add a reference to svc_serv during callback service bring up]
    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy
    [Type check arguments of nfs_callback_up]
    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy
    [nfs41: save svc_serv in nfs_callback_info]
    Signed-off-by: Benny Halevy
    [Removal of ugly #ifdefs]
    [nfs41: Update to removal of ugly #ifdefs]
    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy

    Ricardo Labiaga
     
  • move nfs4_init_callback into nfs4_init_client_minor_version
    and nfs4_destroy_callback into nfs4_clear_client_minor_version

    as these need to happen also when auto-negotiating the minorversion
    once the callback service for nfs41 becomes different than for nfs4.0

    Signed-off-by: Benny Halevy
    [nfs41: Fix checkpatch warning]
    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy
    [Type check arguments of nfs_callback_up]
    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy
    [nfs41: Backchannel: Remove FIXME comment]
    Signed-off-by: Ricardo Labiaga
    Signed-off-by: Benny Halevy

    Benny Halevy
     

29 Mar, 2009

4 commits

  • Apparently a lot of people need to disable IPv6 completely on their
    distributor-built systems, which have CONFIG_IPV6_MODULE enabled at
    build time.

    They do this by blacklisting the ipv6.ko module. This causes the
    creation of the NFSv4 callback service listener to fail if
    CONFIG_IPV6_MODULE is set, but the module cannot be loaded.

    Now that the kernel's PF_INET6 RPC listeners are completely separate
    from PF_INET listeners, we can always start PF_INET. Then the NFS
    client can try to start a PF_INET6 listener, but it isn't required
    to be available.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • We're about to convert over to using separate PF_INET and PF_INET6
    listeners, instead of a single PF_INET6 listener that also receives
    AF_INET requests and maps them to AF_INET6.

    Clear the way by removing the logic in lockd and the NFSv4 callback
    server that creates an AF_INET6 service listener.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Since an RPC service listener's protocol family is specified now via
    svc_create_xprt(), it no longer needs to be passed to svc_create() or
    svc_create_pooled(). Remove that argument from the synopsis of those
    functions, and remove the sv_family field from the svc_serv struct.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • The sv_family field is going away. Pass a protocol family argument to
    svc_create_xprt() instead of extracting the family from the passed-in
    svc_serv struct.

    Again, as this is a listener socket and not an address, we make this
    new argument an "int" protocol family, instead of an "sa_family_t."

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

24 Dec, 2008

1 commit


18 Oct, 2008

1 commit


30 Sep, 2008

1 commit


10 Jul, 2008

2 commits


17 May, 2008

1 commit


24 Apr, 2008

3 commits

  • When svc_recv returns an unexpected error, nfs_callback_svc will print a
    warning and exit. This problematic for several reasons. In particular,
    it will cause the reference counts for the thread to be wrong, and no
    new thread will be started until all nfs4 mounts are unmounted.

    Rather than exiting on error from svc_recv, have the thread do a 1s
    sleep and then retry the loop. This is unlikely to cause any harm, and
    if the error turns out to be something temporary then it may be able to
    recover.

    Signed-off-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    Jeff Layton
     
  • Obvious comment nit.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • There's a general push to convert kernel threads to use the (much
    cleaner) kthread API. This patch converts the NFSv4 callback kernel
    thread to the kthread API. In addition to being generally cleaner this
    also removes the dependency on signals when shutting down the thread.

    Note that this patch depends on the recent patches to svc_recv() to
    make it check kthread_should_stop() periodically. Those patches are
    in Bruce's tree at the moment and are slated for 2.6.26 along with
    the lockd conversion, so this conversion is probably also appropriate
    for 2.6.26.

    Signed-off-by: Jeff Layton
    Acked-by: Trond Myklebust
    Signed-off-by: J. Bruce Fields

    Jeff Layton
     

22 Feb, 2008

1 commit

  • Sorry for the noise, but here's the v3 of this compilation fix :)

    There are some places, which declare the char buf[...] on the stack
    to push it later into dprintk(). Since the dprintk sometimes (if the
    CONFIG_SYSCTL=n) becomes an empty do { } while (0) stub, these buffers
    cause gcc to produce appropriate warnings.

    Wrap these buffers with RPC_IFDEBUG macro, as Trond proposed, to
    compile them out when not needed.

    Signed-off-by: Pavel Emelyanov
    Acked-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Pavel Emelyanov
     

21 Feb, 2008

1 commit

  • Now that the reference counting on the callback thread is working as
    expected, it uncovers another problem. Peter Staubach noticed while
    testing that patch on an older kernel that he would occasionally see
    this printk in rpc_register fire:

    "RPC: failed to contact portmap (errno -512).

    The NFSv4 callback thread is signaled by nfs_callback_down(), but never
    flushes that signal. All of the shutdown processing is done with that
    signal pending. This makes it fail the call to unregister the port with
    the portmapper.

    In actuality, this rpc_register call isn't necessary at all since the
    port isn't actually registered with the portmapper anymore. Regardless,
    there doesn't seem to be any reason to leave the signal pending while
    the thread is being shut down and flushing it should generally silence
    that printk.

    Signed-off-by: Jeff Layton
    Signed-off-by: Trond Myklebust

    Jeff Layton
     

14 Feb, 2008

1 commit

  • The reference counting for the NFSv4 callback thread stays artificially
    high. When this thread comes down, it doesn't properly tear down the
    svc_serv, causing a memory leak. In my testing on an older kernel on
    x86_64, memory would leak out of the 8k kmalloc slab. So, we're leaking
    at least a page of memory every time the thread comes down.

    svc_create() creates the svc_serv with a sv_nrthreads count of 1, and
    then svc_create_thread() increments that count. Whenever the callback
    thread is started it has a sv_nrthreads count of 2. When coming down, it
    calls svc_exit_thread() which decrements that count and if it hits 0, it
    tears everything down. That never happens here since the count is always
    at 2 when the thread exits.

    The problem is that nfs_callback_up() should be calling svc_destroy() on
    the svc_serv on both success and failure. This is how lockd_up_proto()
    handles the reference counting, and doing that here fixes the leak.

    Signed-off-by: Jeff Layton
    Signed-off-by: Trond Myklebust

    Jeff Layton
     

02 Feb, 2008

1 commit


30 Jan, 2008

2 commits

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

    Signed-off-by: Chuck Lever
    Cc: Aurelien Charbon

    Trond: Also fix up protocol version number argument in nfs_find_client() to
    use the correct u32 type.

    Signed-off-by: Trond Myklebust

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

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

    Signed-off-by: Chuck Lever
    Cc: Aurelien Charbon
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

18 Jul, 2007

1 commit

  • Currently, the freezer treats all tasks as freezable, except for the kernel
    threads that explicitly set the PF_NOFREEZE flag for themselves. This
    approach is problematic, since it requires every kernel thread to either
    set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
    care for the freezing of tasks at all.

    It seems better to only require the kernel threads that want to or need to
    be frozen to use some freezer-related code and to remove any
    freezer-related code from the other (nonfreezable) kernel threads, which is
    done in this patch.

    The patch causes all kernel threads to be nonfreezable by default (ie. to
    have PF_NOFREEZE set by default) and introduces the set_freezable()
    function that should be called by the freezable kernel threads in order to
    unset PF_NOFREEZE. It also makes all of the currently freezable kernel
    threads call set_freezable(), so it shouldn't cause any (intentional)
    change of behaviour to appear. Additionally, it updates documentation to
    describe the freezing of tasks more accurately.

    [akpm@linux-foundation.org: build fixes]
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Nigel Cunningham
    Cc: Pavel Machek
    Cc: Oleg Nesterov
    Cc: Gautham R Shenoy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki