20 Jul, 2007

6 commits

  • Slab destructors were no longer supported after Christoph's
    c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
    BUGs for both slab and slub, and slob never supported them
    either.

    This rips out support for the dtor pointer from kmem_cache_create()
    completely and fixes up every single callsite in the kernel (there were
    about 224, not including the slab allocator definitions themselves,
    or the documentation references).

    Signed-off-by: Paul Mundt

    Paul Mundt
     
  • Share a little common code, reverse the arguments for consistency, drop the
    unnecessary "inline", and lowercase the name.

    Signed-off-by: "J. Bruce Fields"
    Acked-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • EX_RDONLY is only called in one place; just put it there.

    Signed-off-by: "J. Bruce Fields"
    Acked-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We can now assume that rqst_exp_get_by_name() does not return NULL; so clean
    up some unnecessary checks.

    Signed-off-by: "J. Bruce Fields"
    Acked-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • I converted the various export-returning functions to return -ENOENT instead
    of NULL, but missed a few cases.

    This particular case could cause actual bugs in the case of a krb5 client that
    doesn't match any ip-based client and that is trying to access a filesystem
    not exported to krb5 clients.

    Signed-off-by: "J. Bruce Fields"
    Acked-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • The value of nperbucket calculated here is too small--we should be rounding up
    instead of down--with the result that the index j in the following loop can
    overflow the raparm_hash array. At least in my case, the next thing in memory
    turns out to be export_table, so the symptoms I see are crashes caused by the
    appearance of four zeroed-out export entries in the first bucket of the hash
    table of exports (which were actually entries in the readahead cache, a
    pointer to which had been written to the export table in this initialization
    code).

    It looks like the bug was probably introduced with commit
    fce1456a19f5c08b688c29f00ef90fdfa074c79b ("knfsd: make the readahead params
    cache SMP-friendly").

    Cc:
    Cc: Greg Banks
    Signed-off-by: "J. Bruce Fields"
    Acked-by: NeilBrown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     

19 Jul, 2007

1 commit

  • We've been using the convention that vfs_foo is the function that calls
    a filesystem-specific foo method if it exists, or falls back on a
    generic method if it doesn't; thus vfs_foo is what is called when some
    other part of the kernel (normally lockd or nfsd) wants to get a lock,
    whereas foo is what filesystems call to use the underlying local
    functionality as part of their lock implementation.

    So rename setlease to vfs_setlease (which will call a
    filesystem-specific setlease after a later patch) and __setlease to
    setlease.

    Also, vfs_setlease need only be GPL-exported as long as it's only needed
    by lockd and nfsd.

    Signed-off-by: "J. Bruce Fields"

    J. Bruce Fields
     

18 Jul, 2007

27 commits

  • Allow root squashing to vary per-pseudoflavor, so that you can (for example)
    allow root access only when sufficiently strong security is in use.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Our clients (like other clients, as far as I know) use only auth_sys for nlm,
    even when using rpcsec_gss for the main nfs operations.

    Administrators that want to deny non-kerberos-authenticated locking requests
    will need to turn off NFS protocol versions less than 4....

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We could return some sort of error in the case where someone asks for secinfo
    on an export without the secinfo= option set--that'd be no worse than what
    we've been doing. But it's not really correct. So, hack up an approximate
    secinfo response in that case--it may not be complete, but it'll tell the
    client at least one acceptable security flavor.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Implement the secinfo operation.

    (Thanks to Usha Ketineni wrote an earlier version of this support.)

    Cc: Usha Ketineni
    Signed-off-by: Andy Adamson
    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Adamson
     
  • Add secinfo information to the display in proc/net/sunrpc/nfsd.export/content.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Factor out some code to be shared by secinfo display code. Remove some
    unnecessary conditional printing of commas where we know the condition is
    true.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Allow readonly access to vary depending on the pseudoflavor, using the flag
    passed with each pseudoflavor in the export downcall. The rest of the flags
    are ignored for now, though some day we might also allow id squashing to vary
    based on the flavor.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Make the first actual use of the secinfo information by using it to return
    nfserr_wrongsec when an export is found that doesn't allow the flavor used on
    this request.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Andy Adamson
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Adamson
     
  • Factor nfsd_lookup into nfsd_lookup_dentry, which finds the right dentry and
    export, and a second part which composes the filehandle (and which will later
    check the security flavor on the new export).

    No change in behavior.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • With this patch, we fall back on using the gss/pseudoflavor only if we fail to
    find a matching auth_unix export that has a secinfo list.

    As long as sec= options aren't used, there's still no change in behavior here
    (except possibly for some additional auth_unix cache lookups, whose results
    will be ignored).

    The sec= option, however, is not actually enforced yet; later patches will add
    the necessary checks.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We want it to be possible for users to restrict exports both by IP address and
    by pseudoflavor. The pseudoflavor information has previously been passed
    using special auth_domains stored in the rq_client field. After the preceding
    patch that stored the pseudoflavor in rq_pflavor, that's now superfluous; so
    now we use rq_client for the ip information, as auth_null and auth_unix do.

    However, we keep around the special auth_domain in the rq_gssclient field for
    backwards compatibility purposes, so we can still do upcalls using the old
    "gss/pseudoflavor" auth_domain if upcalls using the unix domain to give us an
    appropriate export. This allows us to continue supporting old mountd.

    In fact, for this first patch, we always use the "gss/pseudoflavor"
    auth_domain (and only it) if it is available; thus rq_client is ignored in the
    auth_gss case, and this patch on its own makes no change in behavior; that
    will be left to later patches.

    Note on idmap: I'm almost tempted to just replace the auth_domain in the idmap
    upcall by a dummy value--no version of idmapd has ever used it, and it's
    unlikely anyone really wants to perform idmapping differently depending on the
    where the client is (they may want to perform *credential* mapping
    differently, but that's a different matter--the idmapper just handles id's
    used in getattr and setattr). But I'm updating the idmapd code anyway, just
    out of general backwards-compatibility paranoia.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Split the callers of exp_get_by_name(), exp_find(), and exp_parent() into
    those that are processing requests and those that are doing other stuff (like
    looking up filehandles for mountd).

    No change in behavior, just a (fairly pointless, on its own) cleanup.

    (Note this has the effect of making nfsd_cross_mnt() pass rqstp->rq_client
    instead of exp->ex_client into exp_find_by_name(). However, the two should
    have the same value at this point.)

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • The "err" variable will only be used in the final return, which always happens
    after either the preceding

    err = fh_compose(...);

    or after the following

    err = nfserrno(host_err);

    So the earlier assignment to err is ignored.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We're passing three arguments to exp_pseudoroot, two of which are just fields
    of the svc_rqst. Soon we'll want to pass in a third field as well. So let's
    just give up and pass in the whole struct svc_rqst.

    Also sneak in some minor style cleanups while we're at it.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • We add a list of pseudoflavors to each export downcall, which will be used
    both as a list of security flavors allowed on that export, and (in the order
    given) as the list of pseudoflavors to return on secinfo calls.

    This patch parses the new downcall information and adds it to the export
    structure, but doesn't use it for anything yet.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Andy Adamson
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Adamson
     
  • Currently exp_find(), exp_get_by_name(), and friends, return an export on
    success, and on failure return:

    errors -EAGAIN (drop this request pending an upcall) or
    -ETIMEDOUT (an upcall has timed out), or
    return NULL, which can mean either that there was a memory allocation
    failure, or that an export was not found, or that a passed-in
    export lacks an auth_domain.

    Many callers seem to assume that NULL means that an export was not found,
    which may lead to bugs in the case of a memory allocation failure.

    Modify these functions to distinguish between the two NULL cases by returning
    either -ENOENT or -ENOMEM. They now never return NULL. We get to simplify
    some code in the process.

    We return -ENOENT in the case of a missing auth_domain. This case should
    probably be removed (or converted to a bug) after confirming that it can never
    happen.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • One more incremental delegation policy improvement: don't give out a
    delegation on a file if conflicting access has previously required that a
    delegation be revoked on that file. (In practice we'll forget about the
    conflict when the struct nfs4_file is removed on close, so this is of limited
    use for now, though it should at least solve a temporary problem with
    self-conflicts on write opens from the same client.)

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Meelap Shah
     
  • Our original NFSv4 delegation policy was to give out a read delegation on any
    open when it was possible to.

    Since the lifetime of a delegation isn't limited to that of an open, a client
    may quite reasonably hang on to a delegation as long as it has the inode
    cached. This becomes an obvious problem the first time a client's inode cache
    approaches the size of the server's total memory.

    Our first quick solution was to add a hard-coded limit. This patch makes a
    mild incremental improvement by varying that limit according to the server's
    total memory size, allowing at most 4 delegations per megabyte of RAM.

    My quick back-of-the-envelope calculation finds that in the worst case (where
    every delegation is for a different inode), a delegation could take about
    1.5K, which would make the worst case usage about 6% of memory. The new limit
    works out to be about the same as the old on a 1-gig server.

    [akpm@linux-foundation.org: Don't needlessly bloat vmlinux]
    [akpm@linux-foundation.org: Make it right for highmem machines]
    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Meelap Shah
     
  • It looks like Al Viro gutted this header file five years ago and it hasn't
    been touched since.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • nfs4_acl_nfsv4_to_posix() returns an error and returns any posix acls
    calculated in two caller-provided pointers. It was setting these pointers to
    -errno in some error cases, resulting in nfsd4_set_nfs4_acl() calling
    posix_acl_release() with a -errno as an argument.

    Fix both the caller and the callee, by modifying nfsd4_set_nfs4_acl() to
    stop relying on the passed-in-pointers being left as NULL in the error
    case, and by modifying nfs4_acl_nfsv4_to_posix() to stop returning
    garbage in those pointers.

    Thanks to Alex Soule for reporting the bug.

    Signed-off-by: "J. Bruce Fields"
    Cc: Alexander Soule
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • enc_stateid_sz should be given in u32 words units, not bytes, so we were
    overestimating the buffer space needed here.

    Signed-off-by: Benny Halevy
    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benny Halevy
     
  • Silence a compiler warning in the ACL code, and add a comment making clear the
    initialization serves no other purpose.

    Signed-off-by: "J. Bruce Fields"
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    J. Bruce Fields
     
  • Both lockd and (in the nfsv4 case) nfsd enforce a "grace period" after reboot,
    during which clients may reclaim locks from the previous server instance, but
    may not acquire new locks.

    Currently the lockd and nfsd enforce grace periods of different lengths. This
    may cause problems when we reboot a server with both v2/v3 and v4 clients.
    For example, if the lockd grace period is shorter (as is likely the case),
    then a v3 client might acquire a new lock that conflicts with a lock already
    held (but not yet reclaimed) by a v4 client.

    This patch calculates a lease time that lockd and nfsd can both use.

    Signed-off-by: Marc Eshel
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marc Eshel
     
  • gcc-4.3:

    fs/nfsd/nfsctl.c: In function 'write_getfs':
    fs/nfsd/nfsctl.c:248: warning: cast from pointer to integer of different size

    Cc: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Currently NFSD calls directly into filesystems through the export_operations
    structure. I plan to change this interface in various ways in later patches,
    and want to avoid the export of the default operations to NFSD, so this patch
    adds two simple exportfs_encode_fh/exportfs_decode_fh helpers for NFSD to call
    instead of poking into exportfs guts.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • currently the export_operation structure and helpers related to it are in
    fs.h. fs.h is already far too large and there are very few places needing the
    export bits, so split them off into a separate header.

    [akpm@linux-foundation.org: fix cifs build]
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Neil Brown
    Cc: Steven French
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • 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
     

14 Jul, 2007

2 commits

  • * git://git.linux-nfs.org/pub/linux/nfs-2.6: (122 commits)
    sunrpc: drop BKL around wrap and unwrap
    NFSv4: Make sure unlock is really an unlock when cancelling a lock
    NLM: fix source address of callback to client
    SUNRPC client: add interface for binding to a local address
    SUNRPC server: record the destination address of a request
    SUNRPC: cleanup transport creation argument passing
    NFSv4: Make the NFS state model work with the nosharedcache mount option
    NFS: Error when mounting the same filesystem with different options
    NFS: Add the mount option "nosharecache"
    NFS: Add support for mounting NFSv4 file systems with string options
    NFS: Add final pieces to support in-kernel mount option parsing
    NFS: Introduce generic mount client API
    NFS: Add enums and match tables for mount option parsing
    NFS: Improve debugging output in NFS in-kernel mount client
    NFS: Clean up in-kernel NFS mount
    NFS: Remake nfsroot_mount as a permanent part of NFS client
    SUNRPC: Add a convenient default for the hostname when calling rpc_create()
    SUNRPC: Rename rpcb_getport to be consistent with new rpcb_getport_sync name
    SUNRPC: Rename rpcb_getport_external routine
    SUNRPC: Allow rpcbind requests to be interrupted by a signal.
    ...

    Linus Torvalds
     
  • When nfsd was transitioned to use splice instead of sendfile() for data
    transfers, a line setting the page index was lost. Restore it, so that
    nfsd is functional when that path is used.

    Signed-off-by: Jens Axboe
    Signed-off-by: Linus Torvalds

    Jens Axboe
     

11 Jul, 2007

2 commits


10 Jul, 2007

2 commits