23 Oct, 2020

1 commit


17 Sep, 2019

1 commit

  • Introduce a new CONFIG_CIFS_ROOT option to handle root file systems
    over a SMB share.

    In order to mount the root file system during the init process, make
    cifs.ko perform non-blocking socket operations while mounting and
    accessing it.

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

    Paulo Alcantara (SUSE)
     

08 Jul, 2019

1 commit


29 Dec, 2018

1 commit

  • * Add new dfs_cache.[ch] files

    * Add new /proc/fs/cifs/dfscache file
    - dump current cache when read
    - clear current cache when writing "0" to it

    * Add delayed_work to periodically refresh cache entries

    The new interface will be used for caching DFS referrals, as well as
    supporting client target failover.

    The DFS cache is a hashtable that maps UNC paths to cache entries.

    A cache entry contains:
    - the UNC path it is mapped on
    - how much the the UNC path the entry consumes
    - flags
    - a Time-To-Live after which the entry expires
    - a list of possible targets (linked lists of UNC paths)
    - a "hint target" pointing the last known working target or the first
    target if none were tried. This hint lets cifs.ko remember and try
    working targets first.

    * Looking for an entry in the cache is done with dfs_cache_find()
    - if no valid entries are found, a DFS query is made, stored in the
    cache and returned
    - the full target list can be copied and returned to avoid race
    conditions and looped on with the help with the
    dfs_cache_tgt_iterator

    * Updating the target hint to the next target is done with
    dfs_cache_update_tgthint()

    These functions have a dfs_cache_noreq_XXX() version that doesn't
    fetches referrals if no entries are found. These versions don't
    require the tcp/ses/tcon/cifs_sb parameters as a result.

    Expired entries cannot be used and since they have a pretty short TTL
    [1] in order for them to be useful for failover the DFS cache adds a
    delayed work called periodically to keep them fresh.

    Since we might not have available connections to issue the referral
    request when refreshing we need to store volume_info structs with
    credentials and other needed info to be able to connect to the right
    server.

    1: Windows defaults: 5mn for domain-based referrals, 30mn for regular
    links

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

    Paulo Alcantara
     

28 May, 2018

1 commit

  • Although dmesg logs and wireshark network traces can be
    helpful, being able to dynamically enable/disable tracepoints
    (in this case via the kernel ftrace mechanism) can also be
    helpful in more quickly debugging problems, and more
    selectively tracing the events related to the bug report.

    This patch adds 12 ftrace tracepoints to cifs.ko for SMB3 events
    in some obvious locations. Subsequent patches will add more
    as needed.

    Example use:
    trace-cmd record -e cifs

    trace-cmd show

    Various trace events can be filtered. See:
    trace-cmd list | grep cifs
    for the current list of cifs tracepoints.

    Sample output (from mount and writing to a file):

    root@smf:/sys/kernel/debug/tracing/events/cifs# trace-cmd show

    mount.cifs-6633 [006] .... 7246.936461: smb3_cmd_done: pid=6633 tid=0x0 sid=0x0 cmd=0 mid=0
    mount.cifs-6633 [006] .... 7246.936701: smb3_cmd_err: pid=6633 tid=0x0 sid=0x3d9cf8e5 cmd=1 mid=1 status=0xc0000016 rc=-5
    mount.cifs-6633 [006] .... 7246.943055: smb3_cmd_done: pid=6633 tid=0x0 sid=0x3d9cf8e5 cmd=1 mid=2
    mount.cifs-6633 [006] .... 7246.943298: smb3_cmd_done: pid=6633 tid=0xf9447636 sid=0x3d9cf8e5 cmd=3 mid=3
    mount.cifs-6633 [006] .... 7246.943446: smb3_cmd_done: pid=6633 tid=0xf9447636 sid=0x3d9cf8e5 cmd=11 mid=4
    mount.cifs-6633 [006] .... 7246.943659: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=3 mid=5
    mount.cifs-6633 [006] .... 7246.943766: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=11 mid=6
    mount.cifs-6633 [006] .... 7246.943937: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=5 mid=7
    mount.cifs-6633 [006] .... 7246.944020: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=16 mid=8
    mount.cifs-6633 [006] .... 7246.944091: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=16 mid=9
    mount.cifs-6633 [006] .... 7246.944163: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=16 mid=10
    mount.cifs-6633 [006] .... 7246.944218: smb3_cmd_err: pid=6633 tid=0xf9447636 sid=0x3d9cf8e5 cmd=11 mid=11 status=0xc0000225 rc=-2
    mount.cifs-6633 [006] .... 7246.944219: smb3_fsctl_err: xid=0 fid=0xffffffffffffffff tid=0xf9447636 sid=0x3d9cf8e5 class=0 type=393620 rc=-2
    mount.cifs-6633 [007] .... 7246.944353: smb3_cmd_done: pid=6633 tid=0xe1b781a sid=0x3d9cf8e5 cmd=16 mid=12
    bash-2071 [000] .... 7256.903844: smb3_cmd_done: pid=2071 tid=0xe1b781a sid=0x3d9cf8e5 cmd=5 mid=13
    bash-2071 [000] .... 7256.904172: smb3_cmd_done: pid=2071 tid=0xe1b781a sid=0x3d9cf8e5 cmd=16 mid=14
    bash-2071 [000] .... 7256.904471: smb3_cmd_done: pid=2071 tid=0xe1b781a sid=0x3d9cf8e5 cmd=17 mid=15
    bash-2071 [000] .... 7256.904950: smb3_cmd_done: pid=2071 tid=0xe1b781a sid=0x3d9cf8e5 cmd=5 mid=16
    bash-2071 [000] .... 7256.905305: smb3_cmd_done: pid=2071 tid=0xe1b781a sid=0x3d9cf8e5 cmd=17 mid=17
    bash-2071 [000] .... 7256.905688: smb3_cmd_done: pid=2071 tid=0xe1b781a sid=0x3d9cf8e5 cmd=6 mid=18
    bash-2071 [000] .... 7256.905809: smb3_write_done: xid=0 fid=0xd628f511 tid=0xe1b781a sid=0x3d9cf8e5 offset=0x0 len=0x1b

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

    Steve French
     

