17 Sep, 2019

2 commits


08 Jul, 2019

2 commits

  • There is a special ACE used by some servers to allow the mode
    bits to be stored. This can be especially helpful in scenarios
    in which the client is trusted, and access checking on the
    client vs the POSIX mode bits is sufficient.

    Add mount option to allow enabling this behavior.
    Follow on patch will add support for chmod and queryinfo
    (stat) by retrieving the POSIX mode bits from the special
    ACE, SID: S-1-5-88-3

    See e.g.
    https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/hh509017(v=ws.10)

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

    Steve French
     
  • Fix mount options comparison when serverino option is turned off later
    in cifs_autodisable_serverino() and thus avoiding mismatch of new cifs
    mounts.

    Cc: stable@vger.kernel.org
    Signed-off-by: Paulo Alcantara (SUSE)
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Paulo Alcantara (SUSE)
     

05 Mar, 2019

1 commit

  • We negotiate rsize mounts (and it can be overridden by user) to
    typically 4MB, so using larger default I/O sizes from userspace
    (changing to 1MB default i/o size returned by stat) the
    performance is much better (and not just for long latency
    network connections) in most use cases for SMB3 than the default I/O
    size (which ends up being 128K for cp and can be even smaller for cp).
    This can be 4x slower or worse depending on network latency.

    By changing inode->blocksize from 32K (which was perhaps ok
    for very old SMB1/CIFS) to a larger value, 1MB (but still less than
    max size negotiated with the server which is 4MB, in order to minimize
    risk) it significantly increases performance for the
    noncached case, and slightly increases it for the cached case.
    This can be changed by the user on mount (specifying bsize=
    values from 16K to 16MB) to tune better for performance
    for applications that depend on blocksize.

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

    Steve French
     

29 Dec, 2018

1 commit


24 Oct, 2018

1 commit

  • tcon->Flags is only used by SMB1 code and changing it is not permanent
    (you lose the setting on tcon reconnect).

    * Move the setting to superblock flags (per mount-points).
    * Make automount callback exit early when flag present
    * Make dfs resolving happening in mount syscall exit early if flag present

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

    Aurelien Aptel
     

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
     

28 Nov, 2017

1 commit

  • This is a pure automated search-and-replace of the internal kernel
    superblock flags.

    The s_flags are now called SB_*, with the names and the values for the
    moment mirroring the MS_* flags that they're equivalent to.

    Note how the MS_xyz flags are the ones passed to the mount system call,
    while the SB_xyz flags are what we then use in sb->s_flags.

    The script to do this was:

    # places to look in; re security/*: it generally should *not* be
    # touched (that stuff parses mount(2) arguments directly), but
    # there are two places where we really deal with superblock flags.
    FILES="drivers/mtd drivers/staging/lustre fs ipc mm \
    include/linux/fs.h include/uapi/linux/bfs_fs.h \
    security/apparmor/apparmorfs.c security/apparmor/include/lib.h"
    # the list of MS_... constants
    SYMS="RDONLY NOSUID NODEV NOEXEC SYNCHRONOUS REMOUNT MANDLOCK \
    DIRSYNC NOATIME NODIRATIME BIND MOVE REC VERBOSE SILENT \
    POSIXACL UNBINDABLE PRIVATE SLAVE SHARED RELATIME KERNMOUNT \
    I_VERSION STRICTATIME LAZYTIME SUBMOUNT NOREMOTELOCK NOSEC BORN \
    ACTIVE NOUSER"

    SED_PROG=
    for i in $SYMS; do SED_PROG="$SED_PROG -e s/MS_$i/SB_$i/g"; done

    # we want files that contain at least one of MS_...,
    # with fs/namespace.c and fs/pnode.c excluded.
    L=$(for i in $SYMS; do git grep -w -l MS_$i $FILES; done| sort|uniq|grep -v '^fs/namespace.c'|grep -v '^fs/pnode.c')

    for f in $L; do sed -i $f $SED_PROG; done

    Requested-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

21 Apr, 2017

1 commit

  • Allocate struct backing_dev_info separately instead of embedding it
    inside superblock. This unifies handling of bdi among users.

    CC: Steve French
    CC: linux-cifs@vger.kernel.org
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Jens Axboe

    Jan Kara
     

15 Oct, 2016

1 commit


28 Jul, 2016

1 commit

  • if, when mounting //HOST/share/sub/dir/foo we can query /sub/dir/foo but
    not any of the path components above:

    - store the /sub/dir/foo prefix in the cifs super_block info
    - in the superblock, set root dentry to the subpath dentry (instead of
    the share root)
    - set a flag in the superblock to remember it
    - use prefixpath when building path from a dentry

    fixes bso#8950

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

    Aurelien Aptel
     

