4 cifs/smb3 fixes, one for DFS reconnect, and one to begin creating common headers for server and client and the other two to rename the cifs_common directory to smbfs_common to be more consistent ie change use of the name cifs to smb which is more accurate

-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmE84CsACgkQiiy9cAdy
 T1Gtnwv/ZR300RApOW6lxg5GuDxTVbOW9Iu+d8PGPTv+ai02LPIr3tfh+ClHqJYV
 IuOEIDckyWN32WGDaX9agLffYmQgYgan6sVL7LkebJvl5t6CdhPXOXM6Un2H32tM
 M0J73IhaIpFdNyNFCTfZ62J99vyUNLUKB2jSnhbpjUZTDoPELXVXAVEbk7bd9Dme
 AwKFbxO8cKkDOWk84BPMW4cxRZPT6NrkqsZiNkz++2U8WusL8mZNmLN8VwkMlzXo
 nEqhEHWPSXTV7M2lmY1UxyW2n0MEG4djNquZ2YCIunWwigD8iimBnJJnyirCI8YF
 3kpWXlfpwhUjQ1EoFAtQK+hexDpkyxB/1Kn0+xfmNpFqKqQ8eIwFQAkMh42VL9Gd
 Gi+uAM7mXk/IdWXwIm0B+8faM6FwhI3VXQvhV9dNi5yAXvv2cpsKv4VKugscFhdq
 alpQyoWZ8ivam7vADSNKYKYOchARz2xr1pLc+Cw+ggfu01wSEWWpehsUx5vJGMQ7
 npxdcZJ6
 =Y9tc
 -----END PGP SIGNATURE-----

Merge tag '5.15-rc-cifs-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull smbfs updates from Steve French:
 "cifs/smb3 updates:

   - DFS reconnect fix

   - begin creating common headers for server and client

   - rename the cifs_common directory to smbfs_common to be more
     consistent ie change use of the name cifs to smb (smb3 or smbfs is
     more accurate, as the very old cifs dialect has long been
     superseded by smb3 dialects).

  In the future we can rename the fs/cifs directory to fs/smbfs.

  This does not include the set of multichannel fixes nor the two
  deferred close fixes (they are still being reviewed and tested)"

* tag '5.15-rc-cifs-part2' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: properly invalidate cached root handle when closing it
  cifs: move SMB FSCTL definitions to common code
  cifs: rename cifs_common to smbfs_common
  cifs: update FSCTL definitions
This commit is contained in:
Linus Torvalds 2021-09-12 10:10:21 -07:00
commit 8d4a0b5d08
12 changed files with 37 additions and 21 deletions

View File

@ -367,7 +367,7 @@ source "fs/ceph/Kconfig"
source "fs/cifs/Kconfig"
source "fs/ksmbd/Kconfig"
config CIFS_COMMON
config SMBFS_COMMON
tristate
default y if CIFS=y
default m if CIFS=m

View File

@ -96,7 +96,7 @@ obj-$(CONFIG_LOCKD) += lockd/
obj-$(CONFIG_NLS) += nls/
obj-$(CONFIG_UNICODE) += unicode/
obj-$(CONFIG_SYSV_FS) += sysv/
obj-$(CONFIG_CIFS_COMMON) += cifs_common/
obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/
obj-$(CONFIG_CIFS) += cifs/
obj-$(CONFIG_SMB_SERVER) += ksmbd/
obj-$(CONFIG_HPFS_FS) += hpfs/

View File

@ -22,7 +22,7 @@
#include <linux/random.h>
#include <linux/highmem.h>
#include <linux/fips.h>
#include "../cifs_common/arc4.h"
#include "../smbfs_common/arc4.h"
#include <crypto/aead.h>
int __cifs_calc_signature(struct smb_rqst *rqst,

View File

@ -12,7 +12,7 @@
#include <net/sock.h>
#include <asm/unaligned.h>
#include "smbfsctl.h"
#include "../smbfs_common/smbfsctl.h"
#define CIFS_PROT 0
#define POSIX_PROT (CIFS_PROT+1)

View File

@ -689,13 +689,19 @@ smb2_close_cached_fid(struct kref *ref)
cifs_dbg(FYI, "clear cached root file handle\n");
SMB2_close(0, cfid->tcon, cfid->fid->persistent_fid,
cfid->fid->volatile_fid);
cfid->is_valid = false;
cfid->file_all_info_is_valid = false;
cfid->has_lease = false;
if (cfid->dentry) {
dput(cfid->dentry);
cfid->dentry = NULL;
}
}
/*
* We only check validity above to send SMB2_close,
* but we still need to invalidate these entries
* when this function is called
*/
cfid->is_valid = false;
cfid->file_all_info_is_valid = false;
cfid->has_lease = false;
if (cfid->dentry) {
dput(cfid->dentry);
cfid->dentry = NULL;
}
}

