24 Oct, 2020

1 commit

  • This is needed so when mounting to Windows we do not
    misinterpret various special files created by Linux (WSL) as symlinks.
    An earlier patch addressed readdir. This patch fixes stat (getattr).

    With this patch:
      File: /mnt1/char
      Size: 0          Blocks: 0          IO Block: 16384  character special file
    Device: 34h/52d Inode: 844424930132069  Links: 1     Device type: 0,0
    Access: (0755/crwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-10-21 17:46:51.839458900 -0500
    Modify: 2020-10-21 17:46:51.839458900 -0500
    Change: 2020-10-21 18:30:39.797358800 -0500
     Birth: -
      File: /mnt1/fifo
      Size: 0          Blocks: 0          IO Block: 16384  fifo
    Device: 34h/52d Inode: 1125899906842722  Links: 1
    Access: (0755/prwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-10-21 16:21:37.259249700 -0500
    Modify: 2020-10-21 16:21:37.259249700 -0500
    Change: 2020-10-21 18:30:39.797358800 -0500
     Birth: -
      File: /mnt1/block
      Size: 0          Blocks: 0          IO Block: 16384  block special file
    Device: 34h/52d Inode: 844424930132068  Links: 1     Device type: 0,0
    Access: (0755/brwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-10-21 17:10:47.913103200 -0500
    Modify: 2020-10-21 17:10:47.913103200 -0500
    Change: 2020-10-21 18:30:39.796725500 -0500
     Birth: -

    without the patch all show up incorrectly as symlinks with annoying "operation not supported error also returned"
      File: /mnt1/charstat: cannot read symbolic link '/mnt1/char': Operation not supported

      Size: 0          Blocks: 0          IO Block: 16384  symbolic link
    Device: 34h/52d Inode: 844424930132069  Links: 1
    Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-10-21 17:46:51.839458900 -0500
    Modify: 2020-10-21 17:46:51.839458900 -0500
    Change: 2020-10-21 18:30:39.797358800 -0500
     Birth: -
      File: /mnt1/fifostat: cannot read symbolic link '/mnt1/fifo': Operation not supported

      Size: 0          Blocks: 0          IO Block: 16384  symbolic link
    Device: 34h/52d Inode: 1125899906842722  Links: 1
    Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-10-21 16:21:37.259249700 -0500
    Modify: 2020-10-21 16:21:37.259249700 -0500
    Change: 2020-10-21 18:30:39.797358800 -0500
     Birth: -
      File: /mnt1/blockstat: cannot read symbolic link '/mnt1/block': Operation not supported

      Size: 0          Blocks: 0          IO Block: 16384  symbolic link
    Device: 34h/52d Inode: 844424930132068  Links: 1
    Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-10-21 17:10:47.913103200 -0500
    Modify: 2020-10-21 17:10:47.913103200 -0500
    Change: 2020-10-21 18:30:39.796725500 -0500

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

    Steve French
     

16 Oct, 2020

1 commit

  • RHBZ: 1848178

    Some calls that set attributes, like utimensat(), are not supposed to return
    -EINTR and thus do not have handlers for this in glibc which causes us
    to leak -EINTR to the applications which are also unprepared to handle it.

    For example tar will break if utimensat() return -EINTR and abort unpacking
    the archive. Other applications may break too.

    To handle this we add checks, and retry, for -EINTR in cifs_setattr()

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

    Ronnie Sahlberg
     

07 Sep, 2020

1 commit

  • RHBZ: 1871246

    If during cifs_lookup()/get_inode_info() we encounter a DFS link
    and we use the cifsacl or modefromsid mount options we must suppress
    any -EREMOTE errors that triggers or else we will not be able to follow
    the DFS link and automount the target.

    This fixes an issue with modefromsid/cifsacl where these mountoptions
    would break DFS and we would no longer be able to access the share.

    Signed-off-by: Ronnie Sahlberg
    Reviewed-by: Paulo Alcantara (SUSE)
    Signed-off-by: Steve French

    Ronnie Sahlberg
     

03 Aug, 2020

1 commit

  • Fix build warning by removing unused variable 'server':

    fs/cifs/inode.c:1089:26: warning:
    variable server set but not used [-Wunused-but-set-variable]
    1089 | struct TCP_Server_Info *server;
    | ^~~~~~

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

    Wei Yongjun
     

24 Jul, 2020

1 commit

  • This reverts commit 9ffad9263b467efd8f8dc7ae1941a0a655a2bab2.

    Upon additional testing with older servers, it was found that
    the original commit introduced a regression when using the old SMB1
    dialect and rsyncing over an existing file.

    The patch will need to be respun to address this, likely including
    a larger refactoring of the SMB1 and SMB3 rename code paths to make
    it less confusing and also to address some additional rename error
    cases that SMB3 may be able to workaround.

    Signed-off-by: Steve French
    Reported-by: Patrick Fernie
    CC: Stable
    Acked-by: Ronnie Sahlberg
    Acked-by: Pavel Shilovsky
    Acked-by: Zhang Xiaoxu

    Steve French
     

02 Jul, 2020

1 commit

  • When xfstest generic/035, we found the target file was deleted
    if the rename return -EACESS.

    In cifs_rename2, we unlink the positive target dentry if rename
    failed with EACESS or EEXIST, even if the target dentry is positived
    before rename. Then the existing file was deleted.

    We should just delete the target file which created during the
    rename.

    Reported-by: Hulk Robot
    Signed-off-by: Zhang Xiaoxu
    Cc: stable@vger.kernel.org
    Signed-off-by: Steve French
    Reviewed-by: Aurelien Aptel

    Zhang Xiaoxu
     

24 Jun, 2020

1 commit

  • As the man description of the truncate, if the size changed,
    then the st_ctime and st_mtime fields should be updated. But
    in cifs, we doesn't do it.

    It lead the xfstests generic/313 failed.

    So, add the ATTR_MTIME|ATTR_CTIME flags on attrs when change
    the file size

    Reported-by: Hulk Robot
    Signed-off-by: Zhang Xiaoxu
    Signed-off-by: Steve French

    Zhang Xiaoxu
     

13 Jun, 2020

1 commit

  • Pavel noticed that a debug message (disabled by default) in creating the security
    descriptor context could be useful for new file creation owner fields
    (as we already have for the mode) when using mount parm idsfromsid.

    [38120.392272] CIFS: FYI: owner S-1-5-88-1-0, group S-1-5-88-2-0
    [38125.792637] CIFS: FYI: owner S-1-5-88-1-1000, group S-1-5-88-2-1000

    Also cleans up a typo in a comment

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

    Steve French
     

12 Jun, 2020

2 commits


06 Jun, 2020

2 commits

  • Pull cifs updates from Steve French:
    "22 changesets, 2 for stable.

    Includes big performance improvement for large i/o when using
    multichannel, also includes DFS fixes"

    * tag '5.8-rc-smb3-fixes-part-1' of git://git.samba.org/sfrench/cifs-2.6: (22 commits)
    cifs: update internal module version number
    cifs: multichannel: try to rebind when reconnecting a channel
    cifs: multichannel: use pointer for binding channel
    smb3: remove static checker warning
    cifs: multichannel: move channel selection above transport layer
    cifs: multichannel: always zero struct cifs_io_parms
    cifs: dump Security Type info in DebugData
    smb3: fix incorrect number of credits when ioctl MaxOutputResponse > 64K
    smb3: default to minimum of two channels when multichannel specified
    cifs: multichannel: move channel selection in function
    cifs: fix minor typos in comments and log messages
    smb3: minor update to compression header definitions
    cifs: minor fix to two debug messages
    cifs: Standardize logging output
    smb3: Add new parm "nodelete"
    cifs: move some variables off the stack in smb2_ioctl_query_info
    cifs: reduce stack use in smb2_compound_op
    cifs: get rid of unused parameter in reconn_setup_dfs_targets()
    cifs: handle hostnames that resolve to same ip in failover
    cifs: set up next DFS target before generic_ip_connect()
    ...

    Linus Torvalds
     
  • Pull ext4 updates from Ted Ts'o:
    "A lot of bug fixes and cleanups for ext4, including:

    - Fix performance problems found in dioread_nolock now that it is the
    default, caused by transaction leaks.

    - Clean up fiemap handling in ext4

    - Clean up and refactor multiple block allocator (mballoc) code

    - Fix a problem with mballoc with a smaller file systems running out
    of blocks because they couldn't properly use blocks that had been
    reserved by inode preallocation.

    - Fixed a race in ext4_sync_parent() versus rename()

    - Simplify the error handling in the extent manipulation code

    - Make sure all metadata I/O errors are felected to
    ext4_ext_dirty()'s and ext4_make_inode_dirty()'s callers.

    - Avoid passing an error pointer to brelse in ext4_xattr_set()

    - Fix race which could result to freeing an inode on the dirty last
    in data=journal mode.

    - Fix refcount handling if ext4_iget() fails

    - Fix a crash in generic/019 caused by a corrupted extent node"

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (58 commits)
    ext4: avoid unnecessary transaction starts during writeback
    ext4: don't block for O_DIRECT if IOCB_NOWAIT is set
    ext4: remove the access_ok() check in ext4_ioctl_get_es_cache
    fs: remove the access_ok() check in ioctl_fiemap
    fs: handle FIEMAP_FLAG_SYNC in fiemap_prep
    fs: move fiemap range validation into the file systems instances
    iomap: fix the iomap_fiemap prototype
    fs: move the fiemap definitions out of fs.h
    fs: mark __generic_block_fiemap static
    ext4: remove the call to fiemap_check_flags in ext4_fiemap
    ext4: split _ext4_fiemap
    ext4: fix fiemap size checks for bitmap files
    ext4: fix EXT4_MAX_LOGICAL_BLOCK macro
    add comment for ext4_dir_entry_2 file_type member
    jbd2: avoid leaking transaction credits when unreserving handle
    ext4: drop ext4_journal_free_reserved()
    ext4: mballoc: use lock for checking free blocks while retrying
    ext4: mballoc: refactor ext4_mb_good_group()
    ext4: mballoc: introduce pcpu seqcnt for freeing PA to improve ENOSPC handling
    ext4: mballoc: refactor ext4_mb_discard_preallocations()
    ...

    Linus Torvalds
     

05 Jun, 2020

1 commit


04 Jun, 2020

1 commit


01 Jun, 2020

2 commits

  • Use pr_fmt to standardize all logging for fs/cifs.

    Some logging output had no CIFS: specific prefix.

    Now all output has one of three prefixes:

    o CIFS:
    o CIFS: VFS:
    o Root-CIFS:

    Miscellanea:

    o Convert printks to pr_
    o Neaten macro definitions
    o Remove embedded CIFS: prefixes from formats
    o Convert "illegal" to "invalid"
    o Coalesce formats
    o Add missing '\n' format terminations
    o Consolidate multiple cifs_dbg continuations into single calls
    o More consistent use of upper case first word output logging
    o Multiline statement argument alignment and wrapping

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

    Joe Perches
     
  • In order to handle workloads where it is important to make sure that
    a buggy app did not delete content on the drive, the new mount option
    "nodelete" allows standard permission checks on the server to work,
    but prevents on the client any attempts to unlink a file or delete
    a directory on that mount point. This can be helpful when running
    a little understood app on a network mount that contains important
    content that should not be deleted.

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

    Steve French
     

06 May, 2020

1 commit

  • As per POSIX, the correct spelling is EACCES:

    include/uapi/asm-generic/errno-base.h:#define EACCES 13 /* Permission denied */

    Fixes: b8f7442bc46e48fb ("CIFS: refactor cifs_get_inode_info()")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Steve French

    Geert Uytterhoeven
     

16 Apr, 2020

1 commit

  • Found a read performance issue when linux kernel page size is 64KB.
    If linux kernel page size is 64KB and mount options cache=strict &
    vers=2.1+, it does not support cifs_readpages(). Instead, it is using
    cifs_readpage() and cifs_read() with maximum read IO size 16KB, which is
    much slower than read IO size 1MB when negotiated SMB 2.1+. Since modern
    SMB server supported SMB 2.1+ and Max Read Size can reach more than 64KB
    (for example 1MB ~ 8MB), this patch check max_read instead of maxBuf to
    determine whether server support readpages() and improve read performance
    for page size 64KB & cache=strict & vers=2.1+, and for SMB1 it is more
    cleaner to initialize server->max_read to server->maxBuf.

    The client is a linux box with linux kernel 4.2.8,
    page size 64KB (CONFIG_ARM64_64K_PAGES=y),
    cpu arm 1.7GHz, and use mount.cifs as smb client.
    The server is another linux box with linux kernel 4.2.8,
    share a file '10G.img' with size 10GB,
    and use samba-4.7.12 as smb server.

    The client mount a share from the server with different
    cache options: cache=strict and cache=none,
    mount -tcifs ///Public /cache_strict -overs=3.0,cache=strict,username=,password=
    mount -tcifs ///Public /cache_none -overs=3.0,cache=none,username=,password=

    The client download a 10GbE file from the server across 1GbE network,
    dd if=/cache_strict/10G.img of=/dev/null bs=1M count=10240
    dd if=/cache_none/10G.img of=/dev/null bs=1M count=10240

    Found that cache=strict (without patch) is slower read throughput and
    smaller read IO size than cache=none.
    cache=strict (without patch): read throughput 40MB/s, read IO size is 16KB
    cache=strict (with patch): read throughput 113MB/s, read IO size is 1MB
    cache=none: read throughput 109MB/s, read IO size is 1MB

    Looks like if page size is 64KB,
    cifs_set_ops() would use cifs_addr_ops_smallbuf instead of cifs_addr_ops,

    /* check if server can support readpages */
    if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf <
    PAGE_SIZE + MAX_CIFS_HDR_SIZE)
    inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
    else
    inode->i_data.a_ops = &cifs_addr_ops;

    maxBuf is came from 2 places, SMB2_negotiate() and CIFSSMBNegotiate(),
    (SMB2_MAX_BUFFER_SIZE is 64KB)
    SMB2_negotiate():
    /* set it to the maximum buffer size value we can send with 1 credit */
    server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),
          SMB2_MAX_BUFFER_SIZE);
    CIFSSMBNegotiate():
    server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize);

    Page size 64KB and cache=strict lead to read_pages() use cifs_readpage()
    instead of cifs_readpages(), and then cifs_read() using maximum read IO
    size 16KB, which is much slower than maximum read IO size 1MB.
    (CIFSMaxBufSize is 16KB by default)

    /* FIXME: set up handlers for larger reads and/or convert to async */
    rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize);
    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Jones Syue
    Signed-off-by: Steve French

    Jones Syue
     

