26 Jul, 2011

1 commit

  • * 'for-3.1' of git://linux-nfs.org/~bfields/linux:
    nfsd: don't break lease on CLAIM_DELEGATE_CUR
    locks: rename lock-manager ops
    nfsd4: update nfsv4.1 implementation notes
    nfsd: turn on reply cache for NFSv4
    nfsd4: call nfsd4_release_compoundargs from pc_release
    nfsd41: Deny new lock before RECLAIM_COMPLETE done
    fs: locks: remove init_once
    nfsd41: check the size of request
    nfsd41: error out when client sets maxreq_sz or maxresp_sz too small
    nfsd4: fix file leak on open_downgrade
    nfsd4: remember to put RW access on stateid destruction
    NFSD: Added TEST_STATEID operation
    NFSD: added FREE_STATEID operation
    svcrpc: fix list-corrupting race on nfsd shutdown
    rpc: allow autoloading of gss mechanisms
    svcauth_unix.c: quiet sparse noise
    svcsock.c: include sunrpc.h to quiet sparse noise
    nfsd: Remove deprecated nfsctl system call and related code.
    NFSD: allow OP_DESTROY_CLIENTID to be only op in COMPOUND

    Fix up trivial conflicts in Documentation/feature-removal-schedule.txt

    Linus Torvalds
     

24 Jul, 2011

1 commit

  • CLAIM_DELEGATE_CUR is used in response to a broken lease; allowing it
    to break the lease and return EAGAIN leaves the client unable to make
    progress in returning the delegation

    nfs4_get_vfs_file() now takes struct nfsd4_open for access to the
    claim type, and calls nfsd_open() with NFSD_MAY_NOT_BREAK_LEASE when
    claim type is CLAIM_DELEGATE_CUR

    Signed-off-by: Casey Bodley
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    Casey Bodley
     

21 Jul, 2011

1 commit

  • Both the filesystem and the lock manager can associate operations with a
    lock. Confusingly, one of them (fl_release_private) actually has the
    same name in both operation structures.

    It would save some confusion to give the lock-manager ops different
    names.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

20 Jul, 2011

1 commit


18 Jul, 2011

2 commits


16 Jul, 2011

