12 Jun, 2020

1 commit


02 Jun, 2020

1 commit


30 Mar, 2020

1 commit


23 Mar, 2020

7 commits

  • And add one missing define (COMPRESSION_TRANSFORM_ID) and
    flag (TRANSFORM_FLAG_ENCRYPTED)

    Signed-off-by: Steve French

    Steve French
     
  • New transform header structures. See recent updates
    to MS-SMB2 adding section 2.2.42.1 and 2.2.42.2

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

    Steve French
     
  • Additional compression capabilities can now be negotiated and a
    new compression algorithm. Add the flags for these.

    See newly updated MS-SMB2 sections 3.1.4.4.1 and 2.2.3.1.3

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

    Steve French
     
  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Steve French

    Gustavo A. R. Silva
     
  • allows SMB2_open() callers to pass down a POSIX data buffer that will
    trigger requesting POSIX create context and parsing the response into
    the provided buffer.

    Signed-off-by: Aurelien Aptel
    Signed-off-by: Steve French
    Reviewed-by: Paulo Alcantara (SUSE)

    Aurelien Aptel
     
  • * add new info level and structs for SMB2 posix extension
    * add functions to parse and validate it

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

    Aurelien Aptel
     
  • little progress on the posix create response.

    * rename struct to create_posix_rsp to match with the request
    create_posix context
    * make struct packed
    * pass smb info struct for parse_posix_ctxt to fill
    * use smb info struct as param
    * update TODO

    What needs to be done:

    SMB2_open() has an optional smb info out argument that it will fill.
    Callers making use of this are:

    - smb3_query_mf_symlink (need to investigate)
    - smb2_open_file

    Callers of smb2_open_file (via server->ops->open) are passing an
    smbinfo struct but that struct cannot hold POSIX information. All the
    call stack needs to be changed for a different info type. Maybe pass
    SMB generic struct like cifs_fattr instead.

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

    Aurelien Aptel
     

07 Feb, 2020

2 commits


27 Jan, 2020

1 commit


07 Dec, 2019

1 commit

  • When using the special SID to store the mode bits in an ACE (See
    http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx)
    which is enabled with mount parm "modefromsid" we were not
    passing in the mode via SMB3 create (although chmod was enabled).
    SMB3 create allows a security descriptor context to be passed
    in (which is more atomic and thus preferable to setting the mode
    bits after create via a setinfo).

    This patch enables setting the mode bits on create when using
    modefromsid mount option. In addition it fixes an endian
    error in the definition of the Control field flags in the SMB3
    security descriptor. It also makes the ACE type of the special
    SID better match the documentation (and behavior of servers
    which use this to store mode bits in SMB3 ACLs).

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

    Steve French
     

04 Dec, 2019

