25 Nov, 2019

1 commit

  • We don't care about module aliasing validation in
    cifs_compose_mount_options(..., is_smb3) when finding the root SMB
    session of an DFS namespace in order to refresh DFS referral cache.

    The following issue has been observed when mounting with '-t smb3' and
    then specifying 'vers=2.0':

    ...
    Nov 08 15:27:08 tw kernel: address conversion returned 0 for FS0.WIN.LOCAL
    Nov 08 15:27:08 tw kernel: [kworke] ==> dns_query((null),FS0.WIN.LOCAL,13,(null))
    Nov 08 15:27:08 tw kernel: [kworke] call request_key(,FS0.WIN.LOCAL,)
    Nov 08 15:27:08 tw kernel: [kworke] ==> dns_resolver_cmp(FS0.WIN.LOCAL,FS0.WIN.LOCAL)
    Nov 08 15:27:08 tw kernel: [kworke] Nov 08 15:27:08 tw kernel: CIFS VFS: vers=2.0 not permitted when mounting with smb3
    Nov 08 15:27:08 tw kernel: fs/cifs/dfs_cache.c: CIFS VFS: leaving refresh_tcon (xid = 26) rc = -22
    ...

    Fixes: 5072010ccf05 ("cifs: Fix DFS cache refresher for DFS links")
    Signed-off-by: Paulo Alcantara (SUSE)
    Reviewed-by: Aurelien Aptel
    Signed-off-by: Steve French

    Paulo Alcantara (SUSE)
     

08 Jul, 2019

1 commit


29 May, 2019

1 commit


08 May, 2019

1 commit

  • As per MS-DFSC, when a DFS cache entry is expired and it is a DFS
    link, then a new DFS referral must be sent to root server in order to
    refresh the expired entry.

    This patch ensures that all new DFS referrals for refreshing the cache
    are sent to DFS root.

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

    Paulo Alcantara (SUSE)
     

11 Jan, 2019

1 commit

  • The most recent "it" allocation is leaked on this error path. I
    believe that small allocations always succeed in current kernels so
    this doesn't really affect run time.

    Fixes: 54be1f6c1c37 ("cifs: Add DFS cache routines")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Steve French

    Dan Carpenter
     

29 Dec, 2018

4 commits

  • We should zero out the password before we free it.

    Fixes: 3d6cacbb5310 ("cifs: Add DFS cache routines")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Steve French
    Reviewed-by: Paulo Alcantara

    Dan Carpenter
     
  • memory allocated by kmem_cache_alloc() in alloc_cache_entry()
    should be freed using kmem_cache_free(), not kfree().

    Fixes: 34a44fb160f9 ("cifs: Add DFS cache routines")
    Signed-off-by: Wei Yongjun
    Signed-off-by: Steve French
    Reviewed-by: Aurelien Aptel

    Wei Yongjun
     
  • Fixes cifs build failure after merge of the y2038 tree

    After merging the y2038 tree, today's linux-next build (x86_64
    allmodconfig) failed like this:

    fs/cifs/dfs_cache.c: In function 'cache_entry_expired':
    fs/cifs/dfs_cache.c:106:7: error: implicit declaration of function 'current_kernel_time64'; did you mean 'core_kernel_text'? [-Werror=implicit-function-declaration]
    ts = current_kernel_time64();
    ^~~~~~~~~~~~~~~~~~~~~
    core_kernel_text
    fs/cifs/dfs_cache.c:106:5: error: incompatible types when assigning to type 'struct timespec64' from type 'int'
    ts = current_kernel_time64();
    ^
    fs/cifs/dfs_cache.c: In function 'get_expire_time':
    fs/cifs/dfs_cache.c:342:24: error: incompatible type for argument 1 of 'timespec64_add'
    return timespec64_add(current_kernel_time64(), ts);
    ^~~~~~~~~~~~~~~~~~~~~~~
    In file included from include/linux/restart_block.h:10,
    from include/linux/thread_info.h:13,
    from arch/x86/include/asm/preempt.h:7,
    from include/linux/preempt.h:78,
    from include/linux/rcupdate.h:40,
    from fs/cifs/dfs_cache.c:8:
    include/linux/time64.h:66:66: note: expected 'struct timespec64' but argument is of type 'int'
    static inline struct timespec64 timespec64_add(struct timespec64 lhs,
    ~~~~~~~~~~~~~~~~~~^~~
    fs/cifs/dfs_cache.c:343:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

    Caused by:

    commit ccea641b6742 ("timekeeping: remove obsolete time accessors")

    interacting with:
    commit 34a44fb160f9 ("cifs: Add DFS cache routines")

    from the cifs tree.

    Signed-off-by: Stephen Rothwell
    Reviewed-by: Paulo Alcantara
    Acked-by: Arnd Bergmann
    Signed-off-by: Steve French

    Stephen Rothwell
     
  • * 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