17 Dec, 2010

2 commits

  • Clean up.

    Change nlmsvc_lookup_host() to be purpose-built for server-side
    nlm_host management. This replaces the generic nlm_lookup_host()
    helper function, just like on the client side. The lookup logic is
    specialized for server host lookups.

    The server side cache also gets its own specialized equivalent of the
    nlm_release_host() function.

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

    Chuck Lever
     
  • The nlm_release_call() function is invoked from both the server and
    the client side. We're about to introduce a distinct server- and
    client-side nlm_release_host(), so nlm_release_call() must first be
    split into a client-side and a server-side version.

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

    Chuck Lever
     

18 Nov, 2010

1 commit


23 Sep, 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
     

15 Dec, 2009

1 commit


13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

07 Jan, 2009

2 commits


31 Oct, 2008

1 commit

  • The nlm_host_rebooted() function uses nlm_cmp_addr() to find an
    nsm_handle that matches the rebooted peer. In order for this to work,
    the passed-in address must have a proper address family.

    This fixes a post-2.6.28 regression introduced by commit 781b61a6, which
    added AF_INET6 support to nlm_cmp_addr(). Before that commit,
    nlm_cmp_addr() didn't care about the address family; it compared only
    the sin_addr.s_addr field for equality.

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

    Chuck Lever
     

04 Oct, 2008

4 commits

  • lockd accepts SM_NOTIFY calls only from a privileged process on the
    local system. If lockd uses an AF_INET6 listener, the sender's address
    (ie the local rpc.statd) will be the IPv6 loopback address, not the
    IPv4 loopback address.

    Make sure the privilege test in nlmsvc_proc_sm_notify() and
    nlm4svc_proc_sm_notify() works for both AF_INET and AF_INET6 family
    addresses by refactoring the test into a helper and adding support for
    IPv6 addresses.

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

    Chuck Lever
     
  • Adjust the signature and callers of nlmclnt_grant() to pass a "struct
    sockaddr *" instead of a "struct sockaddr_in *" in order to support IPv6
    addresses.

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

    Chuck Lever
     
  • Do all the grace period checks in svclock.c. This simplifies the code a
    bit, and will ease some later changes.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Rewrite grace period code to unify management of grace period across
    lockd and nfsd. The current code has lockd and nfsd cooperate to
    compute a grace period which is satisfactory to them both, and then
    individually enforce it. This creates a slight race condition, since
    the enforcement is not coordinated. It's also more complicated than
    necessary.

    Here instead we have lockd and nfsd each inform common code when they
    enter the grace period, and when they're ready to leave the grace
    period, and allow normal locking only after both of them are ready to
    leave.

    We also expect the locks_start_grace()/locks_end_grace() interface here
    to be simpler to build on for future cluster/high-availability work,
    which may require (for example) putting individual filesystems into
    grace, or enforcing grace periods across multiple cluster nodes.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

23 Jul, 2008

1 commit

  • fs/lockd/svcproc.c:115:11: warning: incorrect type in initializer (different base types)
    fs/lockd/svcproc.c:115:11: expected int [signed] rc
    fs/lockd/svcproc.c:115:11: got restricted __be32 [usertype]
    ... and so on...

    Signed-off-by: Harvey Harrison
    Signed-off-by: Andrew Morton
    Signed-off-by: J. Bruce Fields

    Harvey Harrison
     

21 Jul, 2008

1 commit

  • * 'for-2.6.27' of git://linux-nfs.org/~bfields/linux: (51 commits)
    nfsd: nfs4xdr.c do-while is not a compound statement
    nfsd: Use C99 initializers in fs/nfsd/nfs4xdr.c
    lockd: Pass "struct sockaddr *" to new failover-by-IP function
    lockd: get host reference in nlmsvc_create_block() instead of callers
    lockd: minor svclock.c style fixes
    lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_lock
    lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_testlock
    lockd: nlm_release_host() checks for NULL, caller needn't
    file lock: reorder struct file_lock to save space on 64 bit builds
    nfsd: take file and mnt write in nfs4_upgrade_open
    nfsd: document open share bit tracking
    nfsd: tabulate nfs4 xdr encoding functions
    nfsd: dprint operation names
    svcrdma: Change WR context get/put to use the kmem cache
    svcrdma: Create a kmem cache for the WR contexts
    svcrdma: Add flush_scheduled_work to module exit function
    svcrdma: Limit ORD based on client's advertised IRD
    svcrdma: Remove unused wait q from svcrdma_xprt structure
    svcrdma: Remove unneeded spin locks from __svc_rdma_free
    svcrdma: Add dma map count and WARN_ON
    ...

    Linus Torvalds
     

