[PATCH] um: add 2 missing libs to fix various build errors
by Randy Dunlap
Fix many build errors (at least 18 build error reports) for uml on i386
by adding 2 more library object files. All missing symbols are
either cmpxchg8b_emu or atomic*386.
Here are a few examples of the build errors that are eliminated:
/usr/bin/ld: core.c:(.text+0xd83): undefined reference to `cmpxchg8b_emu'
/usr/bin/ld: core.c:(.text+0x2bb2): undefined reference to `atomic64_add_386'
/usr/bin/ld: core.c:(.text+0x2c5d): undefined reference to `atomic64_xchg_386'
syscall.c:(.text+0x2f49): undefined reference to `atomic64_set_386'
/usr/bin/ld: syscall.c:(.text+0x2f54): undefined reference to `atomic64_set_386'
syscall.c:(.text+0x33a4): undefined reference to `atomic64_inc_386'
/usr/bin/ld: syscall.c:(.text+0x33ac): undefined reference to `atomic64_inc_386'
/usr/bin/ld: net/ipv4/inet_timewait_sock.o: in function `inet_twsk_alloc':
inet_timewait_sock.c:(.text+0x3d1): undefined reference to `atomic64_read_386'
/usr/bin/ld: inet_timewait_sock.c:(.text+0x3dd): undefined reference to `atomic64_set_386'
/usr/bin/ld: net/ipv4/inet_connection_sock.o: in function `inet_csk_clone_lock':
inet_connection_sock.c:(.text+0x1d74): undefined reference to `atomic64_read_386'
/usr/bin/ld: inet_connection_sock.c:(.text+0x1d80): undefined reference to `atomic64_set_386'
/usr/bin/ld: net/ipv4/tcp_input.o: in function `inet_reqsk_alloc':
tcp_input.c:(.text+0xa345): undefined reference to `atomic64_set_386'
/usr/bin/ld: net/mac80211/wpa.o: in function `ieee80211_crypto_tkip_encrypt':
wpa.c:(.text+0x739): undefined reference to `atomic64_inc_return_386'
Signed-off-by: Randy Dunlap <rdunlap(a)infradead.org>
Reported-by: kernel test robot <lkp(a)intel.com>
Cc: Brendan Jackman <jackmanb(a)google.com>
Cc: Alexei Starovoitov <ast(a)kernel.org>
Cc: kbuild-all(a)lists.01.org
Cc: Jeff Dike <jdike(a)addtoit.com>
Cc: Richard Weinberger <richard(a)nod.at>
Cc: Anton Ivanov <anton.ivanov(a)cambridgegreys.com>
Cc: linux-um(a)lists.infradead.org
Cc: Johannes Berg <johannes(a)sipsolutions.net>
Cc: Johannes Berg <johannes.berg(a)intel.com>
---
My UML on i386 build environment is br0ken so this is not tested other
than to see that the .o files are built as expected.
If someone can test/verify it, please respond. Thanks.
arch/x86/um/Makefile | 1 +
1 file changed, 1 insertion(+)
--- lnx-512-rc5.orig/arch/x86/um/Makefile
+++ lnx-512-rc5/arch/x86/um/Makefile
@@ -21,6 +21,7 @@ obj-y += checksum_32.o syscalls_32.o
obj-$(CONFIG_ELF_CORE) += elfcore.o
subarch-y = ../lib/string_32.o ../lib/atomic64_32.o ../lib/atomic64_cx8_32.o
+subarch-y += ../lib/cmpxchg8b_emu.o ../lib/atomic64_386_32.o
subarch-y += ../kernel/sys_ia32.o
else
1 year, 4 months
Re: [PATCH v2 1/2] csky: add CSKY 810/860 FPU instruction simulation
by kernel test robot
Hi Wang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.13-rc1 next-20210511]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Wang-Junqiang/csky-add-CSKY-810-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1140ab592e2ebf8153d2b322604031a8868ce7a5
config: csky-randconfig-r005-20210511 (attached as .config)
compiler: csky-linux-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/ba3d3b92b548373cb84c6915a02dda46e...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wang-Junqiang/csky-add-CSKY-810-860-FPU-instruction-simulation/20210511-212648
git checkout ba3d3b92b548373cb84c6915a02dda46ef1c5d38
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=csky
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> error: arch/csky/include/uapi/asm/siginfo.h: missing "WITH Linux-syscall-note" for SPDX-License-Identifier
make[2]: *** [scripts/Makefile.headersinst:63: usr/include/asm/siginfo.h] Error 1
make[2]: Target '__headers' not remade because of errors.
make[1]: *** [Makefile:1334: headers] Error 2
make[1]: Target 'headers_install' not remade because of errors.
make: *** [Makefile:215: __sub-make] Error 2
make: Target 'headers_install' not remade because of errors.
--
csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
csky-linux-gcc: note: valid arguments to '-mcpu=' are: ck801 ck801t ck802 ck802j ck802t ck803 ck803e ck803ef ck803efh ck803efhr1 ck803efht ck803efhtr1 ck803efr1 ck803eft ck803eftr1 ck803eh ck803ehr1 ck803eht ck803ehtr1 ck803er1 ck803et ck803etr1 ck803f ck803fh ck803fhr1 ck803fr1 ck803ft ck803ftr1 ck803h ck803hr1 ck803ht ck803htr1 ck803r1 ck803s ck803se ck803sef ck803seft ck803sf ck803st ck803t ck803tr1 ck807 ck807e ck807ef ck807f ck810 ck810e ck810ef ck810eft ck810et ck810f ck810ft ck810ftv ck810fv ck810t ck810tv ck810v; did you mean 'ck810'?
>> error: arch/csky/include/uapi/asm/siginfo.h: missing "WITH Linux-syscall-note" for SPDX-License-Identifier
make[2]: *** [scripts/Makefile.headersinst:63: usr/include/asm/siginfo.h] Error 1
make[2]: Target '__headers' not remade because of errors.
make[1]: *** [Makefile:1334: headers] Error 2
csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
csky-linux-gcc: note: valid arguments to '-mcpu=' are: ck801 ck801t ck802 ck802j ck802t ck803 ck803e ck803ef ck803efh ck803efhr1 ck803efht ck803efhtr1 ck803efr1 ck803eft ck803eftr1 ck803eh ck803ehr1 ck803eht ck803ehtr1 ck803er1 ck803et ck803etr1 ck803f ck803fh ck803fhr1 ck803fr1 ck803ft ck803ftr1 ck803h ck803hr1 ck803ht ck803htr1 ck803r1 ck803s ck803se ck803sef ck803seft ck803sf ck803st ck803t ck803tr1 ck807 ck807e ck807ef ck807f ck810 ck810e ck810ef ck810eft ck810et ck810f ck810ft ck810ftv ck810fv ck810t ck810tv ck810v; did you mean 'ck810'?
make[2]: *** [scripts/Makefile.build:272: scripts/mod/empty.o] Error 1
csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
csky-linux-gcc: note: valid arguments to '-mcpu=' are: ck801 ck801t ck802 ck802j ck802t ck803 ck803e ck803ef ck803efh ck803efhr1 ck803efht ck803efhtr1 ck803efr1 ck803eft ck803eftr1 ck803eh ck803ehr1 ck803eht ck803ehtr1 ck803er1 ck803et ck803etr1 ck803f ck803fh ck803fhr1 ck803fr1 ck803ft ck803ftr1 ck803h ck803hr1 ck803ht ck803htr1 ck803r1 ck803s ck803se ck803sef ck803seft ck803sf ck803st ck803t ck803tr1 ck807 ck807e ck807ef ck807f ck810 ck810e ck810ef ck810eft ck810et ck810f ck810ft ck810ftv ck810fv ck810t ck810tv ck810v; did you mean 'ck810'?
make[2]: *** [scripts/Makefile.build:117: scripts/mod/devicetable-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1226: prepare0] Error 2
make[1]: Target 'modules_prepare' not remade because of errors.
make: *** [Makefile:215: __sub-make] Error 2
make: Target 'modules_prepare' not remade because of errors.
--
csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
csky-linux-gcc: note: valid arguments to '-mcpu=' are: ck801 ck801t ck802 ck802j ck802t ck803 ck803e ck803ef ck803efh ck803efhr1 ck803efht ck803efhtr1 ck803efr1 ck803eft ck803eftr1 ck803eh ck803ehr1 ck803eht ck803ehtr1 ck803er1 ck803et ck803etr1 ck803f ck803fh ck803fhr1 ck803fr1 ck803ft ck803ftr1 ck803h ck803hr1 ck803ht ck803htr1 ck803r1 ck803s ck803se ck803sef ck803seft ck803sf ck803st ck803t ck803tr1 ck807 ck807e ck807ef ck807f ck810 ck810e ck810ef ck810eft ck810et ck810f ck810ft ck810ftv ck810fv ck810t ck810tv ck810v; did you mean 'ck810'?
scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr]
scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
>> error: arch/csky/include/uapi/asm/siginfo.h: missing "WITH Linux-syscall-note" for SPDX-License-Identifier
make[2]: *** [scripts/Makefile.headersinst:63: usr/include/asm/siginfo.h] Error 1
make[2]: Target '__headers' not remade because of errors.
make[1]: *** [Makefile:1334: headers] Error 2
csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
csky-linux-gcc: note: valid arguments to '-mcpu=' are: ck801 ck801t ck802 ck802j ck802t ck803 ck803e ck803ef ck803efh ck803efhr1 ck803efht ck803efhtr1 ck803efr1 ck803eft ck803eftr1 ck803eh ck803ehr1 ck803eht ck803ehtr1 ck803er1 ck803et ck803etr1 ck803f ck803fh ck803fhr1 ck803fr1 ck803ft ck803ftr1 ck803h ck803hr1 ck803ht ck803htr1 ck803r1 ck803s ck803se ck803sef ck803seft ck803sf ck803st ck803t ck803tr1 ck807 ck807e ck807ef ck807f ck810 ck810e ck810ef ck810eft ck810et ck810f ck810ft ck810ftv ck810fv ck810t ck810tv ck810v; did you mean 'ck810'?
make[2]: *** [scripts/Makefile.build:272: scripts/mod/empty.o] Error 1
csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
csky-linux-gcc: note: valid arguments to '-mcpu=' are: ck801 ck801t ck802 ck802j ck802t ck803 ck803e ck803ef ck803efh ck803efhr1 ck803efht ck803efhtr1 ck803efr1 ck803eft ck803eftr1 ck803eh ck803ehr1 ck803eht ck803ehtr1 ck803er1 ck803et ck803etr1 ck803f ck803fh ck803fhr1 ck803fr1 ck803ft ck803ftr1 ck803h ck803hr1 ck803ht ck803htr1 ck803r1 ck803s ck803se ck803sef ck803seft ck803sf ck803st ck803t ck803tr1 ck807 ck807e ck807ef ck807f ck810 ck810e ck810ef ck810eft ck810et ck810f ck810ft ck810ftv ck810fv ck810t ck810tv ck810v; did you mean 'ck810'?
make[2]: *** [scripts/Makefile.build:117: scripts/mod/devicetable-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1226: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:215: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for LOCKDEP
Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
Selected by
- LOCK_STAT && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
- DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
⚠️ World Business Register 2021/2022 Pending domain registration [REF:KGI-62824]
by Team World Business Register
Ladies and Gentlemen,
In order to have your business(es) inserted in
the register of Universal Companies for the
2021-2022 edition: please print and complete
the attached form (wbr2022com.jpg) and send it
to the following address:
World Business-List
Postbus 34
3700 AA Zeist
The Netherlands
Fax: +31 303 100 126
or send it to the email address mentioned on the form.
Updating is free of charge!
This form can also be used for your other domain(s) and/or business(es).
A PDF version of the form is also available.
DEADLINE: May 23rd 2021!
1 year, 4 months
Re: [PATCH 2/3] cifs: handle multiple ip addresses per hostname
by kernel test robot
Hi Paulo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.13-rc1 next-20210511]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Paulo-Alcantara/Support-multiple...
base: git://git.samba.org/sfrench/cifs-2.6.git for-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/210f8e08a6bb153136929af6da6e0a728...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Paulo-Alcantara/Support-multiple-ips-per-hostname/20210512-003751
git checkout 210f8e08a6bb153136929af6da6e0a7289ba5931
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
fs/cifs/connect.c: In function 'cifs_create_socket':
fs/cifs/connect.c:177:6: warning: variable 'slen' set but not used [-Wunused-but-set-variable]
177 | int slen, sfamily;
| ^~~~
fs/cifs/connect.c: In function 'next_dfs_prepath':
>> fs/cifs/connect.c:3540:1: warning: the frame size of 2516 bytes is larger than 1024 bytes [-Wframe-larger-than=]
3540 | }
| ^
fs/cifs/connect.c: In function 'do_dfs_failover':
fs/cifs/connect.c:3313:1: warning: the frame size of 2584 bytes is larger than 1024 bytes [-Wframe-larger-than=]
3313 | }
| ^
--
fs/cifs/dfs_cache.c: In function 'find_root_ses.isra.0':
>> fs/cifs/dfs_cache.c:1483:1: warning: the frame size of 2548 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1483 | }
| ^
vim +3540 fs/cifs/connect.c
7efd081582619e Paulo Alcantara 2020-07-21 3497
ff2c54a04097de Paulo Alcantara 2021-02-24 3498 /* Set up next dfs prefix path in @dfs_path */
ff2c54a04097de Paulo Alcantara 2021-02-24 3499 static int next_dfs_prepath(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx,
7efd081582619e Paulo Alcantara 2020-07-21 3500 const unsigned int xid, struct TCP_Server_Info *server,
7efd081582619e Paulo Alcantara 2020-07-21 3501 struct cifs_tcon *tcon, char **dfs_path)
56c762eb9bee33 Paulo Alcantara 2018-11-14 3502 {
ff2c54a04097de Paulo Alcantara 2021-02-24 3503 char *path, *npath;
ff2c54a04097de Paulo Alcantara 2021-02-24 3504 int added_treename = is_tcon_dfs(tcon);
ff2c54a04097de Paulo Alcantara 2021-02-24 3505 int rc;
7efd081582619e Paulo Alcantara 2020-07-21 3506
3fa1c6d1b8f5c3 Ronnie Sahlberg 2020-12-09 3507 path = cifs_build_path_to_root(ctx, cifs_sb, tcon, added_treename);
7efd081582619e Paulo Alcantara 2020-07-21 3508 if (!path)
7efd081582619e Paulo Alcantara 2020-07-21 3509 return -ENOMEM;
ce558b0e17f8a6 Steve French 2018-05-31 3510
ff2c54a04097de Paulo Alcantara 2021-02-24 3511 rc = is_path_remote(cifs_sb, ctx, xid, server, tcon);
ff2c54a04097de Paulo Alcantara 2021-02-24 3512 if (rc == -EREMOTE) {
3fa1c6d1b8f5c3 Ronnie Sahlberg 2020-12-09 3513 struct smb3_fs_context v = {NULL};
7efd081582619e Paulo Alcantara 2020-07-21 3514 /* if @path contains a tree name, skip it in the prefix path */
7efd081582619e Paulo Alcantara 2020-07-21 3515 if (added_treename) {
66e7b09c731175 Ronnie Sahlberg 2020-11-05 3516 rc = smb3_parse_devname(path, &v);
7efd081582619e Paulo Alcantara 2020-07-21 3517 if (rc)
ff2c54a04097de Paulo Alcantara 2021-02-24 3518 goto out;
7efd081582619e Paulo Alcantara 2020-07-21 3519 npath = build_unc_path_to_root(&v, cifs_sb, true);
c741cba2cd1d14 Ronnie Sahlberg 2020-12-14 3520 smb3_cleanup_fs_context_contents(&v);
7efd081582619e Paulo Alcantara 2020-07-21 3521 } else {
3fa1c6d1b8f5c3 Ronnie Sahlberg 2020-12-09 3522 v.UNC = ctx->UNC;
7efd081582619e Paulo Alcantara 2020-07-21 3523 v.prepath = path + 1;
7efd081582619e Paulo Alcantara 2020-07-21 3524 npath = build_unc_path_to_root(&v, cifs_sb, true);
5072010ccf0592 Paulo Alcantara (SUSE 2019-03-19 3525) }
ff2c54a04097de Paulo Alcantara 2021-02-24 3526
7efd081582619e Paulo Alcantara 2020-07-21 3527 if (IS_ERR(npath)) {
7efd081582619e Paulo Alcantara 2020-07-21 3528 rc = PTR_ERR(npath);
ff2c54a04097de Paulo Alcantara 2021-02-24 3529 goto out;
a6b5058fafdf50 Aurelien Aptel 2016-05-25 3530 }
ff2c54a04097de Paulo Alcantara 2021-02-24 3531
7efd081582619e Paulo Alcantara 2020-07-21 3532 kfree(*dfs_path);
7efd081582619e Paulo Alcantara 2020-07-21 3533 *dfs_path = npath;
ff2c54a04097de Paulo Alcantara 2021-02-24 3534 rc = -EREMOTE;
1bfe73c258addc Igor Mammedov 2009-04-01 3535 }
1bfe73c258addc Igor Mammedov 2009-04-01 3536
ff2c54a04097de Paulo Alcantara 2021-02-24 3537 out:
7efd081582619e Paulo Alcantara 2020-07-21 3538 kfree(path);
7efd081582619e Paulo Alcantara 2020-07-21 3539 return rc;
4a367dc0443566 Paulo Alcantara 2018-11-14 @3540 }
4a367dc0443566 Paulo Alcantara 2018-11-14 3541
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
Re: [PATCH 2/3] cifs: handle multiple ip addresses per hostname
by kernel test robot
Hi Paulo,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on cifs/for-next]
[also build test ERROR on v5.13-rc1 next-20210511]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Paulo-Alcantara/Support-multiple...
base: git://git.samba.org/sfrench/cifs-2.6.git for-next
config: microblaze-randconfig-s032-20210511 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/210f8e08a6bb153136929af6da6e0a728...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Paulo-Alcantara/Support-multiple-ips-per-hostname/20210512-003751
git checkout 210f8e08a6bb153136929af6da6e0a7289ba5931
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
fs/cifs/connect.c: In function 'cifs_create_socket':
>> fs/cifs/connect.c:177:6: warning: variable 'slen' set but not used [-Wunused-but-set-variable]
177 | int slen, sfamily;
| ^~~~
fs/cifs/connect.c: In function 'cifs_reconnect':
>> fs/cifs/connect.c:726:46: error: 'cifs_sb' undeclared (first use in this function); did you mean 'cifs_ses'?
726 | if (IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) && cifs_sb &&
| ^~~~~~~
| cifs_ses
fs/cifs/connect.c:726:46: note: each undeclared identifier is reported only once for each function it appears in
>> fs/cifs/connect.c:733:5: error: implicit declaration of function 'reconn_set_next_dfs_target' [-Werror=implicit-function-declaration]
733 | reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/cifs/connect.c:733:50: error: 'tgt_list' undeclared (first use in this function)
733 | reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
| ^~~~~~~~
>> fs/cifs/connect.c:733:61: error: 'tgt_it' undeclared (first use in this function)
733 | reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
| ^~~~~~
cc1: some warnings being treated as errors
--
fs/cifs/sess.c: In function 'cifs_ses_add_channel':
>> fs/cifs/sess.c:310:1: warning: the frame size of 2608 bytes is larger than 1024 bytes [-Wframe-larger-than=]
310 | }
| ^
vim +726 fs/cifs/connect.c
577
578 /*
579 * cifs tcp session reconnection
580 *
581 * mark tcp session as reconnecting so temporarily locked
582 * mark all smb sessions as reconnecting for tcp session
583 * reconnect tcp session
584 * wake up waiters on reconnection? - (not needed currently)
585 */
586 int
587 cifs_reconnect(struct TCP_Server_Info *server)
588 {
589 int rc = 0;
590 struct list_head *tmp, *tmp2;
591 struct cifs_ses *ses;
592 struct cifs_tcon *tcon;
593 struct mid_q_entry *mid_entry;
594 struct list_head retry_list;
595 #ifdef CONFIG_CIFS_DFS_UPCALL
596 struct super_block *sb = NULL;
597 struct cifs_sb_info *cifs_sb = NULL;
598 struct dfs_cache_tgt_list tgt_list = {0};
599 struct dfs_cache_tgt_iterator *tgt_it = NULL;
600 #endif
601 struct sockaddr_storage *addrs = NULL;
602 unsigned int numaddrs;
603
604 addrs = kmalloc(sizeof(*addrs) * CIFS_MAX_ADDR_COUNT, GFP_KERNEL);
605 if (!addrs) {
606 rc = -ENOMEM;
607 goto out;
608 }
609
610 spin_lock(&GlobalMid_Lock);
611 server->nr_targets = 1;
612 #ifdef CONFIG_CIFS_DFS_UPCALL
613 spin_unlock(&GlobalMid_Lock);
614 sb = cifs_get_tcp_super(server);
615 if (IS_ERR(sb)) {
616 rc = PTR_ERR(sb);
617 cifs_dbg(FYI, "%s: will not do DFS failover: rc = %d\n",
618 __func__, rc);
619 sb = NULL;
620 } else {
621 cifs_sb = CIFS_SB(sb);
622 rc = reconn_setup_dfs_targets(cifs_sb, &tgt_list);
623 if (rc) {
624 cifs_sb = NULL;
625 if (rc != -EOPNOTSUPP) {
626 cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n",
627 __func__);
628 }
629 } else {
630 server->nr_targets = dfs_cache_get_nr_tgts(&tgt_list);
631 }
632 }
633 cifs_dbg(FYI, "%s: will retry %d target(s)\n", __func__,
634 server->nr_targets);
635 spin_lock(&GlobalMid_Lock);
636 #endif
637 if (server->tcpStatus == CifsExiting) {
638 /* the demux thread will exit normally
639 next time through the loop */
640 spin_unlock(&GlobalMid_Lock);
641 #ifdef CONFIG_CIFS_DFS_UPCALL
642 dfs_cache_free_tgts(&tgt_list);
643 cifs_put_tcp_super(sb);
644 #endif
645 goto out;
646 } else
647 server->tcpStatus = CifsNeedReconnect;
648 spin_unlock(&GlobalMid_Lock);
649 server->maxBuf = 0;
650 server->max_read = 0;
651
652 cifs_dbg(FYI, "Mark tcp session as need reconnect\n");
653 trace_smb3_reconnect(server->CurrentMid, server->conn_id, server->hostname);
654
655 /* before reconnecting the tcp session, mark the smb session (uid)
656 and the tid bad so they are not used until reconnected */
657 cifs_dbg(FYI, "%s: marking sessions and tcons for reconnect\n",
658 __func__);
659 spin_lock(&cifs_tcp_ses_lock);
660 list_for_each(tmp, &server->smb_ses_list) {
661 ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
662 ses->need_reconnect = true;
663 list_for_each(tmp2, &ses->tcon_list) {
664 tcon = list_entry(tmp2, struct cifs_tcon, tcon_list);
665 tcon->need_reconnect = true;
666 }
667 if (ses->tcon_ipc)
668 ses->tcon_ipc->need_reconnect = true;
669 }
670 spin_unlock(&cifs_tcp_ses_lock);
671
672 /* do not want to be sending data on a socket we are freeing */
673 cifs_dbg(FYI, "%s: tearing down socket\n", __func__);
674 mutex_lock(&server->srv_mutex);
675 if (server->ssocket) {
676 cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n",
677 server->ssocket->state, server->ssocket->flags);
678 kernel_sock_shutdown(server->ssocket, SHUT_WR);
679 cifs_dbg(FYI, "Post shutdown state: 0x%x Flags: 0x%lx\n",
680 server->ssocket->state, server->ssocket->flags);
681 sock_release(server->ssocket);
682 server->ssocket = NULL;
683 }
684 server->sequence_number = 0;
685 server->session_estab = false;
686 kfree(server->session_key.response);
687 server->session_key.response = NULL;
688 server->session_key.len = 0;
689 server->lstrp = jiffies;
690
691 /* mark submitted MIDs for retry and issue callback */
692 INIT_LIST_HEAD(&retry_list);
693 cifs_dbg(FYI, "%s: moving mids to private list\n", __func__);
694 spin_lock(&GlobalMid_Lock);
695 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
696 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
697 kref_get(&mid_entry->refcount);
698 if (mid_entry->mid_state == MID_REQUEST_SUBMITTED)
699 mid_entry->mid_state = MID_RETRY_NEEDED;
700 list_move(&mid_entry->qhead, &retry_list);
701 mid_entry->mid_flags |= MID_DELETED;
702 }
703 spin_unlock(&GlobalMid_Lock);
704 mutex_unlock(&server->srv_mutex);
705
706 cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
707 list_for_each_safe(tmp, tmp2, &retry_list) {
708 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
709 list_del_init(&mid_entry->qhead);
710 mid_entry->callback(mid_entry);
711 cifs_mid_q_entry_release(mid_entry);
712 }
713
714 if (cifs_rdma_enabled(server)) {
715 mutex_lock(&server->srv_mutex);
716 smbd_destroy(server);
717 mutex_unlock(&server->srv_mutex);
718 }
719
720 do {
721 try_to_freeze();
722
723 mutex_lock(&server->srv_mutex);
724
725 if (!cifs_swn_set_server_dstaddr(server)) {
> 726 if (IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) && cifs_sb &&
727 cifs_sb->origin_fullpath) {
728 /*
729 * Set up next DFS target server (if any) for reconnect. If DFS
730 * feature is disabled, then we will retry last server we
731 * connected to before.
732 */
> 733 reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
734 }
735 /*
736 * Resolve the hostname again to make sure that IP address is up-to-date.
737 */
738 numaddrs = CIFS_MAX_ADDR_COUNT;
739 reconn_resolve_hostname(server, addrs, &numaddrs);
740
741 if (cifs_rdma_enabled(server)) {
742 /* FIXME: handle multiple ips for RDMA */
743 server->dst_addr_list[0] = server->dstaddr = addrs[0];
744 server->dst_addr_count = 1;
745 }
746 } else {
747 addrs[0] = server->dstaddr;
748 numaddrs = 1;
749 }
750
751 if (cifs_rdma_enabled(server)) {
752 rc = smbd_reconnect(server);
753 } else {
754 struct socket **socks, *sock;
755
756 socks = connect_all_ips(server, addrs, numaddrs);
757 if (IS_ERR(socks)) {
758 rc = PTR_ERR(socks);
759 cifs_server_dbg(VFS, "%s: connect_all_ips() failed: %d\n", __func__, rc);
760 } else {
761 mutex_unlock(&server->srv_mutex);
762 sock = get_first_connected_socket(socks, addrs, numaddrs, true);
763 release_sockets(socks, numaddrs);
764 mutex_lock(&server->srv_mutex);
765
766 if (IS_ERR(sock)) {
767 rc = PTR_ERR(sock);
768 cifs_server_dbg(FYI, "%s: couldn't find a connected socket: %d\n", __func__, rc);
769 } else {
770 rc = kernel_getpeername(sock, (struct sockaddr *)&server->dstaddr);
771 if (rc < 0) {
772 cifs_server_dbg(VFS, "%s: getpeername() failed: %d\n", __func__, rc);
773 sock_release(sock);
774 } else
775 rc = 0;
776 }
777 if (!rc) {
778 memcpy(server->dst_addr_list, addrs,
779 sizeof(addrs[0]) * numaddrs);
780 server->dst_addr_count = numaddrs;
781 server->ssocket = sock;
782 }
783 }
784 }
785
786 if (rc) {
787 mutex_unlock(&server->srv_mutex);
788 cifs_server_dbg(FYI, "%s: reconnect error %d\n", __func__, rc);
789 msleep(3000);
790 } else {
791 atomic_inc(&tcpSesReconnectCount);
792 set_credits(server, 1);
793 spin_lock(&GlobalMid_Lock);
794 if (server->tcpStatus != CifsExiting)
795 server->tcpStatus = CifsNeedNegotiate;
796 spin_unlock(&GlobalMid_Lock);
797 cifs_swn_reset_server_dstaddr(server);
798 mutex_unlock(&server->srv_mutex);
799 }
800 } while (server->tcpStatus == CifsNeedReconnect);
801
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[gfs2:for-next 1/2] fs/gfs2/file.c:948:12: error: invalid storage class for function 'fallocate_chunk'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next
head: 5bec51f9bc58e6d724fa3588b77e4c2f865dd13a
commit: a1381d36d843d4f108fe24b384a8a24694fe0bb5 [1/2] gfs2: Prevent direct-I/O write fallback errors from getting lost
config: m68k-randconfig-r016-20210511 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/commi...
git remote add gfs2 https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git
git fetch --no-tags gfs2 for-next
git checkout a1381d36d843d4f108fe24b384a8a24694fe0bb5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
fs/gfs2/file.c: In function 'gfs2_file_write_iter':
>> fs/gfs2/file.c:948:12: error: invalid storage class for function 'fallocate_chunk'
948 | static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
| ^~~~~~~~~~~~~~~
>> fs/gfs2/file.c:948:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
948 | static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
| ^~~~~~
>> fs/gfs2/file.c:1002:13: error: invalid storage class for function 'calc_max_reserv'
1002 | static void calc_max_reserv(struct gfs2_inode *ip, loff_t *len,
| ^~~~~~~~~~~~~~~
>> fs/gfs2/file.c:1024:13: error: invalid storage class for function '__gfs2_fallocate'
1024 | static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
| ^~~~~~~~~~~~~~~~
>> fs/gfs2/file.c:1140:13: error: invalid storage class for function 'gfs2_fallocate'
1140 | static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
| ^~~~~~~~~~~~~~
>> fs/gfs2/file.c:1189:16: error: invalid storage class for function 'gfs2_file_splice_write'
1189 | static ssize_t gfs2_file_splice_write(struct pipe_inode_info *pipe,
| ^~~~~~~~~~~~~~~~~~~~~~
>> fs/gfs2/file.c:1393:1: error: expected declaration or statement at end of input
1393 | };
| ^
fs/gfs2/file.c:1385:30: warning: unused variable 'gfs2_dir_fops_nolock' [-Wunused-variable]
1385 | const struct file_operations gfs2_dir_fops_nolock = {
| ^~~~~~~~~~~~~~~~~~~~
fs/gfs2/file.c:1368:30: warning: unused variable 'gfs2_file_fops_nolock' [-Wunused-variable]
1368 | const struct file_operations gfs2_file_fops_nolock = {
| ^~~~~~~~~~~~~~~~~~~~~
At top level:
fs/gfs2/file.c:872:16: warning: 'gfs2_file_write_iter' defined but not used [-Wunused-function]
872 | static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
| ^~~~~~~~~~~~~~~~~~~~
vim +/fallocate_chunk +948 fs/gfs2/file.c
56aa616a03feca Steven Whitehouse 2009-12-08 947
2fe17c1075836b Christoph Hellwig 2011-01-14 @948 static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
2fe17c1075836b Christoph Hellwig 2011-01-14 949 int mode)
2fe17c1075836b Christoph Hellwig 2011-01-14 950 {
fffb64127adc3e Andreas Gruenbacher 2018-03-29 951 struct super_block *sb = inode->i_sb;
2fe17c1075836b Christoph Hellwig 2011-01-14 952 struct gfs2_inode *ip = GFS2_I(inode);
fffb64127adc3e Andreas Gruenbacher 2018-03-29 953 loff_t end = offset + len;
2fe17c1075836b Christoph Hellwig 2011-01-14 954 struct buffer_head *dibh;
2fe17c1075836b Christoph Hellwig 2011-01-14 955 int error;
2fe17c1075836b Christoph Hellwig 2011-01-14 956
2fe17c1075836b Christoph Hellwig 2011-01-14 957 error = gfs2_meta_inode_buffer(ip, &dibh);
2fe17c1075836b Christoph Hellwig 2011-01-14 958 if (unlikely(error))
64dd153c83743a Benjamin Marzinski 2011-09-12 959 return error;
2fe17c1075836b Christoph Hellwig 2011-01-14 960
350a9b0a7269c6 Steven Whitehouse 2012-12-14 961 gfs2_trans_add_meta(ip->i_gl, dibh);
2fe17c1075836b Christoph Hellwig 2011-01-14 962
2fe17c1075836b Christoph Hellwig 2011-01-14 963 if (gfs2_is_stuffed(ip)) {
2fe17c1075836b Christoph Hellwig 2011-01-14 964 error = gfs2_unstuff_dinode(ip, NULL);
2fe17c1075836b Christoph Hellwig 2011-01-14 965 if (unlikely(error))
2fe17c1075836b Christoph Hellwig 2011-01-14 966 goto out;
2fe17c1075836b Christoph Hellwig 2011-01-14 967 }
2fe17c1075836b Christoph Hellwig 2011-01-14 968
fffb64127adc3e Andreas Gruenbacher 2018-03-29 969 while (offset < end) {
c25892827c7996 Andreas Gruenbacher 2018-07-06 970 struct iomap iomap = { };
c25892827c7996 Andreas Gruenbacher 2018-07-06 971
54992257fe4bb9 Andreas Gruenbacher 2021-03-27 972 error = gfs2_iomap_alloc(inode, offset, end - offset, &iomap);
fffb64127adc3e Andreas Gruenbacher 2018-03-29 973 if (error)
64dd153c83743a Benjamin Marzinski 2011-09-12 974 goto out;
fffb64127adc3e Andreas Gruenbacher 2018-03-29 975 offset = iomap.offset + iomap.length;
d505a96a3b16f4 Andreas Gruenbacher 2018-06-24 976 if (!(iomap.flags & IOMAP_F_NEW))
64dd153c83743a Benjamin Marzinski 2011-09-12 977 continue;
fffb64127adc3e Andreas Gruenbacher 2018-03-29 978 error = sb_issue_zeroout(sb, iomap.addr >> inode->i_blkbits,
fffb64127adc3e Andreas Gruenbacher 2018-03-29 979 iomap.length >> inode->i_blkbits,
fffb64127adc3e Andreas Gruenbacher 2018-03-29 980 GFP_NOFS);
fffb64127adc3e Andreas Gruenbacher 2018-03-29 981 if (error) {
fffb64127adc3e Andreas Gruenbacher 2018-03-29 982 fs_err(GFS2_SB(inode), "Failed to zero data buffers\n");
2fe17c1075836b Christoph Hellwig 2011-01-14 983 goto out;
2fe17c1075836b Christoph Hellwig 2011-01-14 984 }
64dd153c83743a Benjamin Marzinski 2011-09-12 985 }
2fe17c1075836b Christoph Hellwig 2011-01-14 986 out:
64dd153c83743a Benjamin Marzinski 2011-09-12 987 brelse(dibh);
2fe17c1075836b Christoph Hellwig 2011-01-14 988 return error;
2fe17c1075836b Christoph Hellwig 2011-01-14 989 }
f3b64b57c044fe Andreas Gruenbacher 2019-08-31 990
d9be0cda774e7f Abhi Das 2015-03-18 991 /**
d9be0cda774e7f Abhi Das 2015-03-18 992 * calc_max_reserv() - Reverse of write_calc_reserv. Given a number of
d9be0cda774e7f Abhi Das 2015-03-18 993 * blocks, determine how many bytes can be written.
d9be0cda774e7f Abhi Das 2015-03-18 994 * @ip: The inode in question.
d9be0cda774e7f Abhi Das 2015-03-18 995 * @len: Max cap of bytes. What we return in *len must be <= this.
d9be0cda774e7f Abhi Das 2015-03-18 996 * @data_blocks: Compute and return the number of data blocks needed
d9be0cda774e7f Abhi Das 2015-03-18 997 * @ind_blocks: Compute and return the number of indirect blocks needed
d9be0cda774e7f Abhi Das 2015-03-18 998 * @max_blocks: The total blocks available to work with.
d9be0cda774e7f Abhi Das 2015-03-18 999 *
d9be0cda774e7f Abhi Das 2015-03-18 1000 * Returns: void, but @len, @data_blocks and @ind_blocks are filled in.
d9be0cda774e7f Abhi Das 2015-03-18 1001 */
d9be0cda774e7f Abhi Das 2015-03-18 @1002 static void calc_max_reserv(struct gfs2_inode *ip, loff_t *len,
d9be0cda774e7f Abhi Das 2015-03-18 1003 unsigned int *data_blocks, unsigned int *ind_blocks,
d9be0cda774e7f Abhi Das 2015-03-18 1004 unsigned int max_blocks)
2fe17c1075836b Christoph Hellwig 2011-01-14 1005 {
d9be0cda774e7f Abhi Das 2015-03-18 1006 loff_t max = *len;
2fe17c1075836b Christoph Hellwig 2011-01-14 1007 const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
2fe17c1075836b Christoph Hellwig 2011-01-14 1008 unsigned int tmp, max_data = max_blocks - 3 * (sdp->sd_max_height - 1);
2fe17c1075836b Christoph Hellwig 2011-01-14 1009
2fe17c1075836b Christoph Hellwig 2011-01-14 1010 for (tmp = max_data; tmp > sdp->sd_diptrs;) {
2fe17c1075836b Christoph Hellwig 2011-01-14 1011 tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
2fe17c1075836b Christoph Hellwig 2011-01-14 1012 max_data -= tmp;
2fe17c1075836b Christoph Hellwig 2011-01-14 1013 }
d9be0cda774e7f Abhi Das 2015-03-18 1014
2fe17c1075836b Christoph Hellwig 2011-01-14 1015 *data_blocks = max_data;
2fe17c1075836b Christoph Hellwig 2011-01-14 1016 *ind_blocks = max_blocks - max_data;
2fe17c1075836b Christoph Hellwig 2011-01-14 1017 *len = ((loff_t)max_data - 3) << sdp->sd_sb.sb_bsize_shift;
2fe17c1075836b Christoph Hellwig 2011-01-14 1018 if (*len > max) {
2fe17c1075836b Christoph Hellwig 2011-01-14 1019 *len = max;
2fe17c1075836b Christoph Hellwig 2011-01-14 1020 gfs2_write_calc_reserv(ip, max, data_blocks, ind_blocks);
2fe17c1075836b Christoph Hellwig 2011-01-14 1021 }
2fe17c1075836b Christoph Hellwig 2011-01-14 1022 }
2fe17c1075836b Christoph Hellwig 2011-01-14 1023
9c9f1159a54c61 Andrew Price 2014-11-12 @1024 static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
2fe17c1075836b Christoph Hellwig 2011-01-14 1025 {
496ad9aa8ef448 Al Viro 2013-01-23 1026 struct inode *inode = file_inode(file);
2fe17c1075836b Christoph Hellwig 2011-01-14 1027 struct gfs2_sbd *sdp = GFS2_SB(inode);
2fe17c1075836b Christoph Hellwig 2011-01-14 1028 struct gfs2_inode *ip = GFS2_I(inode);
7b9cff467144c8 Steven Whitehouse 2013-10-02 1029 struct gfs2_alloc_parms ap = { .aflags = 0, };
2fe17c1075836b Christoph Hellwig 2011-01-14 1030 unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
174d1232ebc84f Andreas Gruenbacher 2018-02-20 1031 loff_t bytes, max_bytes, max_blks;
2fe17c1075836b Christoph Hellwig 2011-01-14 1032 int error;
4442f2e03ed964 Steven Whitehouse 2011-11-21 1033 const loff_t pos = offset;
4442f2e03ed964 Steven Whitehouse 2011-11-21 1034 const loff_t count = len;
6905d9e4dda611 Benjamin Marzinski 2011-04-26 1035 loff_t bsize_mask = ~((loff_t)sdp->sd_sb.sb_bsize - 1);
2fe17c1075836b Christoph Hellwig 2011-01-14 1036 loff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift;
64dd153c83743a Benjamin Marzinski 2011-09-12 1037 loff_t max_chunk_size = UINT_MAX & bsize_mask;
a0846a534c5fbc Bob Peterson 2014-02-06 1038
2fe17c1075836b Christoph Hellwig 2011-01-14 1039 next = (next + 1) << sdp->sd_sb.sb_bsize_shift;
2fe17c1075836b Christoph Hellwig 2011-01-14 1040
6905d9e4dda611 Benjamin Marzinski 2011-04-26 1041 offset &= bsize_mask;
2fe17c1075836b Christoph Hellwig 2011-01-14 1042
2fe17c1075836b Christoph Hellwig 2011-01-14 1043 len = next - offset;
2fe17c1075836b Christoph Hellwig 2011-01-14 1044 bytes = sdp->sd_max_rg_data * sdp->sd_sb.sb_bsize / 2;
2fe17c1075836b Christoph Hellwig 2011-01-14 1045 if (!bytes)
2fe17c1075836b Christoph Hellwig 2011-01-14 1046 bytes = UINT_MAX;
6905d9e4dda611 Benjamin Marzinski 2011-04-26 1047 bytes &= bsize_mask;
6905d9e4dda611 Benjamin Marzinski 2011-04-26 1048 if (bytes == 0)
6905d9e4dda611 Benjamin Marzinski 2011-04-26 1049 bytes = sdp->sd_sb.sb_bsize;
2fe17c1075836b Christoph Hellwig 2011-01-14 1050
da1dfb6af849cb Steven Whitehouse 2012-07-26 1051 gfs2_size_hint(file, offset, len);
8e2e00473598dd Bob Peterson 2012-07-19 1052
d9be0cda774e7f Abhi Das 2015-03-18 1053 gfs2_write_calc_reserv(ip, PAGE_SIZE, &data_blocks, &ind_blocks);
d9be0cda774e7f Abhi Das 2015-03-18 1054 ap.min_target = data_blocks + ind_blocks;
d9be0cda774e7f Abhi Das 2015-03-18 1055
2fe17c1075836b Christoph Hellwig 2011-01-14 1056 while (len > 0) {
2fe17c1075836b Christoph Hellwig 2011-01-14 1057 if (len < bytes)
2fe17c1075836b Christoph Hellwig 2011-01-14 1058 bytes = len;
58a7d5fb8e3127 Benjamin Marzinski 2012-03-08 1059 if (!gfs2_write_alloc_required(ip, offset, bytes)) {
58a7d5fb8e3127 Benjamin Marzinski 2012-03-08 1060 len -= bytes;
58a7d5fb8e3127 Benjamin Marzinski 2012-03-08 1061 offset += bytes;
58a7d5fb8e3127 Benjamin Marzinski 2012-03-08 1062 continue;
58a7d5fb8e3127 Benjamin Marzinski 2012-03-08 1063 }
d9be0cda774e7f Abhi Das 2015-03-18 1064
d9be0cda774e7f Abhi Das 2015-03-18 1065 /* We need to determine how many bytes we can actually
d9be0cda774e7f Abhi Das 2015-03-18 1066 * fallocate without exceeding quota or going over the
d9be0cda774e7f Abhi Das 2015-03-18 1067 * end of the fs. We start off optimistically by assuming
d9be0cda774e7f Abhi Das 2015-03-18 1068 * we can write max_bytes */
d9be0cda774e7f Abhi Das 2015-03-18 1069 max_bytes = (len > max_chunk_size) ? max_chunk_size : len;
d9be0cda774e7f Abhi Das 2015-03-18 1070
d9be0cda774e7f Abhi Das 2015-03-18 1071 /* Since max_bytes is most likely a theoretical max, we
d9be0cda774e7f Abhi Das 2015-03-18 1072 * calculate a more realistic 'bytes' to serve as a good
d9be0cda774e7f Abhi Das 2015-03-18 1073 * starting point for the number of bytes we may be able
d9be0cda774e7f Abhi Das 2015-03-18 1074 * to write */
2fe17c1075836b Christoph Hellwig 2011-01-14 1075 gfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks);
7b9cff467144c8 Steven Whitehouse 2013-10-02 1076 ap.target = data_blocks + ind_blocks;
b8fbf471edb3db Abhi Das 2015-03-18 1077
b8fbf471edb3db Abhi Das 2015-03-18 1078 error = gfs2_quota_lock_check(ip, &ap);
2fe17c1075836b Christoph Hellwig 2011-01-14 1079 if (error)
9c9f1159a54c61 Andrew Price 2014-11-12 1080 return error;
d9be0cda774e7f Abhi Das 2015-03-18 1081 /* ap.allowed tells us how many blocks quota will allow
d9be0cda774e7f Abhi Das 2015-03-18 1082 * us to write. Check if this reduces max_blks */
174d1232ebc84f Andreas Gruenbacher 2018-02-20 1083 max_blks = UINT_MAX;
174d1232ebc84f Andreas Gruenbacher 2018-02-20 1084 if (ap.allowed)
d9be0cda774e7f Abhi Das 2015-03-18 1085 max_blks = ap.allowed;
2fe17c1075836b Christoph Hellwig 2011-01-14 1086
7b9cff467144c8 Steven Whitehouse 2013-10-02 1087 error = gfs2_inplace_reserve(ip, &ap);
d9be0cda774e7f Abhi Das 2015-03-18 1088 if (error)
2fe17c1075836b Christoph Hellwig 2011-01-14 1089 goto out_qunlock;
d9be0cda774e7f Abhi Das 2015-03-18 1090
d9be0cda774e7f Abhi Das 2015-03-18 1091 /* check if the selected rgrp limits our max_blks further */
725d0e9d464d56 Andreas Gruenbacher 2018-10-02 1092 if (ip->i_res.rs_reserved < max_blks)
725d0e9d464d56 Andreas Gruenbacher 2018-10-02 1093 max_blks = ip->i_res.rs_reserved;
d9be0cda774e7f Abhi Das 2015-03-18 1094
d9be0cda774e7f Abhi Das 2015-03-18 1095 /* Almost done. Calculate bytes that can be written using
d9be0cda774e7f Abhi Das 2015-03-18 1096 * max_blks. We also recompute max_bytes, data_blocks and
d9be0cda774e7f Abhi Das 2015-03-18 1097 * ind_blocks */
d9be0cda774e7f Abhi Das 2015-03-18 1098 calc_max_reserv(ip, &max_bytes, &data_blocks,
d9be0cda774e7f Abhi Das 2015-03-18 1099 &ind_blocks, max_blks);
2fe17c1075836b Christoph Hellwig 2011-01-14 1100
2fe17c1075836b Christoph Hellwig 2011-01-14 1101 rblocks = RES_DINODE + ind_blocks + RES_STATFS + RES_QUOTA +
71f890f7f758f3 Steven Whitehouse 2012-07-30 1102 RES_RG_HDR + gfs2_rg_blocks(ip, data_blocks + ind_blocks);
2fe17c1075836b Christoph Hellwig 2011-01-14 1103 if (gfs2_is_jdata(ip))
2fe17c1075836b Christoph Hellwig 2011-01-14 1104 rblocks += data_blocks ? data_blocks : 1;
2fe17c1075836b Christoph Hellwig 2011-01-14 1105
2fe17c1075836b Christoph Hellwig 2011-01-14 1106 error = gfs2_trans_begin(sdp, rblocks,
45eb05042d5667 Andreas Gruenbacher 2019-09-02 1107 PAGE_SIZE >> inode->i_blkbits);
2fe17c1075836b Christoph Hellwig 2011-01-14 1108 if (error)
2fe17c1075836b Christoph Hellwig 2011-01-14 1109 goto out_trans_fail;
2fe17c1075836b Christoph Hellwig 2011-01-14 1110
2fe17c1075836b Christoph Hellwig 2011-01-14 1111 error = fallocate_chunk(inode, offset, max_bytes, mode);
2fe17c1075836b Christoph Hellwig 2011-01-14 1112 gfs2_trans_end(sdp);
2fe17c1075836b Christoph Hellwig 2011-01-14 1113
2fe17c1075836b Christoph Hellwig 2011-01-14 1114 if (error)
2fe17c1075836b Christoph Hellwig 2011-01-14 1115 goto out_trans_fail;
2fe17c1075836b Christoph Hellwig 2011-01-14 1116
2fe17c1075836b Christoph Hellwig 2011-01-14 1117 len -= max_bytes;
2fe17c1075836b Christoph Hellwig 2011-01-14 1118 offset += max_bytes;
2fe17c1075836b Christoph Hellwig 2011-01-14 1119 gfs2_inplace_release(ip);
2fe17c1075836b Christoph Hellwig 2011-01-14 1120 gfs2_quota_unlock(ip);
2fe17c1075836b Christoph Hellwig 2011-01-14 1121 }
4442f2e03ed964 Steven Whitehouse 2011-11-21 1122
0a6a4abc84668d Andreas Gruenbacher 2019-08-08 1123 if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size)
1885867b84d58e Andrew Price 2014-11-12 1124 i_size_write(inode, pos + count);
98f1a696a1b2f6 Andrew Price 2014-11-12 1125 file_update_time(file);
4b813f09405823 Andrew Price 2015-09-22 1126 mark_inode_dirty(inode);
1885867b84d58e Andrew Price 2014-11-12 1127
dde0c2e7984829 Christoph Hellwig 2016-04-07 1128 if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host))
dde0c2e7984829 Christoph Hellwig 2016-04-07 1129 return vfs_fsync_range(file, pos, pos + count - 1,
dde0c2e7984829 Christoph Hellwig 2016-04-07 1130 (file->f_flags & __O_SYNC) ? 0 : 1);
dde0c2e7984829 Christoph Hellwig 2016-04-07 1131 return 0;
2fe17c1075836b Christoph Hellwig 2011-01-14 1132
2fe17c1075836b Christoph Hellwig 2011-01-14 1133 out_trans_fail:
2fe17c1075836b Christoph Hellwig 2011-01-14 1134 gfs2_inplace_release(ip);
2fe17c1075836b Christoph Hellwig 2011-01-14 1135 out_qunlock:
2fe17c1075836b Christoph Hellwig 2011-01-14 1136 gfs2_quota_unlock(ip);
9c9f1159a54c61 Andrew Price 2014-11-12 1137 return error;
9c9f1159a54c61 Andrew Price 2014-11-12 1138 }
9c9f1159a54c61 Andrew Price 2014-11-12 1139
9c9f1159a54c61 Andrew Price 2014-11-12 @1140 static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
9c9f1159a54c61 Andrew Price 2014-11-12 1141 {
9c9f1159a54c61 Andrew Price 2014-11-12 1142 struct inode *inode = file_inode(file);
d4d7fc12b642a1 Andrew Price 2017-04-05 1143 struct gfs2_sbd *sdp = GFS2_SB(inode);
9c9f1159a54c61 Andrew Price 2014-11-12 1144 struct gfs2_inode *ip = GFS2_I(inode);
9c9f1159a54c61 Andrew Price 2014-11-12 1145 struct gfs2_holder gh;
9c9f1159a54c61 Andrew Price 2014-11-12 1146 int ret;
9c9f1159a54c61 Andrew Price 2014-11-12 1147
4e56a6411fbce6 Andreas Gruenbacher 2017-12-14 1148 if (mode & ~(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE))
d4d7fc12b642a1 Andrew Price 2017-04-05 1149 return -EOPNOTSUPP;
d4d7fc12b642a1 Andrew Price 2017-04-05 1150 /* fallocate is needed by gfs2_grow to reserve space in the rindex */
d4d7fc12b642a1 Andrew Price 2017-04-05 1151 if (gfs2_is_jdata(ip) && inode != sdp->sd_rindex)
9c9f1159a54c61 Andrew Price 2014-11-12 1152 return -EOPNOTSUPP;
9c9f1159a54c61 Andrew Price 2014-11-12 1153
5955102c9984fa Al Viro 2016-01-22 1154 inode_lock(inode);
9c9f1159a54c61 Andrew Price 2014-11-12 1155
9c9f1159a54c61 Andrew Price 2014-11-12 1156 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
9c9f1159a54c61 Andrew Price 2014-11-12 1157 ret = gfs2_glock_nq(&gh);
9c9f1159a54c61 Andrew Price 2014-11-12 1158 if (ret)
9c9f1159a54c61 Andrew Price 2014-11-12 1159 goto out_uninit;
9c9f1159a54c61 Andrew Price 2014-11-12 1160
9c9f1159a54c61 Andrew Price 2014-11-12 1161 if (!(mode & FALLOC_FL_KEEP_SIZE) &&
9c9f1159a54c61 Andrew Price 2014-11-12 1162 (offset + len) > inode->i_size) {
9c9f1159a54c61 Andrew Price 2014-11-12 1163 ret = inode_newsize_ok(inode, offset + len);
9c9f1159a54c61 Andrew Price 2014-11-12 1164 if (ret)
9c9f1159a54c61 Andrew Price 2014-11-12 1165 goto out_unlock;
9c9f1159a54c61 Andrew Price 2014-11-12 1166 }
9c9f1159a54c61 Andrew Price 2014-11-12 1167
9c9f1159a54c61 Andrew Price 2014-11-12 1168 ret = get_write_access(inode);
9c9f1159a54c61 Andrew Price 2014-11-12 1169 if (ret)
9c9f1159a54c61 Andrew Price 2014-11-12 1170 goto out_unlock;
9c9f1159a54c61 Andrew Price 2014-11-12 1171
4e56a6411fbce6 Andreas Gruenbacher 2017-12-14 1172 if (mode & FALLOC_FL_PUNCH_HOLE) {
4e56a6411fbce6 Andreas Gruenbacher 2017-12-14 1173 ret = __gfs2_punch_hole(file, offset, len);
4e56a6411fbce6 Andreas Gruenbacher 2017-12-14 1174 } else {
9c9f1159a54c61 Andrew Price 2014-11-12 1175 ret = __gfs2_fallocate(file, mode, offset, len);
9c9f1159a54c61 Andrew Price 2014-11-12 1176 if (ret)
a097dc7e24cba7 Bob Peterson 2015-07-16 1177 gfs2_rs_deltree(&ip->i_res);
4e56a6411fbce6 Andreas Gruenbacher 2017-12-14 1178 }
a097dc7e24cba7 Bob Peterson 2015-07-16 1179
9c9f1159a54c61 Andrew Price 2014-11-12 1180 put_write_access(inode);
2fe17c1075836b Christoph Hellwig 2011-01-14 1181 out_unlock:
a0846a534c5fbc Bob Peterson 2014-02-06 1182 gfs2_glock_dq(&gh);
2fe17c1075836b Christoph Hellwig 2011-01-14 1183 out_uninit:
a0846a534c5fbc Bob Peterson 2014-02-06 1184 gfs2_holder_uninit(&gh);
5955102c9984fa Al Viro 2016-01-22 1185 inode_unlock(inode);
9c9f1159a54c61 Andrew Price 2014-11-12 1186 return ret;
2fe17c1075836b Christoph Hellwig 2011-01-14 1187 }
2fe17c1075836b Christoph Hellwig 2011-01-14 1188
:::::: The code at line 948 was first introduced by commit
:::::: 2fe17c1075836b66678ed2a305fd09b6773883aa fallocate should be a file operation
:::::: TO: Christoph Hellwig <hch(a)lst.de>
:::::: CC: Al Viro <viro(a)zeniv.linux.org.uk>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months