23 Jun, 2015

3 commits

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

    Christoph Hellwig
     
  • Remove the hack where we fput the read-specific file in generic code.
    Instead we can do it in nfsd4_encode_read as that gets called for all
    error cases as well.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Christoph Hellwig
     
  • This patch changes nfs4_preprocess_stateid_op so it always returns
    a valid struct file if it has been asked for that. For that we
    now allocate a temporary struct file for special stateids, and check
    permissions if we got the file structure from the stateid. This
    ensures that all callers will get their handling of special stateids
    right, and avoids code duplication.

    There is a little wart in here because the read code needs to know
    if we allocated a file structure so that it can copy around the
    read-ahead parameters. In the long run we should probably aim to
    cache full file structures used with special stateids instead.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Christoph Hellwig
     

20 Jun, 2015

3 commits


05 Jun, 2015

2 commits

  • When testing pnfs layout, nfsd got error NFS4ERR_SEQ_MISORDERED.
    It is caused by nfs return NFS4ERR_DELAY before validate_seqid(),
    don't update the sequnce id, but nfsd updates the sequnce id !!!

    According to RFC5661 20.9.3,
    " If CB_SEQUENCE returns an error, then the state of the slot
    (sequence ID, cached reply) MUST NOT change. "

    Signed-off-by: Kinglong Mee
    Signed-off-by: J. Bruce Fields

    Kinglong Mee
     
  • nfsd enters a infinite loop and prints message every 10 seconds:

    May 31 18:33:52 test-server kernel: Error sending entire callback!
    May 31 18:34:01 test-server kernel: Error sending entire callback!

    This is caused by a cb_layoutreturn getting error -10008
    (NFS4ERR_DELAY), the client crashing, and then nfsd entering the
    infinite loop:

    bc_sendto --> call_timeout --> nfsd4_cb_done --> nfsd4_cb_layout_done
    with error -10008 --> rpc_delay(task, HZ/100) --> bc_sendto ...

    Reproduced using xfstests 074 with nfs client's kdump on,
    CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set, and client's blkmapd down:

    1. nfs client's write operation will get the layout of file,
    and then send getdeviceinfo,
    2. but layout segment is not recorded by client because blkmapd is down,
    3. client writes data by sending WRITE to server,
    4. nfs server recalls the layout of the file before WRITE,
    5. network error causes the client reset the session and return NFS4ERR_DELAY,
    6. so client's WRITE operation is waiting the reply.
    If the task hangs 120s, the client will crash.
    7. so that, the next bc_sendto will fail with TIMEOUT,
    and cb_status is NFS4ERR_DELAY.

    Signed-off-by: Kinglong Mee
    Signed-off-by: J. Bruce Fields

    Kinglong Mee
     

29 May, 2015

4 commits

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

    Andreas Gruenbacher
     
  • gcc-5.0 warns about a potential uninitialized variable use in nfsd:

    fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
    fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
    reset_union_bmap_deny(old_deny_bmap, stp);
    ^
    fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
    unsigned char old_deny_bmap;
    ^

    This is a false positive, the code path that is warned about cannot
    actually be reached.

    This adds an initialization for the variable to make the warning go
    away.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: J. Bruce Fields

    Arnd Bergmann
     
  • Whether or not a file system supports acls can be determined with
    IS_POSIXACL(inode) and does not require trying to fetch any acls; the code for
    computing the supported_attrs and aclsupport attributes can be simplified.

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: J. Bruce Fields

    Andreas Gruenbacher
     
  • NFSv2 can set the atime and/or mtime of a file to specific timestamps but not
    to the server's current time. To implement the equivalent of utimes("file",
    NULL), it uses a heuristic.

    NFSv3 and later do support setting the atime and/or mtime to the server's
    current time directly. The NFSv2 heuristic is still enabled, and causes
    timestamps to be set wrong sometimes.

    Fix this by moving the heuristic into the NFSv2 specific code. We can leave it
    out of the create code path: the owner can always set timestamps arbitrarily,
    and the workaround would never trigger.

    Signed-off-by: Andreas Gruenbacher
    Reviewed-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Andreas Gruenbacher
     

07 May, 2015

1 commit

  • The NFSv3 READDIRPLUS gets some of the returned attributes from the
    readdir, and some from an inode returned from a new lookup. The two
    objects could be different thanks to intervening renames.

    The attributes in READDIRPLUS are optional, so let's just skip them if
    we notice this case.

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

    NeilBrown
     

05 May, 2015

