26 Apr, 2008

9 commits

  • * git://git.infradead.org/mtd-2.6: (82 commits)
    [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash
    [MTD] m25p80: add FAST_READ access support to M25Pxx
    [MTD] [NAND] bf5xx_nand: Avoid crash if bfin_mac is installed.
    [MTD] [NAND] at91_nand: control NCE signal
    [MTD] [NAND] AT91 hardware ECC compile fix for at91sam9263 / at91sam9260
    [MTD] [NAND] Hardware ECC controller on at91sam9263 / at91sam9260
    [JFFS2] Introduce dbg_readinode2 log level, use it to shut read_dnode() up
    [JFFS2] Fix jffs2_reserve_space() when all blocks are pending erasure.
    [JFFS2] Add erase_checking_list to hold blocks being marked.
    UBI: add a message
    [JFFS2] Return values of jffs2_block_check_erase error paths
    [MTD] Clean up AR7 partition map support
    [MTD] [NOR] Fix Intel CFI driver for collie flash
    [JFFS2] Finally remove redundant ref->__totlen field.
    [JFFS2] Honour TEST_TOTLEN macro in debugging code. ref->__totlen is going!
    [JFFS2] Add paranoia debugging for superblock counts
    [JFFS2] Fix free space leak with in-band cleanmarkers
    [JFFS2] Self-sufficient #includes in jffs2_fs_i.h: include
    [MTD] [NAND] Verify probe by retrying to checking the results match
    [MTD] [NAND] S3C2410 Allow ECC disable to be specified by the board
    ...

    Linus Torvalds
     
  • Presumably this is left over from earlier drafts of v4, which listed
    TIME_METADATA as writeable. It's read-only in rfc 3530, and shouldn't
    be modifiable anyway.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • The file_lock structure is used both as a heavy-weight representation of
    an active lock, with pointers to reference-counted structures, etc., and
    as a simple container for parameters that describe a file lock.

    The conflicting lock returned from __posix_lock_file is an example of
    the latter; so don't call the filesystem or lock manager callbacks when
    copying to it. This also saves the need for an unnecessary
    locks_init_lock in the nfsv4 server.

    Thanks to Trond for pointing out the error.

    Signed-off-by: J. Bruce Fields
    Cc: Trond Myklebust

    J. Bruce Fields
     
  • Add /proc/fs/nfsd/unlock_filesystem, which allows e.g.:

    shell> echo /mnt/sfs1 > /proc/fs/nfsd/unlock_filesystem

    so that a filesystem can be unmounted before allowing a peer nfsd to
    take over nfs service for the filesystem.

    Signed-off-by: S. Wendy Cheng
    Cc: Lon Hohberger
    Cc: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    fs/lockd/svcsubs.c | 66 +++++++++++++++++++++++++++++++++++++++-----
    fs/nfsd/nfsctl.c | 65 +++++++++++++++++++++++++++++++++++++++++++
    include/linux/lockd/lockd.h | 7 ++++
    3 files changed, 131 insertions(+), 7 deletions(-)

    Wendy Cheng
     
  • For high-availability NFS service, we generally need to be able to drop
    file locks held on the exported filesystem before moving clients to a
    new server. Currently the only way to do that is by shutting down lockd
    entirely, which is often undesireable (for example, if you want to
    continue exporting other filesystems).

    This patch allows the administrator to release all locks held by clients
    accessing the client through a given server ip address, by echoing that
    address to a new file, /proc/fs/nfsd/unlock_ip, as in:

    shell> echo 10.1.1.2 > /proc/fs/nfsd/unlock_ip

    The expected sequence of events can be:
    1. Tear down the IP address
    2. Unexport the path
    3. Write IP to /proc/fs/nfsd/unlock_ip to unlock files
    4. Signal peer to begin take-over.

    For now we only support IPv4 addresses and NFSv2/v3 (NFSv4 locks are not
    affected).

    Also, if unmounting the filesystem is required, we assume at step 3 that
    clients using the given server ip are the only clients holding locks on
    the given filesystem; otherwise, an additional patch is required to
    allow revoking all locks held by lockd on a given filesystem.

    Signed-off-by: S. Wendy Cheng
    Cc: Lon Hohberger
    Cc: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    fs/lockd/svcsubs.c | 66 +++++++++++++++++++++++++++++++++++++++-----
    fs/nfsd/nfsctl.c | 65 +++++++++++++++++++++++++++++++++++++++++++
    include/linux/lockd/lockd.h | 7 ++++
    3 files changed, 131 insertions(+), 7 deletions(-)

    Wendy Cheng
     
  • fcntl_setlease() has a struct dentry* that is used only once; this patch
    removes it.

    Signed-off-by: David M. Richter
    Signed-off-by: J. Bruce Fields

    David M. Richter
     
  • In generic_setlease(), the struct file_lock is allocated after tests for the
    presence of conflicting readers/writers is done, despite the fact that the
    allocation might block; this patch moves the allocation earlier. A subsequent
    set of patches will rely on this behavior to properly serialize between a
    modified __break_lease() and generic_setlease().

    Signed-off-by: David M. Richter
    Signed-off-by: J. Bruce Fields

    David M. Richter
     
  • In generic_setlease(), we don't need to allocate a new struct file_lock
    or check for readers or writers when called with F_UNLCK.

    Signed-off-by: David M. Richter
    Signed-off-by: J. Bruce Fields

    David M. Richter
     
  • Fixes a return-value mixup from 85c59580b30c82aa771aa33b37217a6b6851bc14
    "locks: Fix potential OOPS in generic_setlease()", in which -ENOMEM replaced
    what had been intended to stay -EAGAIN in the variable "error".

    Signed-off-by: David M. Richter
    Signed-off-by: J. Bruce Fields

    David M. Richter
     

25 Apr, 2008

5 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    [CIFS] Fix typo in previous commit
    [CIFS] Fix define for new proxy cap to match documentation
    [CIFS] Fix UNC path prefix on QueryUnixPathInfo to have correct slash
    [CIFS] Reserve new proxy cap for WAFS
    [CIFS] Add various missing flags and defintions
    [CIFS] make cifs_dfs_automount_list_static
    [CIFS] Fix oops when slow oplock process races with unmount
    [CIFS] Fix acl length when very short ACL being modified by chmod
    [CIFS] Fix looping on reconnect to Samba when unexpected tree connect fail on reconnect
    [CIFS] minor update to change log

    Linus Torvalds
     
  • * git://git.linux-nfs.org/projects/trondmy/nfs-2.6: (80 commits)
    SUNRPC: Invalidate the RPCSEC_GSS session if the server dropped the request
    make nfs_automount_list static
    NFS: remove duplicate flags assignment from nfs_validate_mount_data
    NFS - fix potential NULL pointer dereference v2
    SUNRPC: Don't change the RPCSEC_GSS context on a credential that is in use
    SUNRPC: Fix a race in gss_refresh_upcall()
    SUNRPC: Don't disconnect more than once if retransmitting NFSv4 requests
    SUNRPC: Remove the unused export of xprt_force_disconnect
    SUNRPC: remove XS_SENDMSG_RETRY
    SUNRPC: Protect creds against early garbage collection
    NFSv4: Attempt to use machine credentials in SETCLIENTID calls
    NFSv4: Reintroduce machine creds
    NFSv4: Don't use cred->cr_ops->cr_name in nfs4_proc_setclientid()
    nfs: fix printout of multiword bitfields
    nfs: return negative error value from nfs{,4}_stat_to_errno
    NLM/lockd: Ensure client locking calls use correct credentials
    NFS: Remove the buggy lock-if-signalled case from do_setlk()
    NLM/lockd: Fix a race when cancelling a blocking lock
    NLM/lockd: Ensure that nlmclnt_cancel() returns results of the CANCEL call
    NLM: Remove the signal masking in nlmclnt_proc/nlmclnt_cancel
    ...

    Linus Torvalds
     
  • Trond Myklebust
     
  • Signed-off-by: Steve French

    Steve French
     
  • The transport encryption capability and new SetFSInfo level were missing, and the
    new proxy capability (which Samba server is implementing) and proxy setfsinfo needed
    to be moved down to not collide with Samba's transport encryption capability.

    CC: Jeremy Allison
    CC: Sam Liddicott
    Signed-off-by: Steve French

    Steve French
     

24 Apr, 2008

26 commits

  • Steve French
     
  • Currently, knfsd only clears the setuid bit if the owner of a file is
    changed on a SETATTR call, and only clears the setgid bit if the group
    is changed. POSIX says this in the spec for chown():

    "If the specified file is a regular file, one or more of the
    S_IXUSR, S_IXGRP, or S_IXOTH bits of the file mode are set, and the
    process does not have appropriate privileges, the set-user-ID
    (S_ISUID) and set-group-ID (S_ISGID) bits of the file mode shall
    be cleared upon successful return from chown()."

    If I'm reading this correctly, then knfsd is doing this wrong. It should
    be clearing both the setuid and setgid bit on any SETATTR that changes
    the uid or gid. This wasn't really as noticable before, but now that the
    ATTR_KILL_S*ID bits are a no-op for the NFS client, it's more evident.

    This patch corrects the nfsd_setattr logic so that this occurs. It also
    does a bit of cleanup to the function.

    There is also one small behavioral change. If a SETATTR call comes in
    that changes the uid/gid and the mode, then we now only clear the setgid
    bit if the group execute bit isn't set. The setgid bit without a group
    execute bit signifies mandatory locking and we likely don't want to
    clear the bit in that case. Since there is no call in POSIX that should
    generate a SETATTR call like this, then this should rarely happen, but
    it's worth noting.

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

    Jeff Layton
     
  • ...it's not really needed.

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

    Jeff Layton
     
  • When svc_recv returns an unexpected error, lockd 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 can lead to a
    potential BUG() call.

    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
     
  • 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
     
  • There's no need to dynamically allocate this memory, and doing so may
    create the possibility of races on shutdown of the rpc client. (We've
    witnessed it only after adding rpcsec_gss support to the server, after
    which the rpc code can send destroys calls that expect to still be able
    to access the rpc_stats structure after it has been destroyed.)

    Such races are in theory possible if the module containing this "static"
    memory is removed very quickly after an rpc client is destroyed, but
    we haven't seen that happen.

    Signed-off-by: J. Bruce Fields

    Olga Kornievskaia
     
  • Obvious comment nit.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • As of 5996a298da43a03081e9ba2116983d173001c862 ("NLM: don't unlock on
    cancel requests") we no longer unlock in this case, so the comment is no
    longer accurate.

    Thanks to Stuart Friedberg for pointing out the inconsistency.

    Cc: Stuart Friedberg
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Clean up: Because NFSD_V4 "depends on" NFSD_V3, it appears as a child of
    the NFSD_V3 menu entry, and is not visible if NFSD_V3 is unselected.

    Replace the dependency on NFSD_V3 with a "select NFSD_V3". This makes
    NFSD_V4 look and work just like NFS_V3, while ensuring that NFSD_V3 is
    enabled if NFSD_V4 is.

    Sam Ravnborg adds:

    "This use of select is questionable. In general it is bad to select
    a symbol with dependencies.

    In this case the dependencies of NFSD_V3 are duplicated for NFSD_V4
    so we will not se erratic configurations but do you remember to
    update NFSD_V4 when you add a depends on NFSD_V3?

    But I see no other clean way to do it right now."

    Later he said:

    "My comment was more to say we have things to address in kconfig.
    This is abuse in the acceptable range."

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

    Chuck Lever
     
  • Recently, commit 440bcc59 added a reverse dependency to fs/Kconfig to
    ensure that PROC_FS was enabled if SUNRPC_GSS was enabled.

    Apparently this isn't necessary because the auth_gss components under
    net/sunrpc will build correctly even if PROC_FS is disabled, though
    RPCSEC_GSS will not work without /proc.

    It also violates the guideline in Documentation/kbuild/kconfig-language.txt
    that states "In general use select only for non-visible symbols (no prompts
    anywhere) and for symbols with no dependencies."

    To address these issues, remove the dependency.

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

    Chuck Lever
     
  • Recently, commit 440bcc59 added a reverse dependency to fs/Kconfig to
    ensure that PROC_FS was enabled if NFSD_V4 was enabled.

    There is a guideline in Documentation/kbuild/kconfig-language.txt that
    states "In general use select only for non-visible symbols (no prompts
    anywhere) and for symbols with no dependencies."

    A quick grep around other Kconfig files reveals that no entry currently
    uses "select PROC_FS" -- every one uses "depends on". Thus CONFIG_NFSD_V4
    should use "depends on PROC_FS" as well.

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

    Chuck Lever
     
  • Move the code that actually parses the filehandle and looks up the
    dentry and export to a separate function. This simplifies the reference
    counting a little and moves fh_verify() a little closer to the kernel
    ideal of small, minimally-indentended functions. Clean up a few other
    minor style sins along the way.

    Signed-off-by: J. Bruce Fields
    Cc: Neil Brown

    J. Bruce Fields
     
  • While lease is correctly checked by supplying the type argument to
    vfs_setlease(), it's stored with fl_type uninitialized. This breaks the
    logic when checking the type of the lease. The fix is to initialize
    fl_type.

    The old code still happened to function correctly since F_RDLCK is zero,
    and we only implement read delegations currently (nor write
    delegations). But that's no excuse for not fixing this.

    Signed-off-by: Felix Blyakher
    Signed-off-by: J. Bruce Fields

    Felix Blyakher
     
  • 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
     
  • fs/nfsd/vfs.c:991:27: warning: Using plain integer as NULL pointer

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

    Harvey Harrison
     
  • Add extern to nfsd/nfsd.h
    fs/nfsd/nfssvc.c:146:5: warning: symbol 'nfsd_nrthreads' was not declared. Should it be static?
    fs/nfsd/nfssvc.c:261:5: warning: symbol 'nfsd_nrpools' was not declared. Should it be static?
    fs/nfsd/nfssvc.c:269:5: warning: symbol 'nfsd_get_nrthreads' was not declared. Should it be static?
    fs/nfsd/nfssvc.c:281:5: warning: symbol 'nfsd_set_nrthreads' was not declared. Should it be static?
    fs/nfsd/export.c:1534:23: warning: symbol 'nfs_exports_op' was not declared. Should it be static?

    Add include of auth.h
    fs/nfsd/auth.c:27:5: warning: symbol 'nfsd_setuser' was not declared. Should it be static?

    Make static, move forward declaration closer to where it's needed.
    fs/nfsd/nfs4state.c:1877:1: warning: symbol 'laundromat_main' was not declared. Should it be static?

    Make static, forward declaration was already marked static.
    fs/nfsd/nfs4idmap.c:206:1: warning: symbol 'idtoname_parse' was not declared. Should it be static?
    fs/nfsd/vfs.c:1156:1: warning: symbol 'nfsd_create_setattr' was not declared. Should it be static?

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

    Harvey Harrison
     
  • There's no reason for a mutex here, except to allow an allocation under
    the lock, which we can avoid with the usual trick of preallocating
    memory for the new object and freeing it if it turns out to be
    unnecessary.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Use list_for_each_entry(). Also, in keeping with kernel style, make the
    normal case (kzalloc succeeds) unindented and handle the abnormal case
    with a goto.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • The sm_count is decremented to zero but left on the nsm_handles list.
    So in the space between decrementing sm_count and acquiring nsm_mutex,
    it is possible for another task to find this nsm_handle, increment the
    use count and then enter nsm_release itself.

    Thus there's nothing to prevent the nsm being freed before we acquire
    nsm_mutex here.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • fs/lockd/svcshare.c:74:50: warning: Using plain integer as NULL pointer

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

    Harvey Harrison
     
  • This patch makes the needlessly global nfsd_create_setattr() static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: J. Bruce Fields

    Adrian Bunk
     
  • As far as I can tell, selecting the CRYPTO and CRYPTO_MD5 entries under
    CONFIG_NFSD is redundant, since CONFIG_NFSD_V4 already selects
    RPCSEC_GSS_KRB5, which selects these entries.

    Testing with "make menuconfig" shows that the entries under CRYPTO still
    properly reflect "Y" or "M" based on the setting of CONFIG_NFSD after this
    change is applied.

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

    Chuck Lever
     
  • Clean up: since NFSD_V2_ACL is a boolean, it can be selected safely
    under the NFSD_V3_ACL entry (also a boolean).

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

    Chuck Lever
     
  • Clean up: since FS_POSIX_ACL is a non-visible boolean entry, it can be
    selected safely under the NFSD_V4 entry (also a boolean).

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

    Chuck Lever
     
  • Clean up: refresh the help text for Kconfig items related to the NFS
    server. Remove obsolete URLs, and make the language consistent among
    the options.

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

    Chuck Lever
     
  • Likewise, distros usually leave CONFIG_NFSD_TCP enabled.

    TCP support in the Linux NFS server is stable enough that we can leave it
    on always. CONFIG_NFSD_TCP adds about 10 lines of code, and defaults to
    "Y" anyway.

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

    Chuck Lever