26 Sep, 2019

1 commit

  • We need to populate an ACL (security descriptor open context)
    on file and directory correct. This patch passes in the
    mode. Followon patch will build the open context and the
    security descriptor (from the mode) that goes in the open
    context.

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

    Steve French
     

17 Sep, 2019

4 commits

  • When a share is deleted, returning EIO is confusing and no useful
    information is logged. Improve the handling of this case by
    at least logging a better error for this (and also mapping the error
    differently to EREMCHG). See e.g. the new messages that would be logged:

    [55243.639530] server share \\192.168.1.219\scratch deleted
    [55243.642568] CIFS VFS: \\192.168.1.219\scratch BAD_NETWORK_NAME: \\192.168.1.219\scratch

    In addition for the case where a share is deleted and then recreated
    with the same name, have now fixed that so it works. This is sometimes
    done for example, because the admin had to move a share to a different,
    bigger local drive when a share is running low on space.

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

    Steve French
     
  • and convert smb2_query_path_info() to use it.
    This will eliminate the need for a SMB2_Create when we already have an
    open handle that can be used. This will also prevent a oplock break
    in case the other handle holds a lease.

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

    Ronnie Sahlberg
     
  • If we already have a writable handle for a path we want to set the
    attributes for then use that instead of a create/set-info/close compound.

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

    Ronnie Sahlberg
     
  • rename() takes a path for old_file and in SMB2 we used to just create
    a compound for create(old_path)/rename/close().
    If we already have a writable handle we can avoid the create() and close()
    altogether and just use the existing handle.

    For this situation, as we avoid doing the create()
    we also avoid triggering an oplock break for the existing handle.

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

    Ronnie Sahlberg
     

16 Jul, 2019

1 commit

  • RHBZ: 1722704

    In low memory situations the various SMB2_*_init() functions can fail
    to allocate a request PDU and thus leave the request iovector as NULL.

    If we don't check the return code for failure we end up calling
    smb2_set_next_command() with a NULL iovector causing a crash when it tries
    to dereference it.

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

    Ronnie Sahlberg
     

15 Mar, 2019

2 commits

  • Adds trace points for enter and exit (done vs. error) for:

    compounded query and setinfo, hardlink, rename,
    mkdir, rmdir, set_eof, delete (unlink)

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

    Steve French
     
  • When we open the shared root handle also ask for FILE_ALL_INFORMATION since
    we can do this at zero cost as part of a compound.
    Cache this information as long as the lease is held and return and serve any
    future requests from cache.

    This allows us to serve "stat /" directly from cache and avoid
    a network roundtrip. Since clients often want to do this quite a lot
    this improve performance slightly.

    As an example: xfstest generic/533 performs 43 stat operations on the root
    of the share while it is run. Which are eliminated with this patch.

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

    Ronnie Sahlberg
     

25 Jan, 2019

1 commit

  • If the server doesn't grant us at least 3 credits during the mount
    we won't be able to complete it because query path info operation
    requires 3 credits. Use the cached file handle if possible to allow
    the mount to succeed.

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

    Pavel Shilovsky
     

31 Dec, 2018

1 commit

  • We can not append small padding buffers as separate iovs when encryption is
    used. For this case we must flatten the request into a single buffer
    containing both the data from all the iovs as well as the padding bytes.

    This is at least needed for 4.20 as well due to compounding changes.

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

    Ronnie Sahlberg
     

19 Dec, 2018

1 commit

  • Some servers require that the setinfo matches the exact size,
    and in this case compounding changes introduced by
    commit c2e0fe3f5aae ("cifs: make rmdir() use compounding")
    caused us to send 8 bytes (padded length) instead of 1 byte
    (the size of the structure). See MS-FSCC section 2.4.11.

    Fixing this when we send a SET_INFO command for delete file
    disposition, then ends up as an iov of a single byte but this
    causes problems with SMB3 and encryption.

    To avoid this, instead of creating a one byte iov for the disposition value
    and then appending an additional iov with a 7 byte padding we now handle
    this as a single 8 byte iov containing both the disposition byte as well as
    the padding in one single buffer.

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

    Ronnie Sahlberg
     

24 Oct, 2018

12 commits


08 Aug, 2018

2 commits


08 Jun, 2018

1 commit


28 May, 2018

1 commit

  • In SMB2/SMB3 unlike in cifs we unnecessarily open the root of the share
    over and over again in various places during mount and path revalidation
    and also in statfs. This patch cuts redundant traffic (opens and closes)
    by simply keeping the directory handle for the root around (and reopening
    it as needed on reconnect), so query calls don't require three round
    trips to copmlete - just one, and eases load on network, client and
    server (on mount alone, cuts network traffic by more than a third).

    Also add a new cifs mount parm "nohandlecache" to allow users whose
    servers might have resource constraints (eg in case they have a server
    with so many users connecting to it that this extra handle per mount
    could possibly be a resource concern).

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

    Steve French
     

14 Oct, 2016

1 commit


18 May, 2016

1 commit

  • Wrong return code was being returned on SMB3 rmdir of
    non-empty directory.

    For SMB3 (unlike for cifs), we attempt to delete a directory by
    set of delete on close flag on the open. Windows clients set
    this flag via a set info (SET_FILE_DISPOSITION to set this flag)
    which properly checks if the directory is empty.

    With this patch on smb3 mounts we correctly return
    "DIRECTORY NOT EMPTY"
    on attempts to remove a non-empty directory.

    Signed-off-by: Steve French
    CC: Stable
    Acked-by: Sachin Prabhu

    Steve French
     

26 Aug, 2014

1 commit

  • The existing code uses the old MAX_NAME constant. This causes
    XFS test generic/013 to fail. Fix it by replacing MAX_NAME with
    PATH_MAX that SMB1 uses. Also remove an unused MAX_NAME constant
    definition.

    Cc: # v3.7+
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     

06 Aug, 2014

1 commit


12 Nov, 2013

1 commit

  • Now we treat any reparse point as a symbolic link and map it to a Unix
    one that is not true in a common case due to many reparse point types
    supported by SMB servers.

    Distinguish reparse point types into two groups:
    1) that can be accessed directly through a reparse point
    (junctions, deduplicated files, NFS symlinks);
    2) that need to be processed manually (Windows symbolic links, DFS);

    and map only Windows symbolic links to Unix ones.

    Cc:
    Acked-by: Jeff Layton
    Reported-and-tested-by: Joao Correia
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     

09 Sep, 2013

1 commit


11 Jul, 2013

3 commits


05 May, 2013

1 commit

  • It's not obvious from reading the macro names that these macros
    are for debugging. Convert the names to a single more typical
    kernel style cifs_dbg macro.

    cERROR(1, ...) -> cifs_dbg(VFS, ...)
    cFYI(1, ...) -> cifs_dbg(FYI, ...)
    cFYI(DBG2, ...) -> cifs_dbg(NOISY, ...)

    Move the terminating format newline from the macro to the call site.

    Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the
    "CIFS VFS: " prefix for VFS messages.

    Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y)

    $ size fs/cifs/cifs.ko*
    text data bss dec hex filename
    265245 2525 132 267902 4167e fs/cifs/cifs.ko.new
    268359 2525 132 271016 422a8 fs/cifs/cifs.ko.old

    Other miscellaneous changes around these conversions:

    o Miscellaneous typo fixes
    o Add terminating \n's to almost all formats and remove them
    from the macros to be more kernel style like. A few formats
    previously had defective \n's
    o Remove unnecessary OOM messages as kmalloc() calls dump_stack
    o Coalesce formats to make grep easier,
    added missing spaces when coalescing formats
    o Use %s, __func__ instead of embedded function name
    o Removed unnecessary "cifs: " prefixes
    o Convert kzalloc with multiply to kcalloc
    o Remove unused cifswarn macro

    Signed-off-by: Joe Perches
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Joe Perches
     

25 Sep, 2012

3 commits