7 commits

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

    Christoph Hellwig
     
  • With sessions in v4.1 or later we don't need to manually probe the backchannel
    connection, so we can declare it up instantly after setting up the RPC client.

    Note that we really should split nfsd4_run_cb_work in the long run, this is
    just the least intrusive fix for now.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Christoph Hellwig
     
  • Checking the rpc_client pointer is not a reliable way to detect
    backchannel changes: cl_cb_client is changed only after shutting down
    the rpc client, so the condition cl_cb_client = tk_client will always be
    true.

    Check the RPC_TASK_KILLED flag instead, and rewrite the code to avoid
    the buggy cl_callbacks list and fix the lifetime rules due to double
    calls of the ->prepare callback operations method for this retry case.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Christoph Hellwig
     
  • We must only increment the sequence id if the client has seen and responded
    to a request. If we failed to deliver it to the client we must resend with
    the same sequence id. So just like the client track errors at the transport
    level differently from those returned in the XDR.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Christoph Hellwig
     
  • For the sake of forgetful clients, the server should return the layouts
    to the file system on 'last close' of a file (assuming that there are no
    delegations outstanding to that particular client) or on delegreturn
    (assuming that there are no opens on a file from that particular
    client).

    In theory the information is all there in current data structures, but
    it's not efficiently available; nfs4_file->fi_ref includes references on
    the file across all clients, but we need a per-(client, file) count.
    Walking through lots of stateid's to calculate this on each close or
    delegreturn would be painful.

    This patch introduces infrastructure to maintain per-client opens and
    delegation counters on a per-file basis.

    [hch: ported to the mainline pNFS support, merged various fixes from Jeff]
    Signed-off-by: Sachin Bhamare
    Signed-off-by: Jeff Layton
    Signed-off-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    Sachin Bhamare
     
  • If we find a non-confirmed openowner we jump to exit the function, but do
    not set an error value. Fix this by factoring out a helper to do the
    check and properly set the error from nfsd4_validate_stateid.

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

    Christoph Hellwig
     
  • Commit df52699e4fcef ("NFSv4.1: Don't cache deviceids that have no
    notifications") causes the Linux NFS client to stop caching deviceid's
    unless a server pretends to support deviceid notifications. While this
    behavior is stupid and the language around this area in rfc5661 is a
    mess carified by an errata that I submittted, Trond insists on this
    behavior. Not caching deviceids degrades block layout performance
    massively as a GETDEVICEINFO is fairly expensive.

    So add this hack to make the Linux client happy again.

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

    Christoph Hellwig
     

27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

24 Apr, 2015

1 commit

  • Pull nfsd updates from Bruce Fields:
    "A quiet cycle this time; this is basically entirely bugfixes.

    The few that aren't cc'd to stable are cleanup or seemed unlikely to
    affect anyone much"

    * 'for-4.1' of git://linux-nfs.org/~bfields/linux:
    uapi: Remove kernel internal declaration
    nfsd: fix nsfd startup race triggering BUG_ON
    nfsd: eliminate NFSD_DEBUG
    nfsd4: fix READ permission checking
    nfsd4: disallow SEEK with special stateids
    nfsd4: disallow ALLOCATE with special stateids
    nfsd: add NFSEXP_PNFS to the exflags array
    nfsd: Remove duplicate macro define for max sec label length
    nfsd: allow setting acls with unenforceable DENYs
    nfsd: NFSD_FAULT_INJECTION depends on DEBUG_FS
    nfsd: remove unused status arg to nfsd4_cleanup_open_state
    nfsd: remove bogus setting of status in nfsd4_process_open2
    NFSD: Use correct reply size calculating function
    NFSD: Using path_equal() for checking two paths

    Linus Torvalds
     

22 Apr, 2015

5 commits

  • nfsd triggered a BUG_ON in net_generic(...) when rpc_pipefs_event(...)
    in fs/nfsd/nfs4recover.c was called before assigning ntfsd_net_id.
    The following was observed on a MIPS 32-core processor:
    kernel: Call Trace:
    kernel: [] rpc_pipefs_event+0x7c/0x158 [nfsd]
    kernel: [] notifier_call_chain+0x70/0xb8
    kernel: [] __blocking_notifier_call_chain+0x4c/0x70
    kernel: [] rpc_fill_super+0xf8/0x1a0
    kernel: [] mount_ns+0xb4/0xf0
    kernel: [] mount_fs+0x50/0x1f8
    kernel: [] vfs_kern_mount+0x58/0xf0
    kernel: [] do_mount+0x27c/0xa28
    kernel: [] SyS_mount+0x98/0xe8
    kernel: [] handle_sys64+0x44/0x68
    kernel:
    kernel:
    Code: 0040f809 00000000 2e020001 3c12c00d
    3c02801a de100000 6442eb98 0040f809
    kernel: ---[ end trace 7471374335809536 ]---

    Fixed this behaviour by calling register_pernet_subsys(&nfsd_net_ops) before
    registering rpc_pipefs_event(...) with the notifier chain.

    Signed-off-by: Giuseppe Cantavenera
    Signed-off-by: Lorenzo Restelli
    Reviewed-by: Kinlong Mee
    Cc: stable@vger.kernel.org
    Signed-off-by: J. Bruce Fields

    Giuseppe Cantavenera
     
  • Commit f895b252d4edf ("sunrpc: eliminate RPC_DEBUG") introduced
    use of IS_ENABLED() in a uapi header which leads to a build
    failure for userspace apps trying to use :

    linux/nfsd/debug.h:18:15: error: missing binary operator before token "("
    #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
    ^

    Since this was only used to define NFSD_DEBUG if CONFIG_SUNRPC_DEBUG
    is enabled, replace instances of NFSD_DEBUG with CONFIG_SUNRPC_DEBUG.

    Cc: stable@vger.kernel.org
    Fixes: f895b252d4edf "sunrpc: eliminate RPC_DEBUG"
    Signed-off-by: Mark Salter
    Reviewed-by: Jeff Layton
    Signed-off-by: J. Bruce Fields

    Mark Salter
     
  • In the case we already have a struct file (derived from a stateid), we
    still need to do permission-checking; otherwise an unauthorized user
    could gain access to a file by sniffing or guessing somebody else's
    stateid.

    Cc: stable@vger.kernel.org
    Fixes: dc97618ddda9 "nfsd4: separate splice and readv cases"
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • If the client uses a special stateid then we'll pass a NULL file to
    vfs_llseek.

    Fixes: 24bab491220f " NFSD: Implement SEEK"
    Cc: Anna Schumaker
    Cc: stable@vger.kernel.org
    Reported-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • vfs_fallocate will hit a NULL dereference if the client tries an
    ALLOCATE or DEALLOCATE with a special stateid. Fix that. (We also
    depend on the open to have broken any conflicting leases or delegations
    for us.)

    (If it turns out we need to allow special stateid's then we could do a
    temporary open here in the special-stateid case, as we do for read and
    write. For now I'm assuming it's not necessary.)

    Fixes: 95d871f03cae "nfsd: Add ALLOCATE support"
    Cc: stable@vger.kernel.org
    Cc: Anna Schumaker
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

16 Apr, 2015

3 commits

  • Merge second patchbomb from Andrew Morton:

    - the rest of MM

    - various misc bits

    - add ability to run /sbin/reboot at reboot time

    - printk/vsprintf changes

    - fiddle with seq_printf() return value

    * akpm: (114 commits)
    parisc: remove use of seq_printf return value
    lru_cache: remove use of seq_printf return value
    tracing: remove use of seq_printf return value
    cgroup: remove use of seq_printf return value
    proc: remove use of seq_printf return value
    s390: remove use of seq_printf return value
    cris fasttimer: remove use of seq_printf return value
    cris: remove use of seq_printf return value
    openrisc: remove use of seq_printf return value
    ARM: plat-pxa: remove use of seq_printf return value
    nios2: cpuinfo: remove use of seq_printf return value
    microblaze: mb: remove use of seq_printf return value
    ipc: remove use of seq_printf return value
    rtc: remove use of seq_printf return value
    power: wakeup: remove use of seq_printf return value
    x86: mtrr: if: remove use of seq_printf return value
    linux/bitmap.h: improve BITMAP_{LAST,FIRST}_WORD_MASK
    MAINTAINERS: CREDITS: remove Stefano Brivio from B43
    .mailmap: add Ricardo Ribalda
    CREDITS: add Ricardo Ribalda Delgado
    ...

    Linus Torvalds
     
  • There are a lot of embedded systems that run most or all of their
    functionality in init, running as root:root. For these systems,
    supporting multiple users is not necessary.

    This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for
    non-root users, non-root groups, and capabilities optional. It is enabled
    under CONFIG_EXPERT menu.

    When this symbol is not defined, UID and GID are zero in any possible case
    and processes always have all capabilities.

    The following syscalls are compiled out: setuid, setregid, setgid,
    setreuid, setresuid, getresuid, setresgid, getresgid, setgroups,
    getgroups, setfsuid, setfsgid, capget, capset.

    Also, groups.c is compiled out completely.

    In kernel/capability.c, capable function was moved in order to avoid
    adding two ifdef blocks.

    This change saves about 25 KB on a defconfig build. The most minimal
    kernels have total text sizes in the high hundreds of kB rather than
    low MB. (The 25k goes down a bit with allnoconfig, but not that much.

    The kernel was booted in Qemu. All the common functionalities work.
    Adding users/groups is not possible, failing with -ENOSYS.

    Bloat-o-meter output:
    add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650)

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Iulia Manda
    Reviewed-by: Josh Triplett
    Acked-by: Geert Uytterhoeven
    Tested-by: Paul E. McKenney
    Reviewed-by: Paul E. McKenney
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Iulia Manda
     
  • that's the bulk of filesystem drivers dealing with inodes of their own

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     

03 Apr, 2015

2 commits


01 Apr, 2015

7 commits


31 Mar, 2015

1 commit