17 Oct, 2014

1 commit

  • This allows directory listings to Mac to display filenames
    correctly which have been created with illegal (to Windows)
    characters in their filename. It does not allow
    converting the other direction yet ie opening files with
    these characters (followon patch).

    There are seven reserved characters that need to be remapped when
    mounting to Windows, Mac (or any server without Unix Extensions) which
    are valid in POSIX but not in the other OS.

    : \ < > ? * |

    We used the normal UCS-2 remap range for this in order to convert this
    to/from UTF8 as did Windows Services for Unix (basically add 0xF000 to
    any of the 7 reserved characters), at least when the "mapchars" mount
    option was specified.

    Mac used a very slightly different "Services for Mac" remap range
    0xF021 through 0xF027. The attached patch allows cifs.ko (the kernel
    client) to read directories on macs containing files with these
    characters and display their names properly. In theory this even
    might be useful on mounts to Samba when the vfs_catia or new
    "vfs_fruit" module is loaded.

    Currently the 7 reserved characters look very strange in directory
    listings from cifs.ko to Mac server. This patch allows these file
    name characters to be read (requires specifying mapchars on mount).

    Two additional changes are needed:
    1) Make it more automatic: a way of detecting enough info so that
    we know to try to always remap these characters or not. Various
    have suggested that the SFM approach be made the default when
    the server does not support POSIX Unix extensions (cifs mounts
    to Samba for example) so need to make SFM remapping the default
    unless mapchars (SFU style mapping) specified on mount or no
    mapping explicitly requested or no mapping needed (cifs mounts to Samba).

    2) Adding a patch to map the characters the other direction
    (ie UTF-8 to UCS-2 on open). This patch does it for translating
    readdir entries (ie UCS-2 to UTF-8)

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

    Steve French
     

25 Oct, 2013

1 commit


13 Feb, 2013

1 commit


04 Jan, 2012

1 commit


13 Oct, 2011

1 commit

  • Add mount options backupuid and backugid.

    It allows an authenticated user to access files with the intent to back them
    up including their ACLs, who may not have access permission but has
    "Backup files and directories user right" on them (by virtue of being part
    of the built-in group Backup Operators.

    When mount options backupuid is specified, cifs client restricts the
    use of backup intents to the user whose effective user id is specified
    along with the mount option.

    When mount options backupgid is specified, cifs client restricts the
    use of backup intents to the users whose effective user id belongs to the
    group id specified along with the mount option.

    If an authenticated user is not part of the built-in group Backup Operators
    at the server, access to such files is denied, even if allowed by the client.

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

    Shirish Pargaonkar
     

25 Jun, 2011

1 commit

  • To close sget() races we'll need to be able to set cifs_sb up before
    we get the superblock, so we'll want to be able to do cifs_mount()
    earlier. Fortunately, it's easy to do - setting ->s_maxbytes can
    be done in cifs_read_super(), ditto for ->s_time_gran and as for
    putting MS_POSIXACL into ->s_flags, we can mirror it in ->mnt_cifs_flags
    until cifs_read_super() is called. Kill unused 'devname' argument,
    while we are at it...

    Acked-by: Pavel Shilovsky
    Reviewed-by: Jeff Layton
    Signed-off-by: Al Viro

    Al Viro
     

27 May, 2011

2 commits

  • Add rwpidforward mount option that switches on a mode when we forward
    pid of a process who opened a file to any read and write operation.

    This can prevent applications like WINE from failing on read or write
    operation on a previously locked file region from the same netfd from
    another process if we use mandatory brlock style.

    It is actual for WINE because during a run of WINE program two processes
    work on the same netfd - share the same file struct between several VFS
    fds:
    1) WINE-server does open and lock;
    2) WINE-application does read and write.

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

    Pavel Shilovsky
     
  • Now we point superblock to a server share root and set a root dentry
    appropriately. This let us share superblock between mounts like
    //server/sharename/foo/bar and //server/sharename/foo further.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky

    Signed-off-by: Steve French

    Steve French
     

19 May, 2011

1 commit

  • Previously mount options were copied and updated in the cifs_sb_info
    struct only when CONFIG_CIFS_DFS_UPCALL was enabled. Making this
    information generally available allows us to remove a number of ifdefs,
    extra function params, and temporary variables.

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

    Sean Finney
     

21 Jan, 2011

1 commit


03 Dec, 2010