16 Jul, 2008

4 commits

  • Push it into those callback functions that actually need it.

    Note that all the NFS operations use their own locking, so don't need the
    BKL. Ditto for the rpcbind client.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     
  • nlmsvc_lock calls nlmsvc_lookup_host to find a nlm_host struct. The
    callers of this function, however, call nlmsvc_retrieve_args or
    nlm4svc_retrieve_args, which also return a nlm_host struct.

    Change nlmsvc_lock to take a host arg instead of calling
    nlmsvc_lookup_host itself and change the callers to pass a pointer to
    the nlm_host they've already found.

    Since nlmsvc_testlock() now just uses the caller's reference, we no
    longer need to get or release it.

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

    Jeff Layton
     
  • nlmsvc_testlock calls nlmsvc_lookup_host to find a nlm_host struct. The
    callers of this functions, however, call nlmsvc_retrieve_args or
    nlm4svc_retrieve_args, which also return a nlm_host struct.

    Change nlmsvc_testlock to take a host arg instead of calling
    nlmsvc_lookup_host itself and change the callers to pass a pointer to
    the nlm_host they've already found.

    We take a reference to host in the place where nlmsvc_testlock()
    previous did a new lookup, so the reference counting is unchanged from
    before.

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

    Jeff Layton
     
  • No need to check for a NULL argument twice.

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

    Jeff Layton
     

02 Feb, 2008

1 commit

  • In a number of places where we wish only to translate nlm_drop_reply to
    rpc_drop_reply errors we instead return early with rpc_drop_reply,
    skipping some important end-of-function cleanup.

    This results in reference count leaks when lockd is doing posix locking
    on GFS2.

    Signed-off-by: Oleg Drokin
    Signed-off-by: J. Bruce Fields

    Oleg Drokin
     

07 May, 2007

3 commits

  • Rewrite nlmsvc_lock() to use the asynchronous interface.

    As with testlock, we answer nlm requests in nlmsvc_lock by first looking up
    the block and then using the results we find in the block if B_QUEUED is
    set, and calling vfs_lock_file() otherwise.

    If this a new lock request and we get -EINPROGRESS return on a non-blocking
    request then we defer the request.

    Also modify nlmsvc_unlock() to call the filesystem method if appropriate.

    Signed-off-by: Marc Eshel
    Signed-off-by: J. Bruce Fields

    Marc Eshel
     
  • Rewrite nlmsvc_testlock() to use the new asynchronous interface: instead of
    immediately doing a posix_test_lock(), we first look for a matching block.
    If the subsequent test_lock returns anything other than -EINPROGRESS, we
    then remove the block we've found and return the results.

    If it returns -EINPROGRESS, then we defer the lock request.

    In the case where the block we find in the first step has B_QUEUED set,
    we bypass the vfs_test_lock entirely, instead using the block to decide how
    to respond:
    with nlm_lck_denied if B_TIMED_OUT is set.
    with nlm_granted if B_GOT_CALLBACK is set.
    by dropping if neither B_TIMED_OUT nor B_GOT_CALLBACK is set

    Signed-off-by: Marc Eshel
    Signed-off-by: J. Bruce Fields

    Marc Eshel
     
  • Change NLM internal interface to pass more information for test lock; we
    need this to make sure the cookie information is pushed down to the place
    where we do request deferral, which is handled for testlock by the
    following patch.

    Signed-off-by: Marc Eshel
    Signed-off-by: J. Bruce Fields

    Marc Eshel
     

13 Feb, 2007