11 Apr, 2020

1 commit

  • Add experimental support for allowing a swap file to be on an SMB3
    mount. There are use cases where swapping over a secure network
    filesystem is preferable. In some cases there are no local
    block devices large enough, and network block devices can be
    hard to setup and secure. And in some cases there are no
    local block devices at all (e.g. with the recent addition of
    remote boot over SMB3 mounts).

    There are various enhancements that can be added later e.g.:
    - doing a mandatory byte range lock over the swapfile (until
    the Linux VFS is modified to notify the file system that an open
    is for a swapfile, when the file can be opened "DENY_ALL" to prevent
    others from opening it).
    - pinning more buffers in the underlying transport to minimize memory
    allocations in the TCP stack under the fs
    - documenting how to create ACLs (on the server) to secure the
    swapfile (or adding additional tools to cifs-utils to make it easier)

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

    Steve French
     

23 Mar, 2020

3 commits

  • See commit 349457ccf2592c14bdf13b6706170ae2e94931b1
    "Allow file systems to manually d_move() inside of ->rename()"

    Lessens possibility of race conditions in rename

    Signed-off-by: Steve French

    Steve French
     
  • There are cases when we don't want to send the SMB2 flush operation
    (e.g. when user specifies mount parm "nostrictsync") and it can be
    a very expensive operation on the server. In most cases in order
    to set mtime, we simply need to flush (write) the dirtry pages from
    the client and send the writes to the server not also send a flush
    protocol operation to the server.

    Fixes: aa081859b10c ("cifs: flush before set-info if we have writeable handles")
    CC: Stable
    Signed-off-by: Steve French

    Steve French
     
  • Check the AT_STATX_FORCE_SYNC flag and force an attribute
    revalidation if requested by the caller, and if the caller
    specificies AT_STATX_DONT_SYNC only revalidate cached attributes
    if required. In addition do not flush writes in getattr (which
    can be expensive) if size or timestamps not requested by the
    caller.

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

    Steve French
     

