06 Jan, 2017

1 commit

  • commit 96a988ffeb90dba33a71c3826086fe67c897a183 upstream.

    With the current code it is possible to lock a mutex twice when
    a subsequent reconnects are triggered. On the 1st reconnect we
    reconnect sessions and tcons and then persistent file handles.
    If the 2nd reconnect happens during the reconnecting of persistent
    file handles then the following sequence of calls is observed:

    cifs_reopen_file -> SMB2_open -> small_smb2_init -> smb2_reconnect
    -> cifs_reopen_persistent_file_handles -> cifs_reopen_file (again!).

    So, we are trying to acquire the same cfile->fh_mutex twice which
    is wrong. Fix this by moving reconnecting of persistent handles to
    the delayed work (smb2_reconnect_server) and submitting this work
    every time we reconnect tcon in SMB2 commands handling codepath.

    This can also lead to corruption of a temporary file list in
    cifs_reopen_persistent_file_handles() because we can recursively
    call this function twice.

    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Greg Kroah-Hartman

    Pavel Shilovsky
     

13 Oct, 2016

1 commit


15 Jan, 2016

1 commit


03 Nov, 2015

1 commit


29 Jun, 2015

4 commits


28 Jun, 2015

2 commits


15 Dec, 2014

1 commit

  • We have encountered failures when When testing smb2 mounts on ppc64
    machines when using both Samba as well as Windows 2012.

    On poking around, the problem was determined to be caused by the
    high endian MessageID passed in the header for smb2. On checking the
    corresponding MID for smb1 is converted to LE before being sent on the
    wire.

    We have tested this patch successfully on a ppc64 machine.

    Signed-off-by: Sachin Prabhu

    Sachin Prabhu
     

11 Dec, 2014

2 commits

  • Merge first patchbomb from Andrew Morton:
    - a few minor cifs fixes
    - dma-debug upadtes
    - ocfs2
    - slab
    - about half of MM
    - procfs
    - kernel/exit.c
    - panic.c tweaks
    - printk upates
    - lib/ updates
    - checkpatch updates
    - fs/binfmt updates
    - the drivers/rtc tree
    - nilfs
    - kmod fixes
    - more kernel/exit.c
    - various other misc tweaks and fixes

    * emailed patches from Andrew Morton : (190 commits)
    exit: pidns: fix/update the comments in zap_pid_ns_processes()
    exit: pidns: alloc_pid() leaks pid_namespace if child_reaper is exiting
    exit: exit_notify: re-use "dead" list to autoreap current
    exit: reparent: call forget_original_parent() under tasklist_lock
    exit: reparent: avoid find_new_reaper() if no children
    exit: reparent: introduce find_alive_thread()
    exit: reparent: introduce find_child_reaper()
    exit: reparent: document the ->has_child_subreaper checks
    exit: reparent: s/while_each_thread/for_each_thread/ in find_new_reaper()
    exit: reparent: fix the cross-namespace PR_SET_CHILD_SUBREAPER reparenting
    exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting
    exit: proc: don't try to flush /proc/tgid/task/tgid
    exit: release_task: fix the comment about group leader accounting
    exit: wait: drop tasklist_lock before psig->c* accounting
    exit: wait: don't use zombie->real_parent
    exit: wait: cleanup the ptrace_reparented() checks
    usermodehelper: kill the kmod_thread_locker logic
    usermodehelper: don't use CLONE_VFORK for ____call_usermodehelper()
    fs/hfs/catalog.c: fix comparison bug in hfs_cat_keycmp
    nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races
    ...

    Linus Torvalds
     
  • Replace all __constant_foo to foo() except in smb2status.h (1700 lines to
    update).

    Signed-off-by: Fabian Frederick
    Cc: Steve French
    Cc: Jeff Layton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

08 Dec, 2014

1 commit


17 Oct, 2014

1 commit


18 Aug, 2014

1 commit

  • Implement FALLOC_FL_PUNCH_HOLE (which does not change the file size
    fortunately so this matches the behavior of the equivalent SMB3
    fsctl call) for SMB3 mounts. This allows "fallocate -p" to work.
    It requires that the server support setting files as sparse
    (which Windows allows).

    Signed-off-by: Steve French

    Steve French
     

22 May, 2014

2 commits

  • Clarify comments for create contexts which we do send,
    and fix typo in one create context definition and add
    newer SMB3 create contexts to the list.

    Signed-off-by: Steve French

    Steve French
     
  • When mounting from a Windows 2012R2 server, we hit the following
    problem:
    1) Mount with any of the following versions - 2.0, 2.1 or 3.0
    2) unmount
    3) Attempt a mount again using a different SMB version >= 2.0.

    You end up with the following failure:
    Status code returned 0xc0000203 STATUS_USER_SESSION_DELETED
    CIFS VFS: Send error in SessSetup = -5
    CIFS VFS: cifs_mount failed w/return code = -5

    I cannot reproduce this issue using a Windows 2008 R2 server.

    This appears to be caused because we use the same client guid for the
    connection on first mount which we then disconnect and attempt to mount
    again using a different protocol version. By generating a new guid each
    time a new connection is Negotiated, we avoid hitting this problem.

    Signed-off-by: Sachin Prabhu
    Signed-off-by: Steve French

    Sachin Prabhu
     

20 Nov, 2013

1 commit

  • When we are running SMB3 or SMB3.02 connections which are signed
    we need to validate the protocol negotiation information,
    to ensure that the negotiate protocol response was not tampered with.

    Add the missing FSCTL which is sent at mount time (immediately after
    the SMB3 Tree Connect) to validate that the capabilities match
    what we think the server sent.

    "Secure dialect negotiation is introduced in SMB3 to protect against
    man-in-the-middle attempt to downgrade dialect negotiation.
    The idea is to prevent an eavesdropper from downgrading the initially
    negotiated dialect and capabilities between the client and the server."

    For more explanation see 2.2.31.4 of MS-SMB2 or
    http://blogs.msdn.com/b/openspecification/archive/2012/06/28/smb3-secure-dialect-negotiation.aspx

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

    Steve French
     

16 Nov, 2013

1 commit


14 Nov, 2013

1 commit

  • This first patch adds the ability for us to do a server side copy
    (ie fast copy offloaded to the server to perform, aka refcopy)

    "cp --reflink"

    of one file to another located on the same server. This
    is much faster than traditional copy (which requires
    reading and writing over the network and extra
    memcpys).

    This first version is not going to be copy
    files larger than about 1MB (to Samba) until I add
    support for multiple chunks and for autoconfiguring
    the chunksize.

    It includes:
    1) processing of the ioctl
    2) marshalling and sending the SMB2/SMB3 fsctl over the network
    3) simple parsing of the response

    It does not include yet (these will be in followon patches to come soon):
    1) support for multiple chunks
    2) support for autoconfiguring and remembering the chunksize
    3) Support for the older style copychunk which Samba 4.1 server supports
    (because this requires write permission on the target file, which
    cp does not give you, apparently per-posix). This may require
    a distinct tool (other than cp) and other ioctl to implement.

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

    Steve French
     

03 Nov, 2013

2 commits

  • An earlier patch allowed setting the per-file compression flag

    "chattr +c filename"

    on an smb2 or smb3 mount, and also allowed lsattr to return
    whether a file on a cifs, or smb2/smb3 mount was compressed.

    This patch extends the ability to set the per-file
    compression flag to the cifs protocol, which uses a somewhat
    different IOCTL mechanism than SMB2, although the payload
    (the flags stored in the compression_state) are the same.

    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     
  • In SMB3 it is now possible to query the file system
    alignment info, and the preferred (for performance)
    sector size and whether the underlying disk
    has no seek penalty (like SSD).

    Query this information at mount time for SMB3,
    and make it visible in /proc/fs/cifs/DebugData
    for debugging purposes.

    This alignment information and preferred sector
    size info will be helpful for the copy offload
    patches to setup the right chunks in the CopyChunk
    requests. Presumably the knowledge that the
    underlying disk is SSD could also help us
    make better readahead and writebehind
    decisions (something to look at in the future).

    Signed-off-by: Steve French

    Steven French
     

28 Oct, 2013

1 commit

  • Allow cifs/smb2/smb3 to return whether or not a file is compressed
    via lsattr, and allow SMB2/SMB3 to set the per-file compression
    flag ("chattr +c filename" on an smb3 mount).

    Windows users often set the compressed flag (it can be
    done from the desktop and file manager). David Disseldorp
    has patches to Samba server to support this (at least on btrfs)
    which are complementary to this

    Signed-off-by: Steve French

    Steve French
     

10 Sep, 2013

2 commits


09 Sep, 2013

1 commit


11 Jul, 2013

3 commits


27 Jun, 2013

2 commits

  • This worker function is needed to send SMB2 fsctl
    (and ioctl) requests including:

    validating negotiation info (secure negotiate)
    querying the servers network interfaces
    copy offload (refcopy)

    Followon patches for the above three will use this.
    This patch also does general validation of the response.

    In the future, as David Disseldorp notes, for the copychunk ioctl
    case, we will want to enhance the response processing to allow
    returning the chunk request limits to the caller (even
    though the server returns an error, in that case we would
    return data that the caller could use - see 2.2.32.1).

    See MS-SMB2 Section 2.2.31 for more details on format of fsctl.

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

    Steve French
     
  • Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     

24 Jun, 2013

3 commits


02 Oct, 2012

1 commit


25 Sep, 2012

4 commits