cifs: smb1: Try failing back to SetFileInfo if SetPathInfo fails
Subsystems (2)
PATCH 1/1 cifs: smb1: Try failing back to SetFileInfo if SetPathInfo fails
RHBZ 1145308
Some very old server may not support SetPathInfo to adjust the timestamps of directories. For these servers, try to open the directory and use SetFileInfo.
--- fs/cifs/cifsproto.h | 2 +- fs/cifs/cifssmb.c | 39 ++++++++++++++++++++++++++++++++++++++- fs/cifs/smb1ops.c | 4 ++-- 3 files changed, 41 insertions(+), 4 deletions(-)
fs/cifs/cifsproto.h +1 -1
@@ -344,7 +344,7 @@ extern int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon,extern int CIFSSMBSetPathInfo (const unsigned int xid,struct cifs_tcon *tcon,const char *fileName,const FILE_BASIC_INFO *data,const struct nls_table *nls_codepage, -int remap_special_chars); +struct cifs_sb_info *cifs_sb);extern int CIFSSMBSetFileInfo (const unsigned int xid,struct cifs_tcon *tcon,const FILE_BASIC_INFO *data,__u16 fid,__u32 pid_of_opener);
fs/cifs/cifssmb.c +38 -1
@@ -5914,9 +5914,41 @@ CIFSSMBSetFileDisposition(const unsigned int xid, struct cifs_tcon *tcon, }int +CIFSSMBSetPathInfoFB (const unsigned int xid,struct cifs_tcon *tcon, +const char *fileName,const FILE_BASIC_INFO *data, +const struct nls_table *nls_codepage, +struct cifs_sb_info *cifs_sb) +{ +int oplock =0 ; +struct cifs_open_parms oparms; +struct cifs_fid fid; +int rc; + + oparms.tcon = tcon; + oparms.cifs_sb = cifs_sb; + oparms.desired_access =GENERIC_WRITE ; + oparms.create_options =cifs_create_options (cifs_sb,0 ); + oparms.disposition =FILE_OPEN ; + oparms.path = fileName; + oparms.fid = &fid; + oparms.reconnect = false; + + rc =CIFS_open (xid, &oparms, &oplock,NULL ); +if (rc) + goto out; + + rc =CIFSSMBSetFileInfo (xid, tcon, data, fid.netfid, current->tgid); +CIFSSMBClose (xid, tcon, fid.netfid); +out: + +return rc; +} + +int CIFSSMBSetPathInfo (const unsigned int xid,struct cifs_tcon *tcon,const char *fileName,const FILE_BASIC_INFO *data, -const struct nls_table *nls_codepage,int remap) +const struct nls_table *nls_codepage, +struct cifs_sb_info *cifs_sb) {TRANSACTION2_SPI_REQ *pSMB =NULL ;TRANSACTION2_SPI_RSP *pSMBr =NULL ;
@@ -5925,6 +5957,7 @@ CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,int bytes_returned =0 ;char *data_offset;__u16 params, param_offset, offset, byte_count, count; +int remap =cifs_remap (cifs_sb);cifs_dbg (FYI ,"In SetTimes\n" );
@@ -5987,6 +6020,10 @@ CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,if (rc == -EAGAIN ) goto SetTimesRetry; +if (rc == -EOPNOTSUPP ) +return CIFSSMBSetPathInfoFB (xid, tcon, fileName, data, + nls_codepage, cifs_sb); +return rc; }
fs/cifs/smb1ops.c +2 -2
@@ -688,7 +688,7 @@ cifs_mkdir_setinfo(struct inode *inode, const char *full_path, dosattrs = cifsInode->cifsAttrs|ATTR_READONLY ; info.Attributes =cpu_to_le32 (dosattrs); rc =CIFSSMBSetPathInfo (xid, tcon, full_path, &info, cifs_sb->local_nls, -cifs_remap (cifs_sb)); + cifs_sb);if (rc ==0 ) cifsInode->cifsAttrs = dosattrs; }
@@ -783,7 +783,7 @@ smb_set_file_info(struct inode *inode, const char *full_path, tcon =tlink_tcon (tlink); rc =CIFSSMBSetPathInfo (xid, tcon, full_path, buf, cifs_sb->local_nls, -cifs_remap (cifs_sb)); + cifs_sb);if (rc ==0 ) { cinode->cifsAttrs =le32_to_cpu (buf->Attributes); goto out;
Signature · 1 line
2.13.6
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Ronnie,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.8-rc5 next-20200714]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ronnie-Sahlberg/cifs-smb1-Try-failing-back-to-SetFileInfo-if-SetPathInfo-fails/20200715-061927 base: git://git.samba.org/sfrench/cifs-2.6.git for-next config: i386-randconfig-s002-20200714 (attached as .config) compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.2-41-g14e84ffc-dirty # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
sparse warnings: (new ones prefixed by >>)
>> fs/cifs/cifssmb.c:5917:1: sparse: sparse: symbol 'CIFSSMBSetPathInfoFB' was not declared. Should it be static?
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[RFC PATCH] cifs: smb1: CIFSSMBSetPathInfoFB() can be static
In reply to Ronnie SahlbergSigned-off-by: kernel test robot <[email protected]>
--- cifssmb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/cifs/cifssmb.c +4 -4
@@ -5914,10 +5914,10 @@ CIFSSMBSetFileDisposition(const unsigned int xid, struct cifs_tcon *tcon, }int -CIFSSMBSetPathInfoFB (const unsigned int xid,struct cifs_tcon *tcon, -const char *fileName,const FILE_BASIC_INFO *data, -const struct nls_table *nls_codepage, -struct cifs_sb_info *cifs_sb) +static CIFSSMBSetPathInfoFB (const unsigned int xid,struct cifs_tcon *tcon, +const char *fileName,const FILE_BASIC_INFO *data, +const struct nls_table *nls_codepage, +struct cifs_sb_info *cifs_sb) {int oplock =0 ;struct cifs_open_parms oparms;
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Ronnie,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.8-rc5 next-20200714]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ronnie-Sahlberg/cifs-smb1-Try-failing-back-to-SetFileInfo-if-SetPathInfo-fails/20200715-061927 base: git://git.samba.org/sfrench/cifs-2.6.git for-next config: arm64-randconfig-r005-20200714 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> fs/cifs/cifssmb.c:5917:1: warning: no previous prototype for function 'CIFSSMBSetPathInfoFB' [-Wmissing-prototypes]
CIFSSMBSetPathInfoFB(const unsigned int xid, struct cifs_tcon *tcon,
^
fs/cifs/cifssmb.c:5916:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
1 warning generated.
--
In file included from fs/cifs/cifssmb.c:40:
In file included from fs/cifs/cifsglob.h:32:
fs/cifs/smb2pdu.h:28:10: error: 'cifsacl.h' file not found with <angled> include; use "quotes" instead
#include <cifsacl.h>
^~~~~~~~~~~
"cifsacl.h"
>> fs/cifs/cifssmb.c:5917:1: warning: no previous prototype for function 'CIFSSMBSetPathInfoFB' [-Wmissing-prototypes] CIFSSMBSetPathInfoFB(const unsigned int xid, struct cifs_tcon *tcon,
^
fs/cifs/cifssmb.c:5916:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
1 warning and 1 error generated.
vim +/CIFSSMBSetPathInfoFB +5917 fs/cifs/cifssmb.c
5915
5916 int
> 5917 CIFSSMBSetPathInfoFB(const unsigned int xid, struct cifs_tcon *tcon, 5918 const char *fileName, const FILE_BASIC_INFO *data, 5919 const struct nls_table *nls_codepage, 5920 struct cifs_sb_info *cifs_sb)
5921 {
5922 int oplock = 0;
5923 struct cifs_open_parms oparms;
5924 struct cifs_fid fid;
5925 int rc;
5926
5927 oparms.tcon = tcon;
5928 oparms.cifs_sb = cifs_sb;
5929 oparms.desired_access = GENERIC_WRITE;
5930 oparms.create_options = cifs_create_options(cifs_sb, 0);
5931 oparms.disposition = FILE_OPEN;
5932 oparms.path = fileName;
5933 oparms.fid = &fid;
5934 oparms.reconnect = false;
5935
5936 rc = CIFS_open(xid, &oparms, &oplock, NULL);
5937 if (rc)
5938 goto out;
5939
5940 rc = CIFSSMBSetFileInfo(xid, tcon, data, fid.netfid, current->tgid);
5941 CIFSSMBClose(xid, tcon, fid.netfid);
5942 out:
5943
5944 return rc;
5945 }
5946
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
patch updated - and merged into cifs-2.6.git for-next pending additional review
Quoted 90 lines · kernel test robot
Hi Ronnie,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.8-rc5 next-20200714]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Ronnie-Sahlberg/cifs-smb1-Try-failing-back-to-SetFileInfo-if-SetPathInfo-fails/20200715-061927 base: git://git.samba.org/sfrench/cifs-2.6.git for-next config: arm64-randconfig-r005-20200714 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
fs/cifs/cifssmb.c:5917:1: warning: no previous prototype for function 'CIFSSMBSetPathInfoFB' [-Wmissing-prototypes]CIFSSMBSetPathInfoFB(const unsigned int xid, struct
cifs_tcon*tcon,
^
fs/cifs/cifssmb.c:5916:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
1 warning generated.
--
In file included fromfs/cifs/cifssmb.c:40:In file included from fs/cifs/cifsglob.h:32: fs/cifs/smb2pdu.h:28:10: error: 'cifsacl.h' file not found with <angled> include; use "quotes" instead #include <cifsacl.h> ^~~~~~~~~~~ "cifsacl.h"Quoted 1 line
Quoted 1 line
fs/cifs/cifssmb.c:5917:1: warning: no previous prototype for function 'CIFSSMBSetPathInfoFB' [-Wmissing-prototypes]CIFSSMBSetPathInfoFB(const unsigned int xid, struct
cifs_tcon*tcon,
^
fs/cifs/cifssmb.c:5916:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
1 warning and 1 error generated.vim +/CIFSSMBSetPathInfoFB +5917
fs/cifs/cifssmb.c5915
5916 intQuoted 1 line
5917 CIFSSMBSetPathInfoFB(const unsigned int xid, struct
cifs_tcon*tcon,5918 const char *fileName, const FILE_BASIC_INFO *data, 5919 const struct nls_table *nls_codepage, 5920 struct cifs_sb_info *cifs_sb) 5921 { 5922 int oplock = 0; 5923 struct cifs_open_parms oparms; 5924 struct cifs_fid fid; 5925 int rc; 5926 5927 oparms.tcon = tcon; 5928 oparms.cifs_sb = cifs_sb; 5929 oparms.desired_access = GENERIC_WRITE; 5930 oparms.create_options = cifs_create_options(cifs_sb, 0); 5931 oparms.disposition = FILE_OPEN; 5932 oparms.path = fileName; 5933 oparms.fid = &fid; 5934 oparms.reconnect = false;5935
5936 rc =CIFS_open(xid, &oparms, &oplock, NULL);
5937 if (rc)
5938 goto out;
5939
5940 rc =CIFSSMBSetFileInfo(xid, tcon, data, fid.netfid, current->tgid);
5941CIFSSMBClose(xid, tcon, fid.netfid);
5942 out:
5943
5944 return rc;
5945 }
5946---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Signature · 3 lines
Thanks, Steve
Kenneth Dsouza
Tested-byQuoted 102 lines · Steve French
patch updated - and merged into cifs-2.6.git for-next pending additional review
Quoted 87 lines · kernel test robot
Hi Ronnie,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.8-rc5 next-20200714]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Ronnie-Sahlberg/cifs-smb1-Try-failing-back-to-SetFileInfo-if-SetPathInfo-fails/20200715-061927 base: git://git.samba.org/sfrench/cifs-2.6.git for-next config: arm64-randconfig-r005-20200714 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
fs/cifs/cifssmb.c:5917:1: warning: no previous prototype for function 'CIFSSMBSetPathInfoFB' [-Wmissing-prototypes]CIFSSMBSetPathInfoFB(const unsigned int xid, struct
cifs_tcon*tcon,
^
fs/cifs/cifssmb.c:5916:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
1 warning generated.
--
In file included fromfs/cifs/cifssmb.c:40:In file included from fs/cifs/cifsglob.h:32: fs/cifs/smb2pdu.h:28:10: error: 'cifsacl.h' file not found with <angled> include; use "quotes" instead #include <cifsacl.h> ^~~~~~~~~~~ "cifsacl.h"Quoted 1 line
Quoted 1 line
fs/cifs/cifssmb.c:5917:1: warning: no previous prototype for function 'CIFSSMBSetPathInfoFB' [-Wmissing-prototypes]CIFSSMBSetPathInfoFB(const unsigned int xid, struct
cifs_tcon*tcon,
^
fs/cifs/cifssmb.c:5916:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
1 warning and 1 error generated.vim +/CIFSSMBSetPathInfoFB +5917
fs/cifs/cifssmb.c5915
5916 intQuoted 1 line
5917 CIFSSMBSetPathInfoFB(const unsigned int xid, struct
cifs_tcon*tcon,5918 const char *fileName, const FILE_BASIC_INFO *data, 5919 const struct nls_table *nls_codepage, 5920 struct cifs_sb_info *cifs_sb) 5921 { 5922 int oplock = 0; 5923 struct cifs_open_parms oparms; 5924 struct cifs_fid fid; 5925 int rc; 5926 5927 oparms.tcon = tcon; 5928 oparms.cifs_sb = cifs_sb; 5929 oparms.desired_access = GENERIC_WRITE; 5930 oparms.create_options = cifs_create_options(cifs_sb, 0); 5931 oparms.disposition = FILE_OPEN; 5932 oparms.path = fileName; 5933 oparms.fid = &fid; 5934 oparms.reconnect = false;5935
5936 rc =CIFS_open(xid, &oparms, &oplock, NULL);
5937 if (rc)
5938 goto out;
5939
5940 rc =CIFSSMBSetFileInfo(xid, tcon, data, fid.netfid, current->tgid);
5941CIFSSMBClose(xid, tcon, fid.netfid);
5942 out:
5943
5944 return rc;
5945 }
5946Quoted 3 lines
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]--
Thanks,Steve