24 Aug, 2018

4 commits


17 Aug, 2018

2 commits

  • rdma.git merge resolution for the 4.19 merge window

    Conflicts:
    drivers/infiniband/core/rdma_core.c
    - Use the rdma code and revise with the new spelling for
    atomic_fetch_add_unless
    drivers/nvme/host/rdma.c
    - Replace max_sge with max_send_sge in new blk code
    drivers/nvme/target/rdma.c
    - Use the blk code and revise to use NULL for ib_post_recv when
    appropriate
    - Replace max_sge with max_recv_sge in new blk code
    net/rds/ib_send.c
    - Use the net code and revise to use NULL for ib_post_recv when
    appropriate

    Signed-off-by: Jason Gunthorpe

    Jason Gunthorpe
     
  • Resolve merge conflicts from the -rc cycle against the rdma.git tree:

    Conflicts:
    drivers/infiniband/core/uverbs_cmd.c
    - New ifs added to ib_uverbs_ex_create_flow in -rc and for-next
    - Merge removal of file->ucontext in for-next with new code in -rc
    drivers/infiniband/core/uverbs_main.c
    - for-next removed code from ib_uverbs_write() that was modified
    in for-rc

    Signed-off-by: Jason Gunthorpe

    Jason Gunthorpe
     

14 Aug, 2018

2 commits

  • Pull cifs updates from Steve French:
    "smb3/cifs fixes (including 8 for stable).

    Other improvements include:

    - improved tracing, improved stats

    - snapshots (previous version mounts work now over SMB3)

    - performance (compounding enabled for statfs, ~40% faster).

    - security (make it possible to build cifs.ko with insecure vers=1.0
    disabled in Kconfig)"

    * tag '4.19-smb3' of git://git.samba.org/sfrench/cifs-2.6: (43 commits)
    smb3: create smb3 equivalent alias for cifs pseudo-xattrs
    smb3: allow previous versions to be mounted with snapshot= mount parm
    cifs: don't show domain= in mount output when domain is empty
    cifs: add missing support for ACLs in SMB 3.11
    smb3: enumerating snapshots was leaving part of the data off end
    cifs: update smb2_queryfs() to use compounding
    cifs: update receive_encrypted_standard to handle compounded responses
    cifs: create SMB2_open_init()/SMB2_open_free() helpers.
    cifs: add SMB2_query_info_[init|free]()
    cifs: add SMB2_close_init()/SMB2_close_free()
    smb3: display stats counters for number of slow commands
    CIFS: fix uninitialized ptr deref in smb2 signing
    smb3: Do not send SMB3 SET_INFO if nothing changed
    smb3: fix minor debug output for CONFIG_CIFS_STATS
    smb3: add tracepoint for slow responses
    cifs: add compound_send_recv()
    cifs: make smb_send_rqst take an array of requests
    cifs: update init_sg, crypt_message to take an array of rqst
    smb3: update readme to correct information about /proc/fs/cifs/Stats
    smb3: fix reset of bytes read and written stats
    ...

    Linus Torvalds
     
  • Pull vfs open-related updates from Al Viro:

    - "do we need fput() or put_filp()" rules are gone - it's always fput()
    now. We keep track of that state where it belongs - in ->f_mode.

    - int *opened mess killed - in finish_open(), in ->atomic_open()
    instances and in fs/namei.c code around do_last()/lookup_open()/atomic_open().

    - alloc_file() wrappers with saner calling conventions are introduced
    (alloc_file_clone() and alloc_file_pseudo()); callers converted, with
    much simplification.

    - while we are at it, saner calling conventions for path_init() and
    link_path_walk(), simplifying things inside fs/namei.c (both on
    open-related paths and elsewhere).

    * 'work.open3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (40 commits)
    few more cleanups of link_path_walk() callers
    allow link_path_walk() to take ERR_PTR()
    make path_init() unconditionally paired with terminate_walk()
    document alloc_file() changes
    make alloc_file() static
    do_shmat(): grab shp->shm_file earlier, switch to alloc_file_clone()
    new helper: alloc_file_clone()
    create_pipe_files(): switch the first allocation to alloc_file_pseudo()
    anon_inode_getfile(): switch to alloc_file_pseudo()
    hugetlb_file_setup(): switch to alloc_file_pseudo()
    ocxlflash_getfile(): switch to alloc_file_pseudo()
    cxl_getfile(): switch to alloc_file_pseudo()
    ... and switch shmem_file_setup() to alloc_file_pseudo()
    __shmem_file_setup(): reorder allocations
    new wrapper: alloc_file_pseudo()
    kill FILE_{CREATED,OPENED}
    switch atomic_open() and lookup_open() to returning 0 in all success cases
    document ->atomic_open() changes
    ->atomic_open(): return 0 in all success cases
    get rid of 'opened' in path_openat() and the helpers downstream
    ...

    Linus Torvalds
     