2 commits

  • Expand the rq_addr field to allow it to contain larger addresses.

    Specifically, we replace a 'sockaddr_in' with a 'sockaddr_storage', then
    everywhere the 'sockaddr_in' was referenced, we use instead an accessor
    function (svc_addr_in) which safely casts the _storage to _in.

    Signed-off-by: Chuck Lever
    Cc: Aurelien Charbon
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chuck Lever
     
  • There are loads of places where the RPC server assumes that the rq_addr fields
    contains an IPv4 address. Top among these are error and debugging messages
    that display the server's IP address.

    Let's refactor the address printing into a separate function that's smart
    enough to figure out the difference between IPv4 and IPv6 addresses.

    Signed-off-by: Chuck Lever
    Cc: Aurelien Charbon
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chuck Lever
     

06 Dec, 2006

1 commit


21 Oct, 2006

2 commits


17 Oct, 2006

1 commit

  • It is possible for the ->fopen callback from lockd into nfsd to find that an
    answer cannot be given straight away (an upcall is needed) and so the request
    has to be 'dropped', to be retried later. That error status is not currently
    propagated back.

    So:
    Change nlm_fopen to return nlm error codes (rather than a private
    protocol) and define a new nlm_drop_reply code.
    Cause nlm_drop_reply to cause the rpc request to get rpc_drop_reply
    when this error comes back.
    Cause svc_process to drop a request which returns a status of
    rpc_drop_reply.

    [akpm@osdl.org: fix warning storm]
    Cc: Marc Eshel
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    NeilBrown
     

04 Oct, 2006

5 commits

  • When we send a GRANTED_MSG call, we current copy the NLM cookie provided in
    the original LOCK call - because in 1996, some broken clients seemed to rely
    on this bug. However, this means the cookies are not unique, so that when the
    client's GRANTED_RES message comes back, we cannot simply match it based on
    the cookie, but have to use the client's IP address in addition. Which breaks
    when you have a multi-homed NFS client.

    The X/Open spec explicitly mentions that clients should not expect the same
    cookie; so one may hope that any clients that were broken in 1996 have either
    been fixed or rendered obsolete.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Kirch
     
  • This patch makes the SM_NOTIFY handling understand and use the nsm_handle.

    To make it a bit clear what is happening:

    nlmclent_prepare_reclaim and nlmclnt_finish_reclaim
    get open-coded into 'reclaimer'

    The result is tidied up.

    Then some of that functionality is moved out into nlm_host_rebooted (which
    calls nlmclnt_recovery which starts a thread which runs reclaimer).

    Also host_rebooted now finds an nsm_handle rather than a host, then then
    iterates over all hosts and deals with each host that shares that nsm_handle.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Kirch
     
  • This patch adds the peer's hostname (and name length) to all calls to
    nlm*_lookup_host functions. A subsequent patch will make use of these (is
    requested by a sysctl).

    Signed-off-by: Olaf Kirch
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Kirch
     
  • Common code from nlm4svc_proc_sm_notify and nlmsvc_proc_sm_notify is moved
    into a new nlm_host_rebooted.

    This is in preparation of a patch that will change the reboot notification
    handling entirely.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Kirch
     
  • This patch moves all checks of the h_monitored flag into the
    nsm_monitor/unmonitor functions. A subsequent patch will replace the
    mechanism by which we mark a host as being monitored.

    There is still one occurence of h_monitored outside of mon.c and that is in
    clntlock.c where we respond to a reboot. The subsequent patch will modify
    this too.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Kirch
     

21 Mar, 2006

3 commits


15 Feb, 2006

1 commit

  • If 2 threads attached to the same process are blocking on different locks on
    different files (maybe even on different servers) but have the same lock
    arguments (i.e. same offset+length - actually quite common, since most
    processes try to lock the entire file) then the first GRANTED call that wakes
    one up will also wake the other.

    Currently when the NLM_GRANTED callback comes in, lockd walks the list of
    blocked locks in search of a match to the lock that the NLM server has
    granted. Although it checks the lock pid, start and end, it fails to check
    the filehandle and the server address.

    By checking the filehandle and server IP address, we ensure that this only
    happens if the locks truly are referencing the same file.

    Signed-off-by: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trond Myklebust
     

07 Jan, 2006

1 commit

  • Shrink the RPC task structure. Instead of storing separate pointers
    for task->tk_exit and task->tk_release, put them in a structure.

    Also pass the user data pointer as a parameter instead of passing it via
    task->tk_calldata. This enables us to nest callbacks.

    Signed-off-by: Trond Myklebust

    Trond Myklebust