18 Mar, 2020

1 commit

  • Smatch complains that "rc" could be uninitialized.

    fs/cifs/inode.c:2206 cifs_getattr() error: uninitialized symbol 'rc'.

    Changing it to "return 0;" improves readability as well.

    Fixes: cc1baf98c8f6 ("cifs: do not ignore the SYNC flags in getattr")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Steve French
    Acked-by: Ronnie Sahlberg

    Dan Carpenter
     

25 Feb, 2020

3 commits

  • All other uses of cifs_dbg use defines so change this one.

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

    Joe Perches
     
  • To rename a file in SMB2 we open it with the DELETE access and do a
    special SetInfo on it. If the handle is missing the DELETE bit the
    server will fail the SetInfo with STATUS_ACCESS_DENIED.

    We currently try to reuse any existing opened handle we have with
    cifs_get_writable_path(). That function looks for handles with WRITE
    access but doesn't check for DELETE, making rename() fail if it finds
    a handle to reuse. Simple reproducer below.

    To select handles with the DELETE bit, this patch adds a flag argument
    to cifs_get_writable_path() and find_writable_file() and the existing
    'bool fsuid_only' argument is converted to a flag.

    The cifsFileInfo struct only stores the UNIX open mode but not the
    original SMB access flags. Since the DELETE bit is not mapped in that
    mode, this patch stores the access mask in cifs_fid on file open,
    which is accessible from cifsFileInfo.

    Simple reproducer:

    #include
    #include
    #include
    #include
    #include
    #include
    #define E(s) perror(s), exit(1)

    int main(int argc, char *argv[])
    {
    int fd, ret;
    if (argc != 3) {
    fprintf(stderr, "Usage: %s A B\n"
    "create&open A in write mode, "
    "rename A to B, close A\n", argv[0]);
    return 0;
    }

    fd = openat(AT_FDCWD, argv[1], O_WRONLY|O_CREAT|O_SYNC, 0666);
    if (fd == -1) E("openat()");

    ret = rename(argv[1], argv[2]);
    if (ret) E("rename()");

    ret = close(fd);
    if (ret) E("close()");

    return ret;
    }

    $ gcc -o bugrename bugrename.c
    $ ./bugrename /mnt/a /mnt/b
    rename(): Permission denied

    Fixes: 8de9e86c67ba ("cifs: create a helper to find a writeable handle by path name")
    CC: Stable
    Signed-off-by: Aurelien Aptel
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky
    Reviewed-by: Paulo Alcantara (SUSE)

    Aurelien Aptel
     
  • If from cifs_revalidate_dentry_attr() the SMB2/QUERY_INFO call fails with an
    error, such as STATUS_SESSION_EXPIRED, causing the session to be reconnected
    it is possible we will leak -EAGAIN back to the application even for
    system calls such as stat() where this is not a valid error.

    Fix this by re-trying the operation from within cifs_revalidate_dentry_attr()
    if cifs_get_inode_info*() returns -EAGAIN.

    This fixes stat() and possibly also other system calls that uses
    cifs_revalidate_dentry*().

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

    Ronnie Sahlberg
     

13 Feb, 2020

1 commit


10 Feb, 2020

1 commit

  • Pull cifs fixes from Steve French:
    "13 cifs/smb3 patches, most from testing at the SMB3 plugfest this week:

    - Important fix for multichannel and for modefromsid mounts.

    - Two reconnect fixes

    - Addition of SMB3 change notify support

    - Backup tools fix

    - A few additional minor debug improvements (tracepoints and
    additional logging found useful during testing this week)"

    * tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6:
    smb3: Add defines for new information level, FileIdInformation
    smb3: print warning once if posix context returned on open
    smb3: add one more dynamic tracepoint missing from strict fsync path
    cifs: fix mode bits from dir listing when mounted with modefromsid
    cifs: fix channel signing
    cifs: add SMB3 change notification support
    cifs: make multichannel warning more visible
    cifs: fix soft mounts hanging in the reconnect code
    cifs: Add tracepoints for errors on flush or fsync
    cifs: log warning message (once) if out of disk space
    cifs: fail i/o on soft mounts if sessionsetup errors out
    smb3: fix problem with null cifs super block with previous patch
    SMB3: Backup intent flag missing from some more ops

    Linus Torvalds
     

05 Feb, 2020

1 commit

  • Pull vfs timestamp updates from Al Viro:
    "More 64bit timestamp work"

    * 'imm.timestamp' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    kernfs: don't bother with timestamp truncation
    fs: Do not overload update_time
    fs: Delete timespec64_trunc()
    fs: ubifs: Eliminate timespec64_trunc() usage
    fs: ceph: Delete timespec64_trunc() usage
    fs: cifs: Delete usage of timespec64_trunc
    fs: fat: Eliminate timespec64_trunc() usage
    utimes: Clamp the timestamps in notify_change()

    Linus Torvalds
     

