26 Apr, 2008

2 commits


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

33 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
     
  • The code here is difficult to understand; attempt to clarify somewhat by
    pulling out one of the more mystifying conditionals into a separate
    function.

    While we're here, also add lease_time to the list of attributes that we
    don't really need to cross a mountpoint to fetch.

    Signed-off-by: J. Bruce Fields
    Cc: Peter Staubach

    J. Bruce Fields
     
  • This condition is always true.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Pull this common code into a separate function.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Every caller sets this flag, so it's meaningless.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Thanks to Robert Day for pointing out that these two defines are unused.

    Signed-off-by: J. Bruce Fields
    Cc: Trond Myklebust Trond Myklebust
    Cc: Neil Brown
    Cc: "Robert P. J. Day"

    J. Bruce Fields
     
  • This adds IPv6 support to the interfaces that are used to express nfsd
    exports. All addressed are stored internally as IPv6; backwards
    compatibility is maintained using mapped addresses.

    Thanks to Bruce Fields, Brian Haley, Neil Brown and Hideaki Joshifuji
    for comments

    Signed-off-by: Aurelien Charbon
    Cc: Neil Brown
    Cc: Brian Haley
    Cc: YOSHIFUJI Hideaki / 吉藤英明
    Signed-off-by: J. Bruce Fields

    Aurélien Charbon
     
  • Have lockd_up start lockd using kthread_run. With this change,
    lockd_down now blocks until lockd actually exits, so there's no longer
    need for the waitqueue code at the end of lockd_down. This also means
    that only one lockd can be running at a time which simplifies the code
    within lockd's main loop.

    This also adds a check for kthread_should_stop in the main loop of
    nlmsvc_retry_blocked and after that function returns. There's no sense
    continuing to retry blocks if lockd is coming down anyway.

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

    Jeff Layton