1 commit

  • Since timestamps on files on most servers can be updated at
    close, and since timestamps on our dentries default to one
    second we can have stale timestamps in some common cases
    (e.g. open, write, close, stat, wait one second, stat - will
    show different mtime for the first and second stat).

    The SMB2/SMB3 protocol allows querying timestamps at close
    so add the code to request timestamp and attr information
    (which is cheap for the server to provide) to be returned
    when a file is closed (it is not needed for the many
    paths that call SMB2_close that are from compounded
    query infos and close nor is it needed for some of
    the cases where a directory close immediately follows a
    directory open.

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

    Steve French
     

25 Nov, 2019

1 commit

  • Currenly we doesn't assume that a server may break a lease
    from RWH to RW which causes us setting a wrong lease state
    on a file and thus mistakenly flushing data and byte-range
    locks and purging cached data on the client. This leads to
    performance degradation because subsequent IOs go directly
    to the server.

    Fix this by propagating new lease state and epoch values
    to the oplock break handler through cifsFileInfo structure
    and removing the use of cifsInodeInfo flags for that. It
    allows to avoid some races of several lease/oplock breaks
    using those flags in parallel.

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

    Pavel Shilovsky
     

07 Nov, 2019

1 commit

  • When the client hits a network reconnect, it re-opens every open
    file with a create context to reconnect a persistent handle. All
    create context types should be 8-bytes aligned but the padding
    was missed for that one. As a result, some servers don't allow
    us to reconnect handles and return an error. The problem occurs
    when the problematic context is not at the end of the create
    request packet. Fix this by adding a proper padding at the end
    of the reconnect persistent handle context.

    Cc: Stable # 4.19.x
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     

17 Sep, 2019

1 commit

  • SMB3 and 3.1.1 added two additional flags including
    the priority mask. Add them to our protocol definitions
    in smb2pdu.h. See MS-SMB2 2.2.1.2

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

    Steve French
     

19 Jul, 2019

1 commit

  • We can cut one third of the traffic on open by not querying the
    inode number explicitly via SMB3 query_info since it is now
    returned on open in the qfid context.

    This is better in multiple ways, and
    speeds up file open about 10% (more if network is slow).

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

    Steve French
     

11 Jul, 2019

1 commit

  • RHBZ: 1672539

    In smb2_query_symlink(), if we are parsing the error buffer but it is not something
    we recognize as a symlink we should return -EINVAL and not -ENOENT.
    I.e. the entry does exist, it is just not something we recognize.

    Additionally, add check to verify that that the errortag and the reparsetag all make sense.

    Signed-off-by: Ronnie Sahlberg
    Acked-by: Paulo Alcantara
    Signed-off-by: Steve French

    Ronnie Sahlberg
     

08 Jul, 2019

5 commits

  • We can cut the number of roundtrips on open (may also
    help some rename cases as well) by returning the inode
    number in the SMB2 open request itself instead of
    querying it afterwards via a query FILE_INTERNAL_INFO.
    This should significantly improve the performance of
    posix open.

    Add SMB2_CREATE_QUERY_ON_DISK_ID create context request
    on open calls so that when server supports this we
    can save a roundtrip for QUERY_INFO on every open.

    Follow on patch will add the response processing for
    SMB2_CREATE_QUERY_ON_DISK_ID context and optimize
    smb2_open_file to avoid the extra network roundtrip
    on every posix open. This patch adds the context on
    SMB2/SMB3 open requests.

    Signed-off-by: Steve French

    Steve French
     
  • See MS-SMB2 2.2.3.1.4

    Allows hostname to be used by load balancers

    Signed-off-by: Steve French

    Steve French
     
  • query on disk id structure definition was missing

    Signed-off-by: Steve French

    Steve French
     
  • When using multidialect negotiate (default or specifying vers=3.0 which
    allows any smb3 dialect), fix how we check for an existing server session.
    Before this fix if you mounted a second time to the same server (e.g. a
    different share on the same server) we would only reuse the existing smb
    session if a single dialect were requested (e.g. specifying vers=2.1 or vers=3.0
    or vers=3.1.1 on the mount command). If a default mount (e.g. not
    specifying vers=) is done then would always create a new socket connection
    and SMB3 (or SMB3.1.1) session each time we connect to a different share
    on the same server rather than reusing the existing one.

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

    Steve French
     
  • GCM is faster. Request it during negotiate protocol.
    Followon patch will add callouts to GCM crypto

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

    Steve French
     

28 Jun, 2019

1 commit

  • We never parsed/returned any data from .get_link() when the object is a windows reparse-point
    containing a symlink. This results in the VFS layer oopsing accessing an uninitialized buffer:

    ...
    [ 171.407172] Call Trace:
    [ 171.408039] readlink_copy+0x29/0x70
    [ 171.408872] vfs_readlink+0xc1/0x1f0
    [ 171.409709] ? readlink_copy+0x70/0x70
    [ 171.410565] ? simple_attr_release+0x30/0x30
    [ 171.411446] ? getname_flags+0x105/0x2a0
    [ 171.412231] do_readlinkat+0x1b7/0x1e0
    [ 171.412938] ? __ia32_compat_sys_newfstat+0x30/0x30
    ...

    Fix this by adding code to handle these buffers and make sure we do return a valid buffer
    to .get_link()

    CC: Stable
    Signed-off-by: Ronnie Sahlberg
    Signed-off-by: Steve French

    Ronnie Sahlberg
     

08 May, 2019

5 commits


15 Mar, 2019

1 commit


06 Mar, 2019

1 commit


30 Jan, 2019

2 commits


04 Jan, 2019

1 commit

  • SMB3.1.1 dialect has additional security (among other) features
    and should be requested when mounting to modern servers so it
    can be used if the server supports it.

    Add SMB3.1.1 to the default list of dialects requested.

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

    Steve French
     

24 Dec, 2018

1 commit


03 Nov, 2018

1 commit


24 Oct, 2018

2 commits