25 Jan, 2018

1 commit

  • Add code to implement the core functions to establish a SMB Direct connection.

    1. Establish an RDMA connection to SMB server.
    2. Negotiate and setup SMB Direct protocol.
    3. Implement idle connection timer and credit management.

    SMB Direct is enabled by setting CONFIG_CIFS_SMB_DIRECT.

    Add to Makefile to enable building SMB Direct.

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

    Long Li
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

09 Jul, 2017

1 commit

  • Remove the CONFIG_CIFS_SMB2 ifdef and Kconfig option since they
    must always be on now.

    For various security reasons, SMB3 and later are STRONGLY preferred
    over CIFS and older dialects, and SMB3 (and later) will now be
    the default dialects so we do not want to allow them to be
    ifdeffed out.

    In the longer term, we may be able to make older CIFS support
    disableable in Kconfig with a new set of #ifdef, but we always
    want SMB3 and later support enabled.

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

    Steve French
     

24 Apr, 2016

1 commit

  • Use xattr handlers for resolving attribute names. The amount of setup
    code required on cifs is nontrivial, so use the same get and set
    functions for all handlers, with switch statements for the different
    types of attributes in them.

    The set_EA handler can handle NULL values, so we don't need a separate
    removexattr function anymore. Remove the cifs_dbg statements related to
    xattr name resolution; they don't add much. Don't build xattr.o when
    CONFIG_CIFS_XATTR is not defined.

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Al Viro

    Andreas Gruenbacher
     

09 Sep, 2013

1 commit

  • The existing NLS case conversion routines do not appropriately handle
    the (now common) case where the local host is using UTF8. This is
    because nls_utf8 has no support at all for converting a utf8 string
    between cases and the NLS infrastructure in general cannot handle
    a multibyte input character.

    In any case, what we really need for cifs is to emulate how we expect
    the server to convert the character to upper or lowercase. Thus, even
    if we had routines that could handle utf8 case conversion, we likely
    would end up with the wrong result if the name ends up being in the
    upper planes.

    This patch adds a new scheme for doing unicode case conversion. The
    case conversion tables that Microsoft has published for Windows 8
    have been converted to a set of lookup tables, and a routine is
    added to convert a wchar_t from lower to uppercase using those
    tables.

    Reported-and-Tested-by: Jan-Marek Glogowski
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

25 Sep, 2012

1 commit


25 Jul, 2012

3 commits


24 Jul, 2012

2 commits


23 May, 2012

1 commit

  • As with Linux nfs client, which uses "nfsvers=" or "vers=" to
    indicate which protocol to use for mount, specifying

    "vers=2.1"

    will force an SMB2 mount. When vers is not specified CIFS is used

    "vers=1"

    We can eventually autonegotiate down from SMB2 to CIFS
    when SMB2 is stable enough to make it the default, but this
    is for the future. At that time we could also implement a
    "maxprotocol" mount option as smbclient and Samba have today,
    but that would be premature until SMB2 is stable.

    Intially the SMB2 Kconfig option will depend on "BROKEN"
    until the merge is complete, and then be "EXPERIMENTAL"
    When it is no longer experimental we can consider changing
    the default protocol to attempt first.

    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Acked-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Steve French
     