11 Aug, 2018

4 commits

  • We really, really don't want to be encouraging people to use
    cifs (the dialect) since it is insecure, so to avoid confusion
    we want to move them to names which include 'smb3' instead of
    'cifs' - so this simply creates an alias for the pseudo-xattrs

    e.g. can now do:
    getfattr -n user.smb3.creationtime /mnt1/file
    and
    getfattr -n user.smb3.dosattrib /mnt1/file
    and
    getfattr -n system.smb3_acl /mnt1/file

    instead of forcing you to use the string 'cifs' in
    these (e.g. getfattr -n system.cifs_acl /mnt1/file)

    Signed-off-by: Steve French

    Steve French
     
  • mounting with the "snapshots=" mount parm allows a read-only
    view of a previous version of a file system (see MS-SMB2
    and "timewarp" tokens, section 2.2.13.2.6) based on the timestamp
    passed in on the snapshots mount parm.

    Add processing to optionally send this create context.

    Example output:

    /mnt1 is mounted with "snapshots=..." and will see an earlier
    version of the directory, with three fewer files than /mnt2
    the current version of the directory.

    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# cat /proc/mounts | grep cifs
    //172.22.149.186/public /mnt1 cifs
    ro,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,snapshot=131748608570000000,actimeo=1

    //172.22.149.186/public /mnt2 cifs
    rw,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1

    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1
    EmptyDir newerdir
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1/newerdir

    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2
    EmptyDir file newerdir newestdir timestamp-trace.cap
    root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2/newerdir
    new-file-not-in-snapshot

    Snapshots are extremely useful for comparing previous versions of files or directories,
    and recovering from data corruptions or mistakes.

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg

    Steve French
     
  • Reported-by: Xiaoli Feng
    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • We were missing the methods for get_acl and friends for the 3.11
    dialect.

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    CC: Stable
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     

10 Aug, 2018

3 commits

  • When enumerating snapshots, the last few bytes of the final
    snapshot could be left off since we were miscalculating the
    length returned (leaving off the sizeof struct SRV_SNAPSHOT_ARRAY)
    See MS-SMB2 section 2.2.32.2. In addition fixup the length used
    to allow smaller buffer to be passed in, in order to allow
    returning the size of the whole snapshot array more easily.

    Sample userspace output with a kernel patched with this
    (mounted to a Windows volume with two snapshots).
    Before this patch, the second snapshot would be missing a
    few bytes at the end.

    ~/cifs-2.6# ~/enum-snapshots /mnt/file
    press enter to issue the ioctl to retrieve snapshot information ...

    size of snapshot array = 102
    Num snapshots: 2 Num returned: 2 Array Size: 102

    Snapshot 0:@GMT-2018.06.30-19.34.17
    Snapshot 1:@GMT-2018.06.30-19.33.37

    CC: Stable
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Steve French
     
  • Change smb2_queryfs() to use a Create/QueryInfo/Close compound request.

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Paulo Alcantara
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Paulo Alcantara
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     

09 Aug, 2018

3 commits


08 Aug, 2018

22 commits

  • When CONFIG_CIFS_STATS2 is enabled keep counters for slow
    commands (ie server took longer than 1 second to respond)
    by SMB2/SMB3 command code. This can help in diagnosing
    whether performance problems are on server (instead of
    client) and which commands are causing the problem.

    Sample output (the new lines contain words "slow responses ...")

    $ cat /proc/fs/cifs/Stats
    Resources in use
    CIFS Session: 1
    Share (unique mount targets): 2
    SMB Request/Response Buffer: 1 Pool size: 5
    SMB Small Req/Resp Buffer: 1 Pool size: 30
    Total Large 10 Small 490 Allocations
    Operations (MIDs): 0

    0 session 0 share reconnects
    Total vfs operations: 67 maximum at one time: 2
    4 slow responses from localhost for command 5
    1 slow responses from localhost for command 6
    1 slow responses from localhost for command 14
    1 slow responses from localhost for command 16

    1) \\localhost\test
    SMBs: 243
    Bytes read: 1024000 Bytes written: 104857600
    TreeConnects: 1 total 0 failed
    TreeDisconnects: 0 total 0 failed
    Creates: 40 total 0 failed
    Closes: 39 total 0 failed
    ...

    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky
    Reviewed-by: Aurelien Aptel

    Steve French
     
  • server->secmech.sdeschmacsha256 is not properly initialized before
    smb2_shash_allocate(), set shash after that call.

    also fix typo in error message

    Fixes: 8de8c4608fe9 ("cifs: Fix validation of signed data in smb2")

    Signed-off-by: Aurelien Aptel
    Reviewed-by: Paulo Alcantara
    Reported-by: Xiaoli Feng
    Signed-off-by: Steve French
    CC: Stable

    Aurelien Aptel
     
  • An earlier commit had a typo which prevented the
    optimization from working:

    commit 18dd8e1a65dd ("Do not send SMB3 SET_INFO request if nothing is changing")

    Thank you to Metze for noticing this. Also clear a
    reserved field in the FILE_BASIC_INFO struct we send
    that should be zero (all the other fields in that
    struct were set or cleared explicitly already in
    cifs_set_file_info).

    Reviewed-by: Pavel Shilovsky
    CC: Stable # 4.9.x+
    Reported-by: Stefan Metzmacher
    Signed-off-by: Steve French

    Steve French
     
  • CONFIG_CIFS_STATS is now always enabled (to simplify the
    code and since the STATS are important for some common
    customer use cases and also debugging), but needed one
    minor change so that STATS shows as enabled in the debug
    output in /proc/fs/cifs/DebugData, otherwise it could
    get confusing with STATS no longer showing up in the
    "Features" list in /proc/fs/cifs/DebugData when basic
    stats were in fact available.

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg

    Steve French
     
  • If responses take longer than one second from the server,
    we can optionally log them to dmesg in current cifs.ko code
    (CONFIG_CIFS_STATS2 must be configured and a
    /proc/fs/cifs/cifsFYI flag must be set), but can be more useful
    to log these via ftrace (tracepoint is smb3_slow_rsp) which
    is easier and more granular (still requires CONFIG_CIFS_STATS2
    to be configured in the build though).

    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Steve French
     
  • Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • These are used for SMB3 encryption and compounded requests.
    Update these functions and the other functions related to SMB3 encryption to
    take an array of requests.

    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Ronnie Sahlberg
     
  • echo 0 > /proc/fs/cifs/Stats is supposed to reset the stats
    but there were four (see example below) that were not reset
    (bytes read and witten, total vfs ops and max ops
    at one time).

    ...
    0 session 0 share reconnects
    Total vfs operations: 100 maximum at one time: 2

    1) \\localhost\test
    SMBs: 0
    Bytes read: 502092 Bytes written: 31457286
    TreeConnects: 0 total 0 failed
    TreeDisconnects: 0 total 0 failed
    ...

    This patch fixes cifs_stats_proc_write to properly reset
    those four.

    Signed-off-by: Steve French
    Reviewed-by: Aurelien Aptel

    Steve French
     
  • We were only displaying bytes_read and bytes_written in cifs
    stats, fix smb3 stats to also display them. Sample output
    with this patch:

    cat /proc/fs/cifs/Stats:

    CIFS Session: 1
    Share (unique mount targets): 2
    SMB Request/Response Buffer: 1 Pool size: 5
    SMB Small Req/Resp Buffer: 1 Pool size: 30
    Operations (MIDs): 0

    0 session 0 share reconnects
    Total vfs operations: 94 maximum at one time: 2

    1) \\localhost\test
    SMBs: 214
    Bytes read: 502092 Bytes written: 31457286
    TreeConnects: 1 total 0 failed
    TreeDisconnects: 0 total 0 failed
    Creates: 52 total 3 failed
    Closes: 48 total 0 failed
    Flushes: 0 total 0 failed
    Reads: 17 total 0 failed
    Writes: 31 total 0 failed
    ...

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg

    Steve French
     
  • CONFIG_CIFS_STATS should always be enabled as Pavel recently
    noted. Simple statistics are not a significant performance hit,
    and removing the ifdef simplifies the code slightly.

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg
    Reviewed-by: Pavel Shilovsky

    Steve French
     
  • Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky
    Cc:

    Ronnie Sahlberg
     
  • Add tracepoints for reconnecting an smb3 session

    Example output (from trace-cmd) with the patch
    (showing the session marked for reconnect, the stat failing, and then
    the subsequent SMB3 commands after the server comes back up).
    The "smb3_reconnect" event is the new one.

    cifsd-25993 [000] .... 29635.368265: smb3_reconnect: server=localhost current_mid=0x1e
    stat-26200 [001] .... 29638.516403: smb3_enter: cifs_revalidate_dentry_attr: xid=22
    stat-26200 [001] .... 29648.723296: smb3_exit_err: cifs_revalidate_dentry_attr: xid=22 rc=-112
    kworker/0:1-22830 [000] .... 29653.850947: smb3_cmd_done: sid=0x0 tid=0x0 cmd=0 mid=0
    kworker/0:1-22830 [000] .... 29653.851191: smb3_cmd_err: sid=0x8ae4683c tid=0x0 cmd=1 mid=1 status=0xc0000016 rc=-5
    kworker/0:1-22830 [000] .... 29653.855254: smb3_cmd_done: sid=0x8ae4683c tid=0x0 cmd=1 mid=2
    kworker/0:1-22830 [000] .... 29653.855482: smb3_cmd_done: sid=0x8ae4683c tid=0x8084f30d cmd=3 mid=3

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg
    Reviewed-by: Aurelien Aptel

    Steve French
     
  • In debugging reconnection problems, want to be able to more easily
    trace cases in which the server has marked the SMB3 session
    expired or deleted (to distinguish from timeout cases).

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg

    Steve French
     
  • These timers were a good idea but weren't used in current code,
    and the idea was cifs specific. Future patch will add similar timers
    for SMB2/SMB3, but no sense using memory for cifs timers that
    aren't used in current code.

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg

    Steve French
     
  • Fixes problem pointed out by Pavel in discussions about commit
    729c0c9dd55204f0c9a823ac8a7bfa83d36c7e78

    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg
    CC: Stable # 3.18.x+

    Steve French
     
  • Remove counters from the per-tree connection /proc/fs/cifs/Stats
    output that will always be zero (since they are not per-tcon ops)
    ie SMB3 Negotiate, SessionSetup, Logoff, Echo, Cancel.

    Also clarify "sent" to be "total" per-Pavel's suggestion
    (since this "total" includes total for all operations that we try to
    send whether or not succesffully sent). Sample output below:

    Resources in use
    CIFS Session: 1
    Share (unique mount targets): 2
    SMB Request/Response Buffer: 1 Pool size: 5
    SMB Small Req/Resp Buffer: 1 Pool size: 30
    Operations (MIDs): 0

    1 session 2 share reconnects
    Total vfs operations: 23 maximum at one time: 2

    1) \\localhost\test
    SMBs: 45
    TreeConnects: 2 total 0 failed
    TreeDisconnects: 0 total 0 failed
    Creates: 13 total 2 failed
    Closes: 9 total 0 failed
    Flushes: 0 total 0 failed
    Reads: 0 total 0 failed
    Writes: 1 total 0 failed
    Locks: 0 total 0 failed
    IOCTLs: 3 total 1 failed
    QueryDirectories: 4 total 2 failed
    ChangeNotifies: 0 total 0 failed
    QueryInfos: 10 total 0 failed
    SetInfos: 3 total 0 failed
    OplockBreaks: 0 sent 0 failed

    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Steve French
     
  • For SMB2/SMB3 the number of requests sent was not displayed
    in /proc/fs/cifs/Stats unless CONFIG_CIFS_STATS2 was
    enabled (only number of failed requests displayed). As
    with earlier dialects, we should be displaying these
    counters if CONFIG_CIFS_STATS is enabled. They
    are important for debugging.

    e.g. when you cat /proc/fs/cifs/Stats (before the patch)
    Resources in use
    CIFS Session: 1
    Share (unique mount targets): 2
    SMB Request/Response Buffer: 1 Pool size: 5
    SMB Small Req/Resp Buffer: 1 Pool size: 30
    Operations (MIDs): 0

    0 session 0 share reconnects
    Total vfs operations: 690 maximum at one time: 2

    1) \\localhost\test
    SMBs: 975
    Negotiates: 0 sent 0 failed
    SessionSetups: 0 sent 0 failed
    Logoffs: 0 sent 0 failed
    TreeConnects: 0 sent 0 failed
    TreeDisconnects: 0 sent 0 failed
    Creates: 0 sent 2 failed
    Closes: 0 sent 0 failed
    Flushes: 0 sent 0 failed
    Reads: 0 sent 0 failed
    Writes: 0 sent 0 failed
    Locks: 0 sent 0 failed
    IOCTLs: 0 sent 1 failed
    Cancels: 0 sent 0 failed
    Echos: 0 sent 0 failed
    QueryDirectories: 0 sent 63 failed

    Signed-off-by: Steve French
    Reviewed-by: Aurelien Aptel
    Reviewed-by: Pavel Shilovsky

    Steve French
     
  • snapshot mounts were not marked as read-only and did not display the snapshot
    time (in /proc/mounts) specified on mount

    With this patch - note that can not write to the snapshot mount (see "ro" in
    /proc/mounts line) and also the missing snapshot timewarp token time is
    dumped. Sample line from /proc/mounts with the patch:

    //127.0.0.1/scratch /mnt2 smb3 ro,relatime,vers=default,cache=strict,username=testuser,domain=,uid=0,noforceuid,gid=0,noforcegid,addr=127.0.0.1,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,noperm,rsize=1048576,wsize=1048576,echo_interval=60,snapshot=1234567,actimeo=1 0 0

    Signed-off-by: Steve French
    Reviewed-by: Paulo Alcantara

    Steve French
     
  • Some servers, like Samba, don't support the fsctl for
    query_network_interface_info so don't log a noisy warning
    message on mount for this by default unless the error is more serious.
    Lower the error to an FYI level so it does not get logged by
    default.

    Reviewed-by: Ronnie Sahlberg
    Reviewed-by: Aurelien Aptel
    Signed-off-by: Steve French

    Steve French
     
  • We really, really want to be encouraging use of secure dialects,
    and SMB3.1.1 offers useful security features, and will soon
    be the recommended dialect for many use cases. Simplify the code
    by removing the CONFIG_CIFS_SMB311 ifdef so users don't disable
    it in the build, and create compatibility and/or security issues
    with modern servers - many of which have been supporting this
    dialect for multiple years.

    Also clarify some of the Kconfig text for cifs.ko about
    SMB3.1.1 and current supported features in the module.

    Signed-off-by: Steve French
    Acked-by: Aurelien Aptel
    Reviewed-by: Ronnie Sahlberg

    Steve French
     
  • /proc/fs/cifs/DebugData displays the features (Kconfig options)
    used to build cifs.ko but it was missing some, and needed comma
    separator. These can be useful in debugging certain problems
    so we know which optional features were enabled in the user's build.
    Also clarify them, by making them more closely match the
    corresponding CONFIG_CIFS_* parm.

    Old format:
    Features: dfs fscache posix spnego xattr acl

    New format:
    Features: DFS,FSCACHE,SMB_DIRECT,STATS,DEBUG2,ALLOW_INSECURE_LEGACY,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL

    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg
    Reviewed-by: Pavel Shilovsky
    Reviewed-by: Paulo Alcantara
    CC: Stable

    Steve French