1 commit

  • Currently, the attribute cache timeout for CIFS is hardcoded to 1 second. This
    means that the client might have to issue a QPATHINFO/QFILEINFO call every 1
    second to verify if something has changes, which seems too expensive. On the
    other hand, if the timeout is hardcoded to a higher value, workloads that
    expect strict cache coherency might see unexpected results.

    Making attribute cache timeout as a tunable will allow us to make a tradeoff
    between performance and cache metadata correctness depending on the
    application/workload needs.

    Add 'actimeo' tunable that can be used to tune the attribute cache timeout.
    The default timeout is set to 1 second. Also, display actimeo option value in
    /proc/mounts.

    It appears to me that 'actimeo' and the proposed (but not yet merged)
    'strictcache' option cannot coexist, so care must be taken that we reset the
    other option if one of them is set.

    Changes since last post:
    - fix option parsing and handle possible values correcly

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

    Suresh Jayaraman
     

03 Nov, 2010

2 commits

  • Radix trees are ideal when you want to track a bunch of pointers and
    can't embed a tracking structure within the target of those pointers.
    The tradeoff is an increase in memory, particularly if the tree is
    sparse.

    In CIFS, we use the tlink_tree to track tcon_link structs. A tcon_link
    can never be in more than one tlink_tree, so there's no impediment to
    using a rb_tree here instead of a radix tree.

    Convert the new multiuser mount code to use a rb_tree instead. This
    should reduce the memory required to manage the tlink_tree.

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

    Jeff Layton
     
  • This is the second version of this patch, the only difference between
    it and the first one is that this explicitly makes cifs_sb_master_tlink
    a static inline.

    Instead of keeping a tag on the master tlink in the tree, just keep a
    pointer to the master in the superblock. That eliminates the need for
    using the radix tree to look up a tagged entry.

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

    Jeff Layton
     

13 Oct, 2010

1 commit

  • Filesystems aren't really supposed to do anything with a vfsmount. It's
    considered a layering violation since vfsmounts are entirely managed at
    the VFS layer.

    CIFS currently keeps an active reference to a vfsmount in order to
    prevent the superblock vanishing before an oplock break has completed.
    What we really want to do instead is to keep sb->s_active high until the
    oplock break has completed. This patch borrows the scheme that NFS uses
    for handling sillyrenames.

    An atomic_t is added to the cifs_sb_info. When it transitions from 0 to
    1, an extra reference to the superblock is taken (by bumping the
    s_active value). When it transitions from 1 to 0, that reference is
    dropped and a the superblock teardown may proceed if there are no more
    references to it.

    Also, the vfsmount pointer is removed from cifsFileInfo and from
    cifs_new_fileinfo, and some bogus forward declarations are removed from
    cifsfs.h.

    Signed-off-by: Jeff Layton
    Reviewed-by: Suresh Jayaraman
    Acked-by: Dave Kleikamp
    Signed-off-by: Steve French

    Jeff Layton
     

08 Oct, 2010

2 commits

  • Create a workqueue job that cleans out unused tlinks. For now, it uses
    a hardcoded expire time of 10 minutes. When it's done, the work rearms
    itself. On umount, the work is cancelled before tearing down the tlink
    tree.

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

    Jeff Layton
     
  • This patch is rather large, but it's a bit difficult to do piecemeal...

    For non-multiuser mounts, everything will basically work as it does
    today. A call to cifs_sb_tlink will return the "master" tcon link.

    Turn the tcon pointer in the cifs_sb into a radix tree that uses the
    fsuid of the process as a key. The value is a new "tcon_link" struct
    that contains info about a tcon that's under construction.

    When a new process needs a tcon, it'll call cifs_sb_tcon. That will
    then look up the tcon_link in the radix tree. If it exists and is
    valid, it's returned.

    If it doesn't exist, then we stuff a new tcon_link into the tree and
    mark it as pending and then go and try to build the session/tcon.
    If that works, the tcon pointer in the tcon_link is updated and the
    pending flag is cleared.

    If the construction fails, then we set the tcon pointer to an ERR_PTR
    and clear the pending flag.

    If the radix tree is searched and the tcon_link is marked pending
    then we go to sleep and wait for the pending flag to be cleared.

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

    Jeff Layton
     

07 Oct, 2010

1 commit


30 Sep, 2010

2 commits


02 Aug, 2010

1 commit

  • Add a mount option 'fsc' to enable local caching on CIFS.

    I considered adding a separate debug bit for caching, but it appears that
    debugging would be relatively easier with the normal CIFS_INFO level.

    As the cifs-utils (userspace) changes are not done yet, this patch enables
    'fsc' by default to enable testing.

    Signed-off-by: Suresh Jayaraman
    Acked-by: David Howells
    Signed-off-by: Steve French

    Suresh Jayaraman
     

