13 Oct, 2016

1 commit

  • Remove the global file_list_lock to simplify cifs/smb3 locking and
    have spinlocks that more closely match the information they are
    protecting.

    Add new tcon->open_file_lock and file->file_info_lock spinlocks.
    Locks continue to follow a heirachy,
    cifs_socket --> cifs_ses --> cifs_tcon --> cifs_file
    where global tcp_ses_lock still protects socket and cifs_ses, while the
    the newer locks protect the lower level structure's information
    (tcon and cifs_file respectively).

    CC: Stable
    Signed-off-by: Steve French
    Signed-off-by: Pavel Shilovsky
    Reviewed-by: Aurelien Aptel
    Reviewed-by: Germano Percossi

    Steve French
     

15 Jan, 2016

1 commit


16 Apr, 2015

1 commit


01 Apr, 2015

1 commit

  • Coverity reports a warning for referencing the beginning of the
    SMB2/SMB3 frame using the ProtocolId field as an array. Although
    it works the same either way, this patch should quiet the warning
    and might be a little clearer.

    Reported by Coverity (CID 741269)

    Signed-off-by: Steve French
    Acked-by: Shirish Pargaonkar
    Acked-by: Sachin Prabhu
    Reviewed-by: Jeff Layton

    Steve French
     

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

1 commit


17 Oct, 2014

1 commit


16 Aug, 2014

1 commit

  • response

    Writes fail to Mac servers with SMB2.1 mounts (works with cifs though) due
    to them sending an incorrect RFC1001 length for the SMB2.1 Write response.
    Workaround this problem. MacOS server sends a write response with 3 bytes
    of pad beyond the end of the SMB itself. The RFC1001 length is 3 bytes
    more than the sum of the SMB2.1 header length + the write reponse.

    Incorporate feedback from Jeff and JRA to allow servers to send
    a tcp frame that is even more than three bytes too long
    (ie much longer than the SMB2/SMB3 request that it contains) but
    we do log it once now. In the earlier version of the patch I had
    limited how far off the length field could be before we fail the request.

    Signed-off-by: Steve French

    Steve French
     

03 Aug, 2014

1 commit


17 Apr, 2014

1 commit

  • Problem reported in Red Hat bz 1040329 for strict writes where we cache
    only when we hold oplock and write direct to the server when we don't.

    When we receive an oplock break, we first change the oplock value for
    the inode in cifsInodeInfo->oplock to indicate that we no longer hold
    the oplock before we enqueue a task to flush changes to the backing
    device. Once we have completed flushing the changes, we return the
    oplock to the server.

    There are 2 ways here where we can have data corruption
    1) While we flush changes to the backing device as part of the oplock
    break, we can have processes write to the file. These writes check for
    the oplock, find none and attempt to write directly to the server.
    These direct writes made while we are flushing from cache could be
    overwritten by data being flushed from the cache causing data
    corruption.
    2) While a thread runs in cifs_strict_writev, the machine could receive
    and process an oplock break after the thread has checked the oplock and
    found that it allows us to cache and before we have made changes to the
    cache. In that case, we end up with a dirty page in cache when we
    shouldn't have any. This will be flushed later and will overwrite all
    subsequent writes to the part of the file represented by this page.

    Before making any writes to the server, we need to confirm that we are
    not in the process of flushing data to the server and if we are, we
    should wait until the process is complete before we attempt the write.
    We should also wait for existing writes to complete before we process
    an oplock break request which changes oplock values.

    We add a version specific downgrade_oplock() operation to allow for
    differences in the oplock values set for the different smb versions.

    Cc: stable@vger.kernel.org
    Signed-off-by: Sachin Prabhu
    Reviewed-by: Jeff Layton
    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Sachin Prabhu
     

10 Sep, 2013

2 commits


09 Sep, 2013

4 commits


27 Jun, 2013

1 commit

  • 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
     

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

6 commits


20 Aug, 2012

1 commit


25 Jul, 2012

5 commits