04 Feb, 2020

1 commit

  • When "backup intent" is requested on the mount (e.g. backupuid or
    backupgid mount options), the corresponding flag was missing from
    some of the operations.

    Change all operations to use the macro cifs_create_options() to
    set the backup intent flag if needed.

    Signed-off-by: Amir Goldstein
    Signed-off-by: Steve French

    Amir Goldstein
     

27 Jan, 2020

1 commit

  • RHBZ 1336264

    When we extend a file we must also force the size to be updated.

    This fixes an issue with holetest in xfs-tests which performs the following
    sequence :
    1, create a new file
    2, use fallocate mode==0 to populate the file
    3, mmap the file
    4, touch each page by reading the mmapped region.

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

    Ronnie Sahlberg
     

09 Dec, 2019

1 commit

  • timestamp_truncate() is the replacement api for
    timespec64_trunc. timestamp_truncate() additionally clamps
    timestamps to make sure the timestamps lie within the
    permitted range for the filesystem.

    Truncate the timestamps in the struct cifs_attr at the
    site of assignment to inode times. This
    helps us use the right fs api timestamp_trucate() to
    perform the truncation.

    Also update the ktime_get_* api to match the one used in
    current_time(). This allows for timestamps to be updated
    the same way always.

    Signed-off-by: Deepa Dinamani
    Cc: stfrench@microsoft.com
    Cc: linux-cifs@vger.kernel.org
    Signed-off-by: Al Viro

    Deepa Dinamani
     

03 Dec, 2019

1 commit

  • According to the comment in the code and commit log, some apps
    expect atime >= mtime; but the introduced code results in
    atime==mtime. Fix the comparison to guard against atime
    Cc: stfrench@microsoft.com
    Cc: linux-cifs@vger.kernel.org
    Signed-off-by: Steve French

    Deepa Dinamani
     

28 Nov, 2019

1 commit


25 Nov, 2019

1 commit

  • Make logic of cifs_get_inode() much clearer by moving code to sub
    functions and adding comments.

    Document the steps this function does.

    cifs_get_inode_info() gets and updates a file inode metadata from its
    file path.

    * If caller already has raw info data from server they can pass it.
    * If inode already exists (just need to update) caller can pass it.

    Step 1: get raw data from server if none was passed
    Step 2: parse raw data into intermediate internal cifs_fattr struct
    Step 3: set fattr uniqueid which is later used for inode number. This
    can sometime be done from raw data
    Step 4: tweak fattr according to mount options (file_mode, acl to mode
    bits, uid, gid, etc)
    Step 5: update or create inode from final fattr struct

    * add is_smb1_server() helper
    * add is_inode_cache_good() helper
    * move SMB1-backupcreds-getinfo-retry to separate func
    cifs_backup_query_path_info().
    * move set-uniqueid code to separate func cifs_set_fattr_ino()
    * don't clobber uniqueid from backup cred retry
    * fix some probable corner cases memleaks

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

    Aurelien Aptel
     

21 Oct, 2019

1 commit

  • cifs_setattr_nounix has two paths which miss free operations
    for xid and fullpath.
    Use goto cifs_setattr_exit like other paths to fix them.

    CC: Stable
    Fixes: aa081859b10c ("cifs: flush before set-info if we have writeable handles")
    Signed-off-by: Chuhong Yuan
    Signed-off-by: Steve French
    Reviewed-by: Pavel Shilovsky

    Chuhong Yuan
     

09 Oct, 2019

1 commit

  • Currently the client indicates that a dentry is stale when inode
    numbers or type types between a local inode and a remote file
    don't match. If this is the case attributes is not being copied
    from remote to local, so, it is already known that the local copy
    has stale metadata. That's why the inode needs to be marked for
    revalidation in order to tell the VFS to lookup the dentry again
    before openning a file. This prevents unexpected stale errors
    to be returned to the user space when openning a file.

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

    Pavel Shilovsky
     

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

2 commits

  • When mounting with "modefromsid" set mode bits (chmod) by
    adding ACE with special SID (S-1-5-88-3-) to the ACL.
    Subsequent patch will fix setting default mode on file
    create and mkdir.

    See 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

    Steve French
     
  • When mounting with "modefromsid" retrieve mode bits from
    special SID (S-1-5-88-3) on stat. Subsequent patch will fix
    setattr (chmod) to save mode bits in S-1-5-88-3-

    Note that when an ACE matching S-1-5-88-3 is not found, we
    default the mode to an approximation based on the owner, group
    and everyone permissions (as with the "cifsacl" mount option).

    See 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

    Steve French