22 Apr, 2010

1 commit


12 Mar, 2009

2 commits

  • Signed-off-by: Steve French

    Steve French
     
  • If this mount option is set, when an application does an
    fsync call then the cifs client does not send an SMB Flush
    to the server (to force the server to write all dirty data
    for this file immediately to disk), although cifs still sends
    all dirty (cached) file data to the server and waits for the
    server to respond to the write write. Since SMB Flush can be
    very slow, and some servers may be reliable enough (to risk
    delaying slightly flushing the data to disk on the server),
    turning on this option may be useful to improve performance for
    applications that fsync too much, at a small risk of server
    crash. If this mount option is not set, by default cifs will
    send an SMB flush request (and wait for a response) on every
    fsync call.

    Signed-off-by: Steve French

    Steve French
     

29 Dec, 2008

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: (31 commits)
    [CIFS] Remove redundant test
    [CIFS] make sure that DFS pathnames are properly formed
    Remove an already-checked error condition in SendReceiveBlockingLock
    Streamline SendReceiveBlockingLock: Use "goto out:" in an error condition
    Streamline SendReceiveBlockingLock: Use "goto out:" in an error condition
    [CIFS] Streamline SendReceive[2] by using "goto out:" in an error condition
    Slightly streamline SendReceive[2]
    Check the return value of cifs_sign_smb[2]
    [CIFS] Cleanup: Move the check for too large R/W requests
    [CIFS] Slightly simplify wait_for_free_request(), remove an unnecessary "else" branch
    Simplify allocate_mid() slightly: Remove some unnecessary "else" branches
    [CIFS] In SendReceive, move consistency check out of the mutexed region
    cifs: store password in tcon
    cifs: have calc_lanman_hash take more granular args
    cifs: zero out session password before freeing it
    cifs: fix wait_for_response to time out sleeping processes correctly
    [CIFS] Can not mount with prefixpath if root directory of share is inaccessible
    [CIFS] various minor cleanups pointed out by checkpatch script
    [CIFS] fix typo
    [CIFS] remove sparse warning
    ...

    Fix trivial conflict in fs/cifs/cifs_fs_sb.h due to comment changes for
    the CIFS_MOUNT_xyz bit definitions between cifs updates and security
    updates.

    Linus Torvalds
     

26 Dec, 2008

1 commit

  • Some applications/subsystems require mandatory byte range locks
    (as is used for Windows/DOS/OS2 etc). Sending advisory (posix style)
    byte range lock requests (instead of mandatory byte range locks) can
    lead to problems for these applications (which expect that other
    clients be prevented from writing to portions of the file which
    they have locked and are updating). This mount option allows
    mounting cifs with the new mount option "forcemand" (or
    "forcemandatorylock") in order to have the cifs client use mandatory
    byte range locks (ie SMB/CIFS/Windows/NTFS style locks) rather than
    posix byte range lock requests, even if the server would support
    posix byte range lock requests. This has no effect if the server
    does not support the CIFS Unix Extensions (since posix style locks
    require support for the CIFS Unix Extensions), but for mounts
    to Samba servers this can be helpful for Wine and applications
    that require mandatory byte range locks.

    Acked-by: Jeff Layton
    CC: Alexander Bokovoy
    Signed-off-by: Steve French

    Steve French
     

14 Nov, 2008

1 commit

  • Wrap access to task credentials so that they can be separated more easily from
    the task_struct during the introduction of COW creds.

    Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().

    Change some task->e?[ug]id to task_e?[ug]id(). In some places it makes more
    sense to use RCU directly rather than a convenient wrapper; these will be
    addressed by later patches.

    Signed-off-by: David Howells
    Reviewed-by: James Morris
    Acked-by: Serge Hallyn
    Cc: Steve French
    Cc: linux-cifs-client@lists.samba.org
    Signed-off-by: James Morris

    David Howells
     

13 May, 2008

1 commit

  • when unix extensions and cifsacl support are disabled. These
    permissions changes are "ephemeral" however. They are lost whenever
    a share is mounted and unmounted, or when memory pressure forces
    the inode out of the cache.

    Because of this, we'd like to introduce a behavior change to make
    CIFS behave more like local DOS/Windows filesystems. When unix
    extensions and cifsacl support aren't enabled, then don't silently
    ignore changes to permission bits that can't be reflected on the
    server.

    Still, there may be people relying on the current behavior for
    certain applications. This patch adds a new "dynperm" (and a
    corresponding "nodynperm") mount option that will be intended
    to make the client fall back to legacy behavior when setting
    these modes.

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

    Jeff Layton
     

11 Jan, 2008

1 commit