View File

@ -24,7 +24,7 @@
#include "cifsglob.h"
#include "cifs_debug.h"
#include "cifsproto.h"
#include "../cifs_common/md4.h"
#include "../smbfs_common/md4.h"
#ifndef false
#define false 0

View File

@ -3,5 +3,5 @@
# Makefile for Linux filesystem routines that are shared by client and server.
#
obj-$(CONFIG_CIFS_COMMON) += cifs_arc4.o
obj-$(CONFIG_CIFS_COMMON) += cifs_md4.o
obj-$(CONFIG_SMBFS_COMMON) += cifs_arc4.o
obj-$(CONFIG_SMBFS_COMMON) += cifs_md4.o

View File

@ -74,14 +74,14 @@ void cifs_arc4_crypt(struct arc4_ctx *ctx, u8 *out, const u8 *in, unsigned int l
EXPORT_SYMBOL_GPL(cifs_arc4_crypt);
static int __init
init_cifs_common(void)
init_smbfs_common(void)
{
return 0;
}
static void __init
exit_cifs_common(void)
exit_smbfs_common(void)
{
}
module_init(init_cifs_common)
module_exit(exit_cifs_common)
module_init(init_smbfs_common)
module_exit(exit_smbfs_common)

View File

@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1 */
/* SPDX-License-Identifier: LGPL-2.1+ */
/*
* fs/cifs/smbfsctl.h: SMB, CIFS, SMB2 FSCTL definitions
*
@ -19,11 +19,14 @@
* could be invoked from tools via a specialized hook into the VFS rather
* than via the standard vfs entry points
*
* See MS-SMB2 Section 2.2.31 (last checked June 2013, all of that list are
* See MS-SMB2 Section 2.2.31 (last checked September 2021, all of that list are
* below). Additional detail on less common ones can be found in MS-FSCC
* section 2.3.
*/
#ifndef __SMBFSCTL_H
#define __SMBFSCTL_H
/*
* FSCTL values are 32 bits and are constructed as
* <device 16bits> <access 2bits> <function 12bits> <method 2bits>
@ -91,6 +94,7 @@
#define FSCTL_SET_ZERO_ON_DEALLOC 0x00090194 /* BB add struct */
#define FSCTL_SET_SHORT_NAME_BEHAVIOR 0x000901B4 /* BB add struct */
#define FSCTL_GET_INTEGRITY_INFORMATION 0x0009027C
#define FSCTL_GET_REFS_VOLUME_DATA 0x000902D8 /* See MS-FSCC 2.3.24 */
#define FSCTL_GET_RETRIEVAL_POINTERS_AND_REFCOUNT 0x000903d3
#define FSCTL_GET_RETRIEVAL_POINTER_COUNT 0x0009042b
#define FSCTL_QUERY_ALLOCATED_RANGES 0x000940CF
@ -146,7 +150,13 @@
#define IO_REPARSE_TAG_LX_CHR 0x80000025
#define IO_REPARSE_TAG_LX_BLK 0x80000026
#define IO_REPARSE_TAG_LX_SYMLINK_LE cpu_to_le32(0xA000001D)
#define IO_REPARSE_TAG_AF_UNIX_LE cpu_to_le32(0x80000023)
#define IO_REPARSE_TAG_LX_FIFO_LE cpu_to_le32(0x80000024)
#define IO_REPARSE_TAG_LX_CHR_LE cpu_to_le32(0x80000025)
#define IO_REPARSE_TAG_LX_BLK_LE cpu_to_le32(0x80000026)
/* fsctl flags */
/* If Flags is set to this value, the request is an FSCTL not ioctl request */
#define SMB2_0_IOCTL_IS_FSCTL 0x00000001
#endif /* __SMBFSCTL_H */