9 commits

  • Before nfs41 client's RECLAIM_COMPLETE done, nfs server should deny any
    new locks or opens.

    rfc5661:

    " Whenever a client establishes a new client ID and before it does
    the first non-reclaim operation that obtains a lock, it MUST send a
    RECLAIM_COMPLETE with rca_one_fs set to FALSE, even if there are no
    locks to reclaim. If non-reclaim locking operations are done before
    the RECLAIM_COMPLETE, an NFS4ERR_GRACE error will be returned. "

    Signed-off-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • Check in SEQUENCE that the request doesn't exceed maxreq_sz for the
    given session.

    Signed-off-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • According to RFC5661, 18.36.3,

    "if the client selects a value for ca_maxresponsesize such that
    a replier on a channel could never send a response,the server
    SHOULD return NFS4ERR_TOOSMALL in the CREATE_SESSION reply."

    So, error out when the client sets a maxreq_sz less than the minimum
    possible SEQUENCE request size, or sets a maxresp_sz less than the
    minimum possible SEQUENCE reply size.

    Signed-off-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • Stateid's hold a read reference for a read open, a write reference for a
    write open, and an additional one of each for each read+write open. The
    latter wasn't getting put on a downgrade, so something like:

    open RW
    open R
    downgrade to R

    was resulting in a file leak.

    Also fix an imbalance in an error path.

    Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix
    downgrade/lock logic".

    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Without this, for example,

    open read
    open read+write
    close

    will result in a struct file leak.

    Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix
    downgrade/lock logic".

    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • This operation is used by the client to check the validity of a list of
    stateids.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: J. Bruce Fields

    Bryan Schumaker
     
  • This operation is used by the client to tell the server to free a
    stateid.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: J. Bruce Fields

    Bryan Schumaker
     
  • As promised in feature-removal-schedule.txt it is time to
    remove the nfsctl system call.

    Userspace has perferred to not use this call throughout 2.6 and it has been
    excluded in the default configuration since 2.6.36 (9 months ago).

    So this patch removes all the code that was being compiled out.

    There are still references to sys_nfsctl in various arch systemcall tables
    and related code. These should be cleaned out too, probably in the next
    merge window.

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

    NeilBrown
     
  • DESTROY_CLIENTID MAY be preceded with a SEQUENCE operation as long as
    the client ID derived from the session ID of SEQUENCE is not the same
    as the client ID to be destroyed. If the client IDs are the same,
    then the server MUST return NFS4ERR_CLIENTID_BUSY.

    (that's not implemented yet)

    If DESTROY_CLIENTID is not prefixed by SEQUENCE, it MUST be the only
    operation in the COMPOUND request (otherwise, the server MUST return
    NFS4ERR_NOT_ONLY_OP).

    This fixes the error return; before, we returned
    NFS4ERR_OP_NOT_IN_SESSION; after this patch, we return NFS4ERR_NOTSUPP.

    Signed-off-by: Benny Halevy
    Signed-off-by: J. Bruce Fields

    Benny Halevy
     

20 Jun, 2011

1 commit

  • Thanks to Casey Bodley for pointing out that on a read open we pass 0,
    instead of O_RDONLY, to break_lease, with the result that a read open is
    treated like a write open for the purposes of lease breaking!

    Reported-by: Casey Bodley
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

07 Jun, 2011

3 commits

  • fix for commit 4795bb37effb7b8fe77e2d2034545d062d3788a8, nfsd: break
    lease on unlink, link, and rename

    if the LINK operation breaks a delegation, it returns NFS4ERR_NOENT
    (which is not a valid error in rfc 5661) instead of NFS4ERR_DELAY.
    the return value of nfsd_break_lease() in nfsd_link() must be
    converted from host_err to err

    Signed-off-by: Casey Bodley
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    Casey Bodley
     
  • nfsd V4 support uses crypto interfaces, so select CRYPTO
    to fix build errors in 2.6.39:

    ERROR: "crypto_destroy_tfm" [fs/nfsd/nfsd.ko] undefined!
    ERROR: "crypto_alloc_base" [fs/nfsd/nfsd.ko] undefined!

    Reported-by: Wakko Warner
    Signed-off-by: Randy Dunlap
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    Randy Dunlap
     
  • Commit b0b0c0a26e84 "nfsd: add proc file listing kernel's gss_krb5
    enctypes" added an nunnecessary dependency of nfsd on the auth_rpcgss
    module.

    It's a little ad hoc, but since the only piece of information nfsd needs
    from rpcsec_gss_krb5 is a single static string, one solution is just to
    share it with an include file.

    Cc: stable@kernel.org
    Reported-by: Michael Guntsche
    Cc: Kevin Coffman
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

30 May, 2011

1 commit

  • * 'for-2.6.40' of git://linux-nfs.org/~bfields/linux: (22 commits)
    nfsd: make local functions static
    NFSD: Remove unused variable from nfsd4_decode_bind_conn_to_session()
    NFSD: Check status from nfsd4_map_bcts_dir()
    NFSD: Remove setting unused variable in nfsd_vfs_read()
    nfsd41: error out on repeated RECLAIM_COMPLETE
    nfsd41: compare request's opcnt with session's maxops at nfsd4_sequence
    nfsd v4.1 lOCKT clientid field must be ignored
    nfsd41: add flag checking for create_session
    nfsd41: make sure nfs server process OPEN with EXCLUSIVE4_1 correctly
    nfsd4: fix wrongsec handling for PUTFH + op cases
    nfsd4: make fh_verify responsibility of nfsd_lookup_dentry caller
    nfsd4: introduce OPDESC helper
    nfsd4: allow fh_verify caller to skip pseudoflavor checks
    nfsd: distinguish functions of NFSD_MAY_* flags
    svcrpc: complete svsk processing on cb receive failure
    svcrpc: take advantage of tcp autotuning
    SUNRPC: Don't wait for full record to receive tcp data
    svcrpc: copy cb reply instead of pages
    svcrpc: close connection if client sends short packet
    svcrpc: note network-order types in svc_process_calldir
    ...

    Linus Torvalds
     

19 May, 2011

1 commit


10 May, 2011

1 commit


30 Apr, 2011

9 commits

  • Compiling gave me this warning:
    fs/nfsd/nfs4xdr.c: In function ‘nfsd4_decode_bind_conn_to_session’:
    fs/nfsd/nfs4xdr.c:427:6: warning: variable ‘dummy’ set but not used
    [-Wunused-but-set-variable]

    The local variable "dummy" wasn't being used past the READ32() macro that
    set it. READ_BUF() should ensure that the xdr buffer is pushed past the
    data read into dummy already, so nothing needs to be read in.

    Signed-off-by: Bryan Schumaker
    [bfields@redhat.com: minor comment fixup.]
    Signed-off-by: J. Bruce Fields

    Bryan Schumaker
     
  • Compiling gave me this warning:
    fs/nfsd/nfs4state.c: In function ‘nfsd4_bind_conn_to_session’:
    fs/nfsd/nfs4state.c:1623:9: warning: variable ‘status’ set but not used
    [-Wunused-but-set-variable]

    The local variable "status" was being set by nfsd4_map_bcts_dir() and
    then ignored before calling nfsd4_new_conn().

    Signed-off-by: Bryan Schumaker
    Signed-off-by: J. Bruce Fields

    Bryan Schumaker
     
  • Compiling gave me this warning:
    fs/nfsd/vfs.c: In function ‘nfsd_vfs_read’:
    fs/nfsd/vfs.c:880:16: warning: variable ‘inode’ set but not used
    [-Wunused-but-set-variable]

    I discovered that a local variable "inode" was being set towards the
    beginning of nfsd_vfs_read() and then ignored for the rest of the
    function.

    Signed-off-by: Bryan Schumaker
    Signed-off-by: J. Bruce Fields

    Bryan Schumaker
     
  • Servers are supposed to return nfserr_complete_already to clients that
    attempt to send multiple RECLAIM_COMPLETEs.

    Signed-off-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • Make sure nfs server errors out if request contains more ops
    than channel allows.

    Signed-off-by: Mi Jinlong
    [bfields@redhat.com: use helper function]
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • RFC 5661 Section 18.11.3

    The clientid field of the owner MAY be set to any value by the client
    and MUST be ignored by the server. The reason the server MUST ignore
    the clientid field is that the server MUST derive the client ID from
    the session ID from the SEQUENCE operation of the COMPOUND request.

    Signed-off-by: Andy Adamson
    Signed-off-by: J. Bruce Fields

    Andy Adamson
     
  • Teach the NFS server to reject invalid create_session flags.

    Also do some minor formatting adjustments.

    Signed-off-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • The NFS server uses nfsd_create_v3 to handle EXCLUSIVE4_1 opens, but
    that function is not prepared to handle them.

    Rename nfsd_create_v3() to do_nfsd_create(), and add handling of
    EXCLUSIVE4_1.

    Signed-off-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    Mi Jinlong
     
  • When PUTFH is followed by an operation that uses the filehandle, and
    when the current client is using a security flavor that is inconsistent
    with the given filehandle, we have a choice: we can return WRONGSEC
    either when the current filehandle is set using the PUTFH, or when the
    filehandle is first used by the following operation.

    Follow the recommendations of RFC 5661 in making this choice.

    (Our current behavior prevented the client from doing security
    negotiation by returning WRONGSEC on PUTFH+SECINFO_NO_NAME.)

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

20 Apr, 2011

2 commits

  • An open on a NFS4 share using the O_CREAT flag on an existing file for
    which we have permissions to open but contained in a directory with no
    write permissions will fail with EACCES.

    A tcpdump shows that the client had set the open mode to UNCHECKED which
    indicates that the file should be created if it doesn't exist and
    encountering an existing flag is not an error. Since in this case the
    file exists and can be opened by the user, the NFS server is wrong in
    attempting to check create permissions on the parent directory.

    The patch adds a conditional statement to check for create permissions
    only if the file doesn't exist.

    Signed-off-by: Sachin S. Prabhu
    Signed-off-by: J. Bruce Fields

    Sachin Prabhu
     
  • 23fcf2ec93fb8573a653408316af599939ff9a8e (nfsd4: fix oops on lock failure)

    The above patch breaks free path for stp->st_file. If stp was inserted
    into sop->so_stateids, we have to free stp->st_file refcount. Because
    stp->st_file refcount itself is taken whether or not any refcounts are
    taken on the stp->st_file->fi_fds[].

    Signed-off-by: OGAWA Hirofumi
    Cc: stable@kernel.org
    Signed-off-by: J. Bruce Fields

    OGAWA Hirofumi
     

19 Apr, 2011

1 commit


12 Apr, 2011

1 commit


11 Apr, 2011

5 commits

  • The secinfo caller actually won't want this.

    Signed-off-by: J. Bruce Fields

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

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

    J. Bruce Fields
     
  • Most of the NFSD_MAY_* flags actually request permissions, but over the
    years we've accreted a few that modify the behavior of the permission or
    open code in other ways.

    Distinguish the two cases a little more. In particular, allow the
    shortcut at the start of nfsd_permission to ignore the
    non-permission-requesting bits.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • Lock stateid's can have access_bmap 0 if they were only partially
    initialized (due to a failed lock request); handle that case in
    free_generic_stateid.

    ------------[ cut here ]------------
    kernel BUG at fs/nfsd/nfs4state.c:380!
    invalid opcode: 0000 [#1] SMP
    last sysfs file: /sys/kernel/mm/ksm/run
    Modules linked in: nfs fscache md4 nls_utf8 cifs ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat bridge stp llc nfsd lockd nfs_acl auth_rpcgss sunrpc ipv6 ppdev parport_pc parport pcnet32 mii pcspkr microcode i2c_piix4 BusLogic floppy [last unloaded: mperf]

    Pid: 1468, comm: nfsd Not tainted 2.6.38+ #120 VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform
    EIP: 0060:[] EFLAGS: 00010297 CPU: 0
    EIP is at nfs4_access_to_omode+0x1c/0x29 [nfsd]
    EAX: ffffffff EBX: dd758120 ECX: 00000000 EDX: 00000004
    ESI: dd758120 EDI: ddfe657c EBP: dd54dde0 ESP: dd54dde0
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    Process nfsd (pid: 1468, ti=dd54c000 task=ddc92580 task.ti=dd54c000)
    Stack:
    dd54ddf0 e24f19ca 00000000 ddfe6560 dd54de08 e24f1a5d dd758130 deee3a20
    ddfe6560 31270000 dd54df1c e24f52fd 0000000f dd758090 e2505dd0 0be304cf
    dbb51d68 0000000e ddfe657c ddcd8020 dd758130 dd758128 dd7580d8 dd54de68
    Call Trace:
    [] free_generic_stateid+0x1c/0x3e [nfsd]
    [] release_lockowner+0x71/0x8a [nfsd]
    [] nfsd4_lock+0x617/0x66c [nfsd]
    [] ? nfsd_setuser+0x199/0x1bb [nfsd]
    [] ? nfsd_setuser_and_check_port+0x65/0x81 [nfsd]
    [] ? _cond_resched+0x8/0x1c
    [] ? slab_pre_alloc_hook.clone.33+0x23/0x27
    [] ? kmem_cache_alloc+0x1a/0xd2
    [] ? __call_rcu+0xd7/0xdd
    [] ? fh_verify+0x401/0x452 [nfsd]
    [] ? nfsd4_encode_operation+0x52/0x117 [nfsd]
    [] ? nfsd4_putfh+0x33/0x3b [nfsd]
    [] ? nfsd4_delegreturn+0xd4/0xd4 [nfsd]
    [] nfsd4_proc_compound+0x1ea/0x33e [nfsd]
    [] nfsd_dispatch+0xd1/0x1a5 [nfsd]
    [] svc_process_common+0x282/0x46f [sunrpc]
    [] svc_process+0xdc/0xfa [sunrpc]
    [] nfsd+0xd6/0x115 [nfsd]
    [] ? nfsd_shutdown+0x24/0x24 [nfsd]
    [] kthread+0x62/0x67
    [] ? kthread_worker_fn+0x114/0x114
    [] kernel_thread_helper+0x6/0x10
    Code: eb 05 b8 00 00 27 4f 8d 65 f4 5b 5e 5f 5d c3 83 e0 03 55 83 f8 02 89 e5 74 17 83 f8 03 74 05 48 75 09 eb 09 b8 02 00 00 00 eb 0b 0b 31 c0 eb 05 b8 01 00 00 00 5d c3 55 89 e5 57 56 89 d6 8d
    EIP: [] nfs4_access_to_omode+0x1c/0x29 [nfsd] SS:ESP 0068:dd54dde0
    ---[ end trace 2b0bf6c6557cb284 ]---

    The trace route is:

    -> nfsd4_lock()
    -> if (lock->lk_is_new) {
    -> alloc_init_lock_stateid()

    3739: stp->st_access_bmap = 0;

    ->if (status && lock->lk_is_new && lock_sop)
    -> release_lockowner()
    -> free_generic_stateid()
    -> nfs4_access_bmap_to_omode()
    -> nfs4_access_to_omode()

    380: BUG(); *****

    This problem was introduced by 0997b173609b9229ece28941c118a2a9b278796e.

    Reported-by: Mi Jinlong
    Tested-by: Mi Jinlong
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields