07 Dec, 2014

3 commits

  • commit 1b19453d1c6abcfa7c312ba6c9f11a277568fc94 upstream.

    Currently, the DRC cache pruner will stop scanning the list when it
    hits an entry that is RC_INPROG. It's possible however for a call to
    take a *very* long time. In that case, we don't want it to block other
    entries from being pruned if they are expired or we need to trim the
    cache to get back under the limit.

    Fix the DRC cache pruner to just ignore RC_INPROG entries.

    Signed-off-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Cc: Joseph Salisbury
    Signed-off-by: Greg Kroah-Hartman

    Jeff Layton
     
  • commit c6c15e1ed303ffc47e696ea1c9a9df1761c1f603 upstream.

    The currect code for nfsd41_cb_get_slot() and nfsd4_cb_done() has no
    locking in order to guarantee atomicity, and so allows for races of
    the form.

    Task 1 Task 2
    ====== ======
    if (test_and_set_bit(0) != 0) {
    clear_bit(0)
    rpc_wake_up_next(queue)
    rpc_sleep_on(queue)
    return false;
    }

    This patch breaks the race condition by adding a retest of the bit
    after the call to rpc_sleep_on().

    Signed-off-by: Trond Myklebust
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 6d0ba0432a5e10bc714ba9c5adc460e726e5fbb4 upstream.

    Even when security labels are disabled we support at least the same
    attributes as v4.1.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Christoph Hellwig
     

15 Nov, 2014

1 commit

  • commit 51904b08072a8bf2b9ed74d1bd7a5300a614471d upstream.

    Unknown operation numbers are caught in nfsd4_decode_compound() which
    sets op->opnum to OP_ILLEGAL and op->status to nfserr_op_illegal. The
    error causes the main loop in nfsd4_proc_compound() to skip most
    processing. But nfsd4_proc_compound also peeks ahead at the next
    operation in one case and doesn't take similar precautions there.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     

06 Sep, 2014

2 commits

  • commit 3c45ddf823d679a820adddd53b52c6699c9a05ac upstream.

    The current code always selects XPRT_TRANSPORT_BC_TCP for the back
    channel, even when the forward channel was not TCP (eg, RDMA). When
    a 4.1 mount is attempted with RDMA, the server panics in the TCP BC
    code when trying to send CB_NULL.

    Instead, construct the transport protocol number from the forward
    channel transport or'd with XPRT_TRANSPORT_BC. Transports that do
    not support bi-directional RPC will not have registered a "BC"
    transport, causing create_backchannel_client() to fail immediately.

    Fixes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=265
    Signed-off-by: Chuck Lever
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Chuck Lever
     
  • commit d9499a95716db0d4bc9b67e88fd162133e7d6b08 upstream.

    A memory allocation failure could cause nfsd_startup_generic to fail, in
    which case nfsd_users wouldn't be incorrectly left elevated.

    After nfsd restarts nfsd_startup_generic will then succeed without doing
    anything--the first consequence is likely nfs4_start_net finding a bad
    laundry_wq and crashing.

    Signed-off-by: Kinglong Mee
    Fixes: 4539f14981ce "nfsd: replace boolean nfsd_up flag by users counter"
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Kinglong Mee
     

10 Jul, 2014

1 commit

  • commit 76f47128f9b33af1e96819746550d789054c9664 upstream.

    An NFS operation that creates a new symlink includes the symlink data,
    which is xdr-encoded as a length followed by the data plus 0 to 3 bytes
    of zero-padding as required to reach a 4-byte boundary.

    The vfs, on the other hand, wants null-terminated data.

    The simple way to handle this would be by copying the data into a newly
    allocated buffer with space for the final null.

    The current nfsd_symlink code tries to be more clever by skipping that
    step in the (likely) case where the byte following the string is already
    0.

    But that assumes that the byte following the string is ours to look at.
    In fact, it might be the first byte of a page that we can't read, or of
    some object that another task might modify.

    Worse, the NFSv4 code tries to fix the problem by actually writing to
    that byte.

    In the NFSv2/v3 cases this actually appears to be safe:

    - nfs3svc_decode_symlinkargs explicitly null-terminates the data
    (after first checking its length and copying it to a new
    page).
    - NFSv2 limits symlinks to 1k. The buffer holding the rpc
    request is always at least a page, and the link data (and
    previous fields) have maximum lengths that prevent the request
    from reaching the end of a page.

    In the NFSv4 case the CREATE op is potentially just one part of a long
    compound so can end up on the end of a page if you're unlucky.

    The minimal fix here is to copy and null-terminate in the NFSv4 case.
    The nfsd_symlink() interface here seems too fragile, though. It should
    really either do the copy itself every time or just require a
    null-terminated string.

    Reported-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     

07 Jul, 2014

2 commits


08 Jun, 2014

5 commits

  • commit a1b8ff4c97b4375d21b6d6c45d75877303f61b3b upstream.

    The nfsv4 state code has always assumed a one-to-one correspondance
    between lock stateid's and lockowners even if it appears not to in some
    places.

    We may actually change that, but for now when FREE_STATEID releases a
    lock stateid it also needs to release the parent lockowner.

    Symptoms were a subsequent LOCK crashing in find_lockowner_str when it
    calls same_lockowner_ino on a lockowner that unexpectedly has an empty
    so_stateids list.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit 27b11428b7de097c42f205beabb1764f4365443b upstream.

    The current code assumes a one-to-one lockownerlock stateid
    correspondance.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit aa07c713ecfc0522916f3cd57ac628ea6127c0ec upstream.

    After setting ACL for directory, I got two problems that caused
    by the cached zero-length default posix acl.

    This patch make sure nfsd4_set_nfs4_acl calls ->set_acl
    with a NULL ACL structure if there are no entries.

    Thanks for Christoph Hellwig's advice.

    First problem:
    ............ hang ...........

    Second problem:
    [ 1610.167668] ------------[ cut here ]------------
    [ 1610.168320] kernel BUG at /root/nfs/linux/fs/nfsd/nfs4acl.c:239!
    [ 1610.168320] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC
    [ 1610.168320] Modules linked in: nfsv4(OE) nfs(OE) nfsd(OE)
    rpcsec_gss_krb5 fscache ip6t_rpfilter ip6t_REJECT cfg80211 xt_conntrack
    rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables
    ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6
    ip6table_mangle ip6table_security ip6table_raw ip6table_filter
    ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4
    nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw
    auth_rpcgss nfs_acl snd_intel8x0 ppdev lockd snd_ac97_codec ac97_bus
    snd_pcm snd_timer e1000 pcspkr parport_pc snd parport serio_raw joydev
    i2c_piix4 sunrpc(OE) microcode soundcore i2c_core ata_generic pata_acpi
    [last unloaded: nfsd]
    [ 1610.168320] CPU: 0 PID: 27397 Comm: nfsd Tainted: G OE
    3.15.0-rc1+ #15
    [ 1610.168320] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
    VirtualBox 12/01/2006
    [ 1610.168320] task: ffff88005ab653d0 ti: ffff88005a944000 task.ti:
    ffff88005a944000
    [ 1610.168320] RIP: 0010:[] []
    _posix_to_nfsv4_one+0x3cd/0x3d0 [nfsd]
    [ 1610.168320] RSP: 0018:ffff88005a945b00 EFLAGS: 00010293
    [ 1610.168320] RAX: 0000000000000001 RBX: ffff88006700bac0 RCX:
    0000000000000000
    [ 1610.168320] RDX: 0000000000000000 RSI: ffff880067c83f00 RDI:
    ffff880068233300
    [ 1610.168320] RBP: ffff88005a945b48 R08: ffffffff81c64830 R09:
    0000000000000000
    [ 1610.168320] R10: ffff88004ea85be0 R11: 000000000000f475 R12:
    ffff880068233300
    [ 1610.168320] R13: 0000000000000003 R14: 0000000000000002 R15:
    ffff880068233300
    [ 1610.168320] FS: 0000000000000000(0000) GS:ffff880077800000(0000)
    knlGS:0000000000000000
    [ 1610.168320] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 1610.168320] CR2: 00007f5bcbd3b0b9 CR3: 0000000001c0f000 CR4:
    00000000000006f0
    [ 1610.168320] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
    0000000000000000
    [ 1610.168320] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
    0000000000000400
    [ 1610.168320] Stack:
    [ 1610.168320] ffffffff00000000 0000000b67c83500 000000076700bac0
    0000000000000000
    [ 1610.168320] ffff88006700bac0 ffff880068233300 ffff88005a945c08
    0000000000000002
    [ 1610.168320] 0000000000000000 ffff88005a945b88 ffffffffa034e2d5
    000000065a945b68
    [ 1610.168320] Call Trace:
    [ 1610.168320] [] nfsd4_get_nfs4_acl+0x95/0x150 [nfsd]
    [ 1610.168320] [] nfsd4_encode_fattr+0x646/0x1e70 [nfsd]
    [ 1610.168320] [] ? kmemleak_alloc+0x4e/0xb0
    [ 1610.168320] [] ?
    nfsd_setuser_and_check_port+0x52/0x80 [nfsd]
    [ 1610.168320] [] ? selinux_cred_prepare+0x1b/0x30
    [ 1610.168320] [] nfsd4_encode_getattr+0x5a/0x60 [nfsd]
    [ 1610.168320] [] nfsd4_encode_operation+0x67/0x110
    [nfsd]
    [ 1610.168320] [] nfsd4_proc_compound+0x21d/0x810 [nfsd]
    [ 1610.168320] [] nfsd_dispatch+0xbb/0x200 [nfsd]
    [ 1610.168320] [] svc_process_common+0x46d/0x6d0 [sunrpc]
    [ 1610.168320] [] svc_process+0x103/0x170 [sunrpc]
    [ 1610.168320] [] nfsd+0xbf/0x130 [nfsd]
    [ 1610.168320] [] ? nfsd_destroy+0x80/0x80 [nfsd]
    [ 1610.168320] [] kthread+0xd2/0xf0
    [ 1610.168320] [] ? insert_kthread_work+0x40/0x40
    [ 1610.168320] [] ret_from_fork+0x7c/0xb0
    [ 1610.168320] [] ? insert_kthread_work+0x40/0x40
    [ 1610.168320] Code: 78 02 e9 e7 fc ff ff 31 c0 31 d2 31 c9 66 89 45 ce
    41 8b 04 24 66 89 55 d0 66 89 4d d2 48 8d 04 80 49 8d 5c 84 04 e9 37 fd
    ff ff 0b 90 0f 1f 44 00 00 55 8b 56 08 c7 07 00 00 00 00 8b 46 0c
    [ 1610.168320] RIP [] _posix_to_nfsv4_one+0x3cd/0x3d0
    [nfsd]
    [ 1610.168320] RSP
    [ 1610.257313] ---[ end trace 838254e3e352285b ]---

    Signed-off-by: Kinglong Mee
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Kinglong Mee
     
  • commit 4cb57e3032d4e4bf5e97780e9907da7282b02b0c upstream.

    Mainly to ensure that we don't leave any hanging timers.

    Signed-off-by: Trond Myklebust
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 5694c93e6c4954fa9424c215f75eeb919bddad64 upstream.

    Aside from making it clearer what is non-trivial in create_client(), it
    also fixes a bug whereby we can call free_client() before idr_init()
    has been called.

    Signed-off-by: Trond Myklebust
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     

06 May, 2014

11 commits

  • commit 3758cf7e14b753838fe754ede3862af10b35fdac upstream.

    ...otherwise the logic in the timeout handling doesn't work correctly.

    Spotted-by: Trond Myklebust
    Signed-off-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Jeff Layton
     
  • commit 2b9056359889c78ea5decb5b654a512c2e8a945c upstream.

    When stopping nfsd, I got BUG messages, and soft lockup messages,
    The problem is cuased by double rb_erase() in nfs4_state_destroy_net()
    and destroy_client().

    This patch just let nfsd traversing unconfirmed client through
    hash-table instead of rbtree.

    [ 2325.021995] BUG: unable to handle kernel NULL pointer dereference at
    (null)
    [ 2325.022809] IP: [] rb_erase+0x14c/0x390
    [ 2325.022982] PGD 7a91b067 PUD 7a33d067 PMD 0
    [ 2325.022982] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
    [ 2325.022982] Modules linked in: nfsd(OF) cfg80211 rfkill bridge stp
    llc snd_intel8x0 snd_ac97_codec ac97_bus auth_rpcgss nfs_acl serio_raw
    e1000 i2c_piix4 ppdev snd_pcm snd_timer lockd pcspkr joydev parport_pc
    snd parport i2c_core soundcore microcode sunrpc ata_generic pata_acpi
    [last unloaded: nfsd]
    [ 2325.022982] CPU: 1 PID: 2123 Comm: nfsd Tainted: GF O
    3.14.0-rc8+ #2
    [ 2325.022982] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
    VirtualBox 12/01/2006
    [ 2325.022982] task: ffff88007b384800 ti: ffff8800797f6000 task.ti:
    ffff8800797f6000
    [ 2325.022982] RIP: 0010:[] []
    rb_erase+0x14c/0x390
    [ 2325.022982] RSP: 0018:ffff8800797f7d98 EFLAGS: 00010246
    [ 2325.022982] RAX: ffff880079c1f010 RBX: ffff880079f4c828 RCX:
    0000000000000000
    [ 2325.022982] RDX: 0000000000000000 RSI: ffff880079bcb070 RDI:
    ffff880079f4c810
    [ 2325.022982] RBP: ffff8800797f7d98 R08: 0000000000000000 R09:
    ffff88007964fc70
    [ 2325.022982] R10: 0000000000000000 R11: 0000000000000400 R12:
    ffff880079f4c800
    [ 2325.022982] R13: ffff880079bcb000 R14: ffff8800797f7da8 R15:
    ffff880079f4c860
    [ 2325.022982] FS: 0000000000000000(0000) GS:ffff88007f900000(0000)
    knlGS:0000000000000000
    [ 2325.022982] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 2325.022982] CR2: 0000000000000000 CR3: 000000007a3ef000 CR4:
    00000000000006e0
    [ 2325.022982] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
    0000000000000000
    [ 2325.022982] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
    0000000000000400
    [ 2325.022982] Stack:
    [ 2325.022982] ffff8800797f7de0 ffffffffa0191c6e ffff8800797f7da8
    ffff8800797f7da8
    [ 2325.022982] ffff880079f4c810 ffff880079bcb000 ffffffff81cc26c0
    ffff880079c1f010
    [ 2325.022982] ffff880079bcb070 ffff8800797f7e28 ffffffffa01977f2
    ffff8800797f7df0
    [ 2325.022982] Call Trace:
    [ 2325.022982] [] destroy_client+0x32e/0x3b0 [nfsd]
    [ 2325.022982] [] nfs4_state_shutdown_net+0x1a2/0x220
    [nfsd]
    [ 2325.022982] [] nfsd_shutdown_net+0x38/0x70 [nfsd]
    [ 2325.022982] [] nfsd_last_thread+0x4e/0x80 [nfsd]
    [ 2325.022982] [] svc_shutdown_net+0x2b/0x30 [sunrpc]
    [ 2325.022982] [] nfsd_destroy+0x5b/0x80 [nfsd]
    [ 2325.022982] [] nfsd+0x103/0x130 [nfsd]
    [ 2325.022982] [] ? nfsd_destroy+0x80/0x80 [nfsd]
    [ 2325.022982] [] kthread+0xd2/0xf0
    [ 2325.022982] [] ? insert_kthread_work+0x40/0x40
    [ 2325.022982] [] ret_from_fork+0x7c/0xb0
    [ 2325.022982] [] ? insert_kthread_work+0x40/0x40
    [ 2325.022982] Code: 48 83 e1 fc 48 89 10 0f 84 02 01 00 00 48 3b 41 10
    0f 84 08 01 00 00 48 89 51 08 48 89 fa e9 74 ff ff ff 0f 1f 40 00 48 8b
    50 10 02 01 0f 84 93 00 00 00 48 8b 7a 10 48 85 ff 74 05 f6 07 01
    [ 2325.022982] RIP [] rb_erase+0x14c/0x390
    [ 2325.022982] RSP
    [ 2325.022982] CR2: 0000000000000000
    [ 2325.022982] ---[ end trace 28c27ed011655e57 ]---

    [ 228.064071] BUG: soft lockup - CPU#0 stuck for 22s! [nfsd:558]
    [ 228.064428] Modules linked in: ip6t_rpfilter ip6t_REJECT cfg80211
    xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc
    ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6
    nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw
    ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4
    nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security
    iptable_raw nfsd(OF) auth_rpcgss nfs_acl lockd snd_intel8x0
    snd_ac97_codec ac97_bus joydev snd_pcm snd_timer e1000 sunrpc snd ppdev
    parport_pc serio_raw pcspkr i2c_piix4 microcode parport soundcore
    i2c_core ata_generic pata_acpi
    [ 228.064539] CPU: 0 PID: 558 Comm: nfsd Tainted: GF O
    3.14.0-rc8+ #2
    [ 228.064539] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
    VirtualBox 12/01/2006
    [ 228.064539] task: ffff880076adec00 ti: ffff880074616000 task.ti:
    ffff880074616000
    [ 228.064539] RIP: 0010:[] []
    rb_next+0x27/0x50
    [ 228.064539] RSP: 0018:ffff880074617de0 EFLAGS: 00000282
    [ 228.064539] RAX: ffff880074478010 RBX: ffff88007446f860 RCX:
    0000000000000014
    [ 228.064539] RDX: ffff880074478010 RSI: 0000000000000000 RDI:
    ffff880074478010
    [ 228.064539] RBP: ffff880074617de0 R08: 0000000000000000 R09:
    0000000000000012
    [ 228.064539] R10: 0000000000000001 R11: ffffffffffffffec R12:
    ffffea0001d11a00
    [ 228.064539] R13: ffff88007f401400 R14: ffff88007446f800 R15:
    ffff880074617d50
    [ 228.064539] FS: 0000000000000000(0000) GS:ffff88007f800000(0000)
    knlGS:0000000000000000
    [ 228.064539] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 228.064539] CR2: 00007fe9ac6ec000 CR3: 000000007a5d6000 CR4:
    00000000000006f0
    [ 228.064539] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
    0000000000000000
    [ 228.064539] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
    0000000000000400
    [ 228.064539] Stack:
    [ 228.064539] ffff880074617e28 ffffffffa01ab7db ffff880074617df0
    ffff880074617df0
    [ 228.064539] ffff880079273000 ffffffff81cc26c0 ffffffff81cc26c0
    0000000000000000
    [ 228.064539] 0000000000000000 ffff880074617e48 ffffffffa01840b8
    ffffffff81cc26c0
    [ 228.064539] Call Trace:
    [ 228.064539] [] nfs4_state_shutdown_net+0x18b/0x220
    [nfsd]
    [ 228.064539] [] nfsd_shutdown_net+0x38/0x70 [nfsd]
    [ 228.064539] [] nfsd_last_thread+0x4e/0x80 [nfsd]
    [ 228.064539] [] svc_shutdown_net+0x2b/0x30 [sunrpc]
    [ 228.064539] [] nfsd_destroy+0x5b/0x80 [nfsd]
    [ 228.064539] [] nfsd+0x103/0x130 [nfsd]
    [ 228.064539] [] ? nfsd_destroy+0x80/0x80 [nfsd]
    [ 228.064539] [] kthread+0xd2/0xf0
    [ 228.064539] [] ? insert_kthread_work+0x40/0x40
    [ 228.064539] [] ret_from_fork+0x7c/0xb0
    [ 228.064539] [] ? insert_kthread_work+0x40/0x40
    [ 228.064539] Code: 1f 44 00 00 55 48 8b 17 48 89 e5 48 39 d7 74 3b 48
    8b 47 08 48 85 c0 75 0e eb 25 66 0f 1f 84 00 00 00 00 00 48 89 d0 48 8b
    50 10 85 d2 75 f4 5d c3 66 90 48 3b 78 08 75 f6 48 8b 10 48 89 c7

    Fixes: ac55fdc408039 (nfsd: move the confirmed and unconfirmed hlists...)
    Signed-off-by: Kinglong Mee
    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Kinglong Mee
     
  • commit 480efaee085235bb848f1063f959bf144103c342 upstream.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit 18df11d0eacf67bbcd8dda755b568bbbd7264735 upstream.

    fh_put() does not free the temporary file handle.

    Signed-off-by: Yan, Zheng
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Yan, Zheng
     
  • commit 3064639423c48d6e0eb9ecc27c512a58e38c6c57 upstream.

    There could be a case, when NFSd file system is mounted in network, different
    to socket's one, like below:

    "ip netns exec" creates new network and mount namespace, which duplicates NFSd
    mount point, created in init_net context. And thus NFS server stop in nested
    network context leads to RPCBIND client destruction in init_net.
    Then, on NFSd start in nested network context, rpc.nfsd process creates socket
    in nested net and passes it into "write_ports", which leads to RPCBIND sockets
    creation in init_net context because of the same reason (NFSd monut point was
    created in init_net context). An attempt to register passed socket in nested
    net leads to panic, because no RPCBIND client present in nexted network
    namespace.

    This patch add check that passed socket's net matches NFSd superblock's one.
    And returns -EINVAL error to user psace otherwise.

    v2: Put socket on exit.

    Reported-by: Weng Meiling
    Signed-off-by: Stanislav Kinsbursky
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Stanislav Kinsbursky
     
  • commit 9f67f189939eccaa54f3d2c9cf10788abaf2d584 upstream.

    Looks like this bug has been here since these write counts were
    introduced, not sure why it was just noticed now.

    Thanks also to Jan Kara for pointing out the problem.

    Reported-by: Matthew Rahtz
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit 04819bf6449094e62cebaf5199d85d68d711e667 upstream.

    This fixes an ommission from 18032ca062e621e15683cb61c066ef3dc5414a7b
    "NFSD: Server implementation of MAC Labeling", which increased the size
    of the setattr error reply without increasing COMPOUND_ERR_SLACK_SPACE.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit a11fcce1544df08c723d950ff0edef3adac40405 upstream.

    If the entire operation fails then there's nothing to encode.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit de3997a7eeb9ea286b15879fdf8a95aae065b4f7 upstream.

    This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39
    "nfsd41: SUPPATTR_EXCLCREAT attribute".

    Cc: Benny Halevy
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit 4c69d5855a16f7378648c5733632628fa10431db upstream.

    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit 082f31a2169bd639785e45bf252f3d5bce0303c6 upstream.

    This reverts the part of commit 6e14b46b91fee8a049b0940333ce13a820beaaa5
    that changes NFSv2 behavior.

    Mark Lord found that it broke nfs-root for Linux clients, because it
    broke NFSv2.

    In fact, from RFC 1094:

    "Notice that the file type is specified both in the mode bits
    and in the file type. This is really a bug in the protocol and
    will be fixed in future versions."

    So NFSv2 clients really are expected to depend on the high bits of the
    mode.

    Reported-by: Mark Lord
    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Cc: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     

19 Feb, 2014

1 commit


12 Feb, 2014

1 commit

  • 4ac7249ea5a0ceef9f8269f63f33cc873c3fac61 "nfsd: use get_acl and
    ->set_acl" forgets to set the size in the case get_acl() succeeds, so
    _posix_to_nfsv4_one() can then write past the end of its allocation.
    Symptoms were slab corruption warnings.

    Also, some minor cleanup while we're here. (Among other things, note
    that the first few lines guarantee that pacl is non-NULL.)

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

31 Jan, 2014

1 commit

  • Pull nfsd updates from Bruce Fields:
    - Handle some loose ends from the vfs read delegation support.
    (For example nfsd can stop breaking leases on its own in a
    fewer places where it can now depend on the vfs to.)
    - Make life a little easier for NFSv4-only configurations
    (thanks to Kinglong Mee).
    - Fix some gss-proxy problems (thanks Jeff Layton).
    - miscellaneous bug fixes and cleanup

    * 'for-3.14' of git://linux-nfs.org/~bfields/linux: (38 commits)
    nfsd: consider CLAIM_FH when handing out delegation
    nfsd4: fix delegation-unlink/rename race
    nfsd4: delay setting current_fh in open
    nfsd4: minor nfs4_setlease cleanup
    gss_krb5: use lcm from kernel lib
    nfsd4: decrease nfsd4_encode_fattr stack usage
    nfsd: fix encode_entryplus_baggage stack usage
    nfsd4: simplify xdr encoding of nfsv4 names
    nfsd4: encode_rdattr_error cleanup
    nfsd4: nfsd4_encode_fattr cleanup
    minor svcauth_gss.c cleanup
    nfsd4: better VERIFY comment
    nfsd4: break only delegations when appropriate
    NFSD: Fix a memory leak in nfsd4_create_session
    sunrpc: get rid of use_gssp_lock
    sunrpc: fix potential race between setting use_gss_proxy and the upcall rpc_clnt
    sunrpc: don't wait for write before allowing reads from use-gss-proxy file
    nfsd: get rid of unused function definition
    Define op_iattr for nfsd4_open instead using macro
    NFSD: fix compile warning without CONFIG_NFSD_V3
    ...

    Linus Torvalds
     

28 Jan, 2014

4 commits

  • CLAIM_FH was added by NFSv4.1. It is the same as CLAIM_NULL except that it
    uses only current FH to identify the file to be opened.

    The NFS client is using CLAIM_FH if the FH is available when opening a file.
    Currently, we cannot get any delegation if we stat a file before open it
    because the server delegation code does not recognize CLAIM_FH.

    We tested this patch and found delegation can be handed out now when claim is
    CLAIM_FH.

    See http://marc.info/?l=linux-nfs&m=136369847801388&w=2 and
    http://www.linux-nfs.org/wiki/index.php/Server_4.0_and_4.1_issues#New_open_claim_types

    Signed-off-by: Ming Chen
    Signed-off-by: J. Bruce Fields

    Ming Chen
     
  • If a file is unlinked or renamed between the time when we do the local
    open and the time when we get the delegation, then we will return to the
    client indicating that it holds a delegation even though the file no
    longer exists under the name it was open under.

    But a client performing an open-by-name, when it is returned a
    delegation, must be able to assume that the file is still linked at the
    name it was opened under.

    So, hold the parent i_mutex for longer to prevent concurrent renames or
    unlinks.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • This is basically a no-op, to simplify a following patch.

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

    J. Bruce Fields
     
  • As far as I can tell, this list is used only under the state lock, so we
    may as well do this in the simpler order.

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

    J. Bruce Fields
     

26 Jan, 2014

1 commit

  • Remove the boilerplate code to marshall and unmarhall ACL objects into
    xattrs and operate on the posix_acl objects directly. Also move all
    the ACL handling code into nfs?acl.c where it belongs.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

25 Jan, 2014

1 commit

  • A struct svc_fh is 320 bytes on x86_64, it'd be better not to have these
    on the stack.

    kmalloc'ing them probably isn't ideal either, but this is the simplest
    thing to do. If it turns out to be a problem in the readdir case then
    we could add a svc_fh to nfsd4_readdir and pass that in.

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

    J. Bruce Fields
     

24 Jan, 2014

1 commit


09 Jan, 2014

1 commit


08 Jan, 2014

4 commits