17 May, 2012

1 commit


19 May, 2011

1 commit

  • local cifs functions (repost)

    Using kernel crypto APIs for DES encryption during LM and NT hash generation
    instead of local functions within cifs.
    Source file smbdes.c is deleted sans four functions, one of which
    uses ecb des functionality provided by kernel crypto APIs.

    Remove function SMBOWFencrypt.

    Add return codes to various functions such as calc_lanman_hash,
    SMBencrypt, and SMBNTencrypt. Includes fix noticed by Dan Carpenter.

    Signed-off-by: Shirish Pargaonkar
    CC: Dan Carpenter
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     

28 Jan, 2011

1 commit

  • Replaced md4 hashing function local to cifs module with kernel crypto APIs.
    As a result, md4 hashing function and its supporting functions in
    file md4.c are not needed anymore.

    Cleaned up function declarations, removed forward function declarations,
    and removed a header file that is being deleted from being included.

    Verified that sec=ntlm/i, sec=ntlmv2/i, and sec=ntlmssp/i work correctly.

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

    Shirish Pargaonkar
     

26 Jan, 2011

1 commit


07 Dec, 2010

1 commit

  • Some of the code under CONFIG_CIFS_ACL is dependent upon code under
    CONFIG_CIFS_EXPERIMENTAL, but the Kconfig options don't reflect that
    dependency. Move more of the ACL code out from under
    CONFIG_CIFS_EXPERIMENTAL and under CONFIG_CIFS_ACL.

    Also move find_readable_file out from other any sort of Kconfig
    option and make it a function normally compiled in.

    Reported-and-Acked-by: Randy Dunlap
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

02 Aug, 2010

2 commits

  • Define server-level cache index objects (as managed by TCP_ServerInfo structs)
    and register then with FS-Cache. Each server object is created in the CIFS
    top-level index object and is itself an index into which superblock-level
    objects are inserted.

    The server objects are now keyed by {IPaddress,family,port} tuple.

    Signed-off-by: Suresh Jayaraman
    Signed-off-by: Steve French

    Suresh Jayaraman
     
  • Define CIFS for FS-Cache and register for caching. Upon registration the
    top-level index object cookie will be stuck to the netfs definition by
    FS-Cache.

    Signed-off-by: Suresh Jayaraman
    Signed-off-by: Steve French

    Suresh Jayaraman
     

01 Jan, 2009

1 commit

  • Remove the hopelessly misguided ->dir_notify(). The only instance (cifs)
    has been broken by design from the very beginning; the objects it creates
    are never destroyed, keep references to struct file they can outlive, nothing
    that could possibly evict them exists on close(2) path *and* no locking
    whatsoever is done to prevent races with close(), should the previous, er,
    deficiencies someday be dealt with.

    Signed-off-by: Al Viro

    Al Viro
     

25 Jan, 2008

1 commit


10 Jan, 2008

1 commit


03 Nov, 2007

1 commit

  • Add routines to handle upcalls to userspace via keyctl for the purpose
    of getting a SPNEGO blob for a particular uid and server combination.

    Clean up the Makefile a bit and set it up to only compile cifs_spnego
    if CONFIG_CIFS_UPCALL is set. Also change CONFIG_CIFS_UPCALL to depend
    on CONFIG_KEYS rather than CONFIG_CONNECTOR.

    cifs_spnego.h defines the communications between kernel and userspace
    and is intended to be shared with userspace programs.

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

    Jeff Layton
     

26 Sep, 2007

1 commit


27 Feb, 2007

1 commit

  • For nfsd to work over cifs mounts (which presumably makes sense when trying
    to reexport mounts to windows, network appliances or Samba servers to nfs
    clients via nfs server).

    This is the first stage of that enablement, marked experimental and turned
    off by default.

    Signed-off-by: Steve French

    Steve French
     

01 Jun, 2006

1 commit


14 Feb, 2006

1 commit

  • The cifs session setup code has three cases, and a fourth for backlevel
    LANMAN2 style session setup needed to be added. This new session setup
    implmentation will eventually replace the other three and should be
    easier to read while fixing a few minor problems (not setting
    the LARGE READ/WRITEX flags when NTLMSSP was negotiated for example) and
    adding support for NTLMv2 (which will be added with the next patch. In the
    meantime, this code is marked in an CONFIG_CIFS_EXPERIMENTAL block and will
    not be turned on by default until it is tested against more server types.

    Signed-off-by: Steve French

    Steve French
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds