07 Dec, 2011

1 commit

  • Allow the freezer to skip wait_on_bit_killable sleeps in the sunrpc
    layer. This should allow suspend and hibernate events to proceed, even
    when there are RPC's pending on the wire.

    Also, wrap the TASK_KILLABLE sleeps in NFS layer in freezer_do_not_count
    and freezer_count calls. This allows the freezer to skip tasks that are
    sleeping while looping on EJUKEBOX or NFS4ERR_DELAY sorts of errors.

    Signed-off-by: Jeff Layton
    Signed-off-by: Rafael J. Wysocki

    Jeff Layton
     

05 Nov, 2011

1 commit

  • commit d953126 changed how nfs_atomic_lookup handles an -EISDIR return
    from an OPEN call. Prior to that patch, that caused the client to fall
    back to doing a normal lookup. When that patch went in, the code began
    returning that error to userspace. The d_revalidate codepath however
    never had the corresponding change, so it was still possible to end up
    with a NULL ctx->state pointer after that.

    That patch caused a regression. When we attempt to open a directory that
    does not have a cached dentry, that open now errors out with EISDIR. If
    you attempt the same open with a cached dentry, it will succeed.

    Fix this by reverting the change in nfs_atomic_lookup and allowing
    attempts to open directories to fall back to a normal lookup

    Also, add a NFSv4-specific f_ops->open routine that just returns
    -ENOTDIR. This should never be called if things are working properly,
    but if it ever is, then the dprintk may help in debugging.

    To facilitate this, a new file_operations field is also added to the
    nfs_rpc_ops struct.

    Cc: stable@kernel.org
    Signed-off-by: Jeff Layton
    Signed-off-by: Trond Myklebust

    Jeff Layton
     

25 Mar, 2011

1 commit


12 Mar, 2011

1 commit


05 Jan, 2011

1 commit

  • Hi,

    In fs/nfs/proc.c::nfs_proc_symlink() we will leak memory if either
    nfs_alloc_fhandle() or nfs_alloc_fattr() returns NULL but the other one
    doesn't.
    This patch ensures memory allocated by one when the other fails is always
    released (this is safe since nfs_free_fattr() and nfs_free_fhandle() both
    call kfree which deals gracefully with NULL pointers).

    Signed-off-by: Jesper Juhl
    Signed-off-by: Trond Myklebust

    Jesper Juhl
     

17 Dec, 2010

1 commit

  • We'd like to prevent local buffer overflows caused by malicious or
    broken servers. New xdr_stream style decoders can do that.

    For efficiency, we also eventually want to be able to pass xdr_streams
    from call_decode() to all XDR decoding functions, rather than building
    an xdr_stream in every XDR decoding function in the kernel.

    nfs_decode_dirent() is renamed to follow the naming convention of the
    other two dirent decoders.

    Static helper functions are left without the "inline" directive. This
    allows the compiler to choose automatically how to optimize these for
    size or speed.

    Signed-off-by: Chuck Lever
    Tested-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

24 Oct, 2010

1 commit

  • We can use vmapped pages to read more information from the network at once.
    This will reduce the number of calls needed to complete a readdir.

    Signed-off-by: Bryan Schumaker
    [trondmy: Added #include for linux/vmalloc.h> in fs/nfs/dir.c]
    Signed-off-by: Trond Myklebust

    Bryan Schumaker
     

18 Sep, 2010

2 commits

  • A synchronous rename can be interrupted by a SIGKILL. If that happens
    during a sillyrename operation, it's possible for the rename call to
    be sent to the server, but the task exits before processing the
    reply. If this happens, the sillyrenamed file won't get cleaned up
    during nfs_dentry_iput and the server is left with a dangling .nfs* file
    hanging around.

    Fix this problem by turning sillyrename into an asynchronous operation
    and have the task doing the sillyrename just wait on the reply. If the
    task is killed before the sillyrename completes, it'll still proceed
    to completion.

    Signed-off-by: Jeff Layton
    Reviewed-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Jeff Layton
     
  • Each NFS version has its own version of the rename args container.
    Standardize them on a common one that's identical to the one NFSv4
    uses.

    Signed-off-by: Jeff Layton
    Reviewed-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Jeff Layton
     

17 Sep, 2010

1 commit


15 May, 2010

2 commits


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
     

10 Feb, 2010

1 commit


24 Sep, 2009

1 commit

  • * remove asm/atomic.h inclusion from linux/utsname.h --
    not needed after kref conversion
    * remove linux/utsname.h inclusion from files which do not need it

    NOTE: it looks like fs/binfmt_elf.c do not need utsname.h, however
    due to some personality stuff it _is_ needed -- cowardly leave ELF-related
    headers and files alone.

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

    Alexey Dobriyan
     

20 Mar, 2009

1 commit

  • Close-to-open cache consistency rules really only require us to flush out
    writes on calls to close(), and require us to revalidate attributes on the
    very last close of the file.

    Currently we appear to be doing a lot of extra attribute revalidation
    and cache flushes.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

08 Oct, 2008

1 commit

  • Allow mount to do authenticated mounts below the root of the exported tree.
    The wording in RFC 2623, sec 2.3.2. allows fsinfo with UNIX authentication
    on the root of the export. Mounts are not always done on the root
    of the exported tree. Especially autoumounts often mount below the root of
    the exported tree.
    Some server implementations (justly) require full authentication for the
    so-called deep mounts. The old code used AUTH_SYS only. This caused deep
    mounts to fail on systems requiring stronger authentication..
    The client should try both authentication types and use the first one that
    succeeds.
    This method was already partially implemented. This patch completes
    the implementation for NFS2 and NFS3.
    This patch was developed to allow Debian systems to automount home directories
    on Solaris servers with krb5 authentication.

    Tested on kernel 2.6.24-etchnhalf.1

    Signed-off-by: E.G. Keizer
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Trond Myklebust

    EG Keizer
     

10 Jul, 2008

3 commits


17 May, 2008

1 commit


30 Jan, 2008

2 commits

  • Now that each NFS mount point caches its own nlm_host structure, it can be
    passed to nlmclnt_proc() for each lock request. By pinning an nlm_host for
    each mount point, we trade the overhead of looking up or creating a fresh
    nlm_host struct during every NLM procedure call for a little extra memory.

    We also restrict the nlmclnt_proc symbol to limit the use of this call to
    in-tree modules.

    Note that nlm_lookup_host() (just removed from the client's per-request
    NLM processing) could also trigger an nlm_host garbage collection. Now
    client-side nlm_host garbage collection occurs only during NFS mount
    processing. Since the NFS client now holds a reference on these nlm_host
    structures, they wouldn't have been affected by garbage collection
    anyway.

    Given that nlm_lookup_host() reorders the global nlm_host chain after
    every successful lookup, and that a garbage collection could be triggered
    during the call, we've removed a significant amount of per-NLM-request
    CPU processing overhead.

    Sidebar: there are only a few remaining references to the internals of
    NFS inodes in the client-side NLM code. The only references I found are
    related to extracting or comparing the inode's file handle via NFS_FH().
    One is in nlmclnt_grant(); the other is in nlmclnt_setlockargs().

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

    Chuck Lever
     
  • Move the common code for setting up the nfs_write_data and nfs_read_data
    structures into fs/nfs/read.c, fs/nfs/write.c and fs/nfs/direct.c.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

22 Oct, 2007

1 commit


10 Oct, 2007

3 commits


20 Jul, 2007

2 commits

  • Fix a couple of bugs:
    - Don't rely on the parent dentry still being valid when the call completes.
    Fixes a race with shrink_dcache_for_umount_subtree()

    - Don't remove the file if the filehandle has been labelled as stale.

    Fix a couple of inefficiencies
    - Remove the global list of sillyrenamed files. Instead we can cache the
    sillyrename information in the dentry->d_fsdata
    - Move common code from unlink_setup/unlink_done into fs/nfs/unlink.c

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     
  • We need a common structure for setting up an unlink() rpc call in order to
    fix the asynchronous unlink code.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

09 May, 2007

1 commit


04 Feb, 2007

1 commit


09 Dec, 2006

1 commit


06 Dec, 2006

2 commits


27 Sep, 2006

1 commit


23 Sep, 2006

4 commits

  • Now that we have a copy of the symlink path in the page cache, we can pass
    a struct page down to the XDR routines instead of a string buffer.

    Test plan:
    Connectathon, all NFS versions.

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

    Chuck Lever
     
  • If the LOOKUP or GETATTR in nfs_instantiate fail, nfs_instantiate will do a
    d_drop before returning. But some callers already do a d_drop in the case
    of an error return. Make certain we do only one d_drop in all error paths.

    This issue was introduced because over time, the symlink proc API diverged
    slightly from the create/mkdir/mknod proc API. To prevent other coding
    mistakes of this type, change the symlink proc API to be more like
    create/mkdir/mknod and move the nfs_instantiate call into the symlink proc
    routines so it is used in exactly the same way for create, mkdir, mknod,
    and symlink.

    Test plan:
    Connectathon, all versions of NFS.

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

    Chuck Lever
     
  • Eliminate nfs_server::client_sys in favour of nfs_client::cl_rpcclient as we
    only really need one per server that we're talking to since it doesn't have any
    security on it.

    The retransmission management variables are also moved to the common struct as
    they're required to set up the cl_rpcclient connection.

    The NFS2/3 client and client_acl connections are thenceforth derived by cloning
    the cl_rpcclient connection and post-applying the authorisation flavour.

    The code for setting up the initial common connection has been moved to
    client.c as nfs_create_rpc_client(). All the NFS program definition tables are
    also moved there as that's where they're now required rather than super.c.

    Signed-Off-By: David Howells
    Signed-off-by: Trond Myklebust

    David Howells
     
  • Add some extra const qualifiers into NFS.

    Signed-Off-By: David Howells
    Signed-off-by: Trond Myklebust

    David Howells
     

09 Jun, 2006

1 commit

  • As fs/nfs/inode.c is rather large, heterogenous and unwieldy, the attached
    patch splits it up into a number of files:

    (*) fs/nfs/inode.c

    Strictly inode specific functions.

    (*) fs/nfs/super.c

    Superblock management functions for NFS and NFS4, normal access, clones
    and referrals. The NFS4 superblock functions _could_ move out into a
    separate conditionally compiled file, but it's probably not worth it as
    there're so many common bits.

    (*) fs/nfs/namespace.c

    Some namespace-specific functions have been moved here.

    (*) fs/nfs/nfs4namespace.c

    NFS4-specific namespace functions (this could be merged into the previous
    file). This file is conditionally compiled.

    (*) fs/nfs/internal.h

    Inter-file declarations, plus a few simple utility functions moved from
    fs/nfs/inode.c.

    Additionally, all the in-.c-file externs have been moved here, and those
    files they were moved from now includes this file.

    For the most part, the functions have not been changed, only some multiplexor
    functions have changed significantly.

    I've also:

    (*) Added some extra banner comments above some functions.

    (*) Rearranged the function order within the files to be more logical and
    better grouped (IMO), though someone may prefer a different order.

    (*) Reduced the number of #ifdefs in .c files.

    (*) Added missing __init and __exit directives.

    Signed-Off-By: David Howells

    David Howells