diff mbox series

fs: inode: use queue_rcu_work() instead of call_rcu()

Message ID 20211015080216.4871-1-qiang.zhang1211@gmail.com (mailing list archive)
State New, archived
Headers show
Series fs: inode: use queue_rcu_work() instead of call_rcu() | expand

Commit Message

Zqiang Oct. 15, 2021, 8:02 a.m. UTC
Call Trace:
 <IRQ>
 __init_work+0x2d/0x50 kernel/workqueue.c:519
 synchronize_rcu_expedited+0x3af/0x650 kernel/rcu/tree_exp.h:847
 bdi_remove_from_list mm/backing-dev.c:938 [inline]
 bdi_unregister+0x17f/0x5c0 mm/backing-dev.c:946
 release_bdi+0xa1/0xc0 mm/backing-dev.c:968
 kref_put include/linux/kref.h:65 [inline]
 bdi_put+0x72/0xa0 mm/backing-dev.c:976
 bdev_free_inode+0x11e/0x220 block/bdev.c:408
 i_callback+0x3f/0x70 fs/inode.c:226
 rcu_do_batch kernel/rcu/tree.c:2508 [inline]
 rcu_core+0x76d/0x16c0 kernel/rcu/tree.c:2743
 __do_softirq+0x1d7/0x93b kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu kernel/softirq.c:636 [inline]
 irq_exit_rcu+0xf2/0x130 kernel/softirq.c:648
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097

The bdi_put() be called in RCU softirq, however the
synchronize_rcu_expedited() and flush_delayed_work() that be called
when wb shutdown, will trigger sleep action, use queue_rcu_work()
instead of call_rcu(), the release operation be executed in task context.

Reported-by: Hao Sun <sunhao.th@gmail.com>
Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
---
 fs/inode.c         | 9 +++++----
 include/linux/fs.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Christoph Hellwig Oct. 15, 2021, 8:04 a.m. UTC | #1
NAK.

1. We need to sort ounderlying issue first as I already said _twice_.
2. this has a major penality on all file systems
Zqiang Oct. 15, 2021, 8:28 a.m. UTC | #2
On 2021/10/15 下午4:04, Christoph Hellwig wrote:
> NAK.
>
> 1. We need to sort ounderlying issue first as I already said _twice_.
> 2. this has a major penality on all file systems

This problem report by sunhao,  the log

https://drive.google.com/file/d/1M5oyA_IcWSDB2XpnoX8SDmKJA3JhKltz/view?usp=sharing

but I can not find useful information, not sure if it is related to the loop device driver.
are you mean There is a problem about inode lifetime ?

Thanks
Zqiang
Christoph Hellwig Oct. 15, 2021, 1:24 p.m. UTC | #3
On Fri, Oct 15, 2021 at 04:28:10PM +0800, Zqiang wrote:
> 
> On 2021/10/15 下午4:04, Christoph Hellwig wrote:
> > NAK.
> > 
> > 1. We need to sort ounderlying issue first as I already said _twice_.
> > 2. this has a major penality on all file systems
> 
> This problem report by sunhao,  the log
> 
> https://drive.google.com/file/d/1M5oyA_IcWSDB2XpnoX8SDmKJA3JhKltz/view?usp=sharing

When I wget that it just returns garbage unfortunately.

> 
> but I can not find useful information, not sure if it is related to the loop device driver.
> are you mean There is a problem about inode lifetime ?

Yes.  This implies that the del_gendisk hasn't been called before the
block device lifetimes hits 0.
kernel test robot Oct. 15, 2021, 1:50 p.m. UTC | #4
Hi Zqiang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.15-rc5 next-20211015]
[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/Zqiang/fs-inode-use-queue_rcu_work-instead-of-call_rcu/20211015-160455
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ec681c53f8d2d0ee362ff67f5b98dd8263c15002
config: hexagon-randconfig-r041-20211014 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project acb3b187c4c88650a6a717a1bcb234d27d0d7f54)
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/2294caaec521b45bdc9db96423fe51762e47afd0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zqiang/fs-inode-use-queue_rcu_work-instead-of-call_rcu/20211015-160455
        git checkout 2294caaec521b45bdc9db96423fe51762e47afd0
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash fs/ntfs3/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> fs/ntfs3/super.c:458:57: error: no member named 'i_rcu' in 'struct inode'
           struct inode *inode = container_of(head, struct inode, i_rcu);
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
   include/linux/kernel.h:495:53: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
   include/linux/compiler_types.h:264:74: note: expanded from macro '__same_type'
   #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
                                                                            ^
   include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                         ^~~~~~~~~
>> fs/ntfs3/super.c:458:24: error: no member named 'i_rcu' in 'inode'
           struct inode *inode = container_of(head, struct inode, i_rcu);
                                 ^                                ~~~~~
   include/linux/kernel.h:498:21: note: expanded from macro 'container_of'
           ((type *)(__mptr - offsetof(type, member))); })
                              ^              ~~~~~~
   include/linux/stddef.h:17:32: note: expanded from macro 'offsetof'
   #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
                                   ^                         ~~~~~~
   include/linux/compiler_types.h:140:35: note: expanded from macro '__compiler_offsetof'
   #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
                                           ^                     ~
>> fs/ntfs3/super.c:458:16: error: initializing 'struct inode *' with an expression of incompatible type 'void'
           struct inode *inode = container_of(head, struct inode, i_rcu);
                         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs3/super.c:468:19: error: no member named 'i_rcu' in 'struct inode'
           call_rcu(&inode->i_rcu, ntfs_i_callback);
                     ~~~~~  ^
   4 errors generated.


vim +458 fs/ntfs3/super.c

82cae269cfa953 Konstantin Komarov 2021-08-13  455  
82cae269cfa953 Konstantin Komarov 2021-08-13  456  static void ntfs_i_callback(struct rcu_head *head)
82cae269cfa953 Konstantin Komarov 2021-08-13  457  {
82cae269cfa953 Konstantin Komarov 2021-08-13 @458  	struct inode *inode = container_of(head, struct inode, i_rcu);
82cae269cfa953 Konstantin Komarov 2021-08-13  459  	struct ntfs_inode *ni = ntfs_i(inode);
82cae269cfa953 Konstantin Komarov 2021-08-13  460  
82cae269cfa953 Konstantin Komarov 2021-08-13  461  	mutex_destroy(&ni->ni_lock);
82cae269cfa953 Konstantin Komarov 2021-08-13  462  
82cae269cfa953 Konstantin Komarov 2021-08-13  463  	kmem_cache_free(ntfs_inode_cachep, ni);
82cae269cfa953 Konstantin Komarov 2021-08-13  464  }
82cae269cfa953 Konstantin Komarov 2021-08-13  465  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Oct. 15, 2021, 1:54 p.m. UTC | #5
Hi Zqiang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.15-rc5 next-20211015]
[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/Zqiang/fs-inode-use-queue_rcu_work-instead-of-call_rcu/20211015-160455
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ec681c53f8d2d0ee362ff67f5b98dd8263c15002
config: arc-randconfig-r043-20211014 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.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/2294caaec521b45bdc9db96423fe51762e47afd0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zqiang/fs-inode-use-queue_rcu_work-instead-of-call_rcu/20211015-160455
        git checkout 2294caaec521b45bdc9db96423fe51762e47afd0
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash fs/ntfs3/ fs/xfs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from <command-line>:
   fs/ntfs3/super.c: In function 'ntfs_i_callback':
>> include/linux/kernel.h:495:58: error: 'struct inode' has no member named 'i_rcu'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |                                                          ^~
   include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
     302 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
     322 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:495:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |         ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:495:27: note: in expansion of macro '__same_type'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |                           ^~~~~~~~~~~
   fs/ntfs3/super.c:458:31: note: in expansion of macro 'container_of'
     458 |         struct inode *inode = container_of(head, struct inode, i_rcu);
         |                               ^~~~~~~~~~~~
>> include/linux/compiler_types.h:140:41: error: 'struct inode' has no member named 'i_rcu'
     140 | #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
         |                                         ^~~~~~~~~~~~~~~~~~
   include/linux/stddef.h:17:33: note: in expansion of macro '__compiler_offsetof'
      17 | #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
         |                                 ^~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:498:28: note: in expansion of macro 'offsetof'
     498 |         ((type *)(__mptr - offsetof(type, member))); })
         |                            ^~~~~~~~
   fs/ntfs3/super.c:458:31: note: in expansion of macro 'container_of'
     458 |         struct inode *inode = container_of(head, struct inode, i_rcu);
         |                               ^~~~~~~~~~~~
   fs/ntfs3/super.c: In function 'ntfs_destroy_inode':
>> fs/ntfs3/super.c:468:24: error: 'struct inode' has no member named 'i_rcu'
     468 |         call_rcu(&inode->i_rcu, ntfs_i_callback);
         |                        ^~
--
   In file included from <command-line>:
   fs/xfs/xfs_icache.c: In function 'xfs_inode_free_callback':
>> include/linux/kernel.h:495:58: error: 'struct inode' has no member named 'i_rcu'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |                                                          ^~
   include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
     302 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
     322 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:495:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |         ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:495:27: note: in expansion of macro '__same_type'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |                           ^~~~~~~~~~~
   fs/xfs/xfs_icache.c:120:42: note: in expansion of macro 'container_of'
     120 |         struct inode            *inode = container_of(head, struct inode, i_rcu);
         |                                          ^~~~~~~~~~~~
>> include/linux/compiler_types.h:140:41: error: 'struct inode' has no member named 'i_rcu'
     140 | #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
         |                                         ^~~~~~~~~~~~~~~~~~
   include/linux/stddef.h:17:33: note: in expansion of macro '__compiler_offsetof'
      17 | #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
         |                                 ^~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:498:28: note: in expansion of macro 'offsetof'
     498 |         ((type *)(__mptr - offsetof(type, member))); })
         |                            ^~~~~~~~
   fs/xfs/xfs_icache.c:120:42: note: in expansion of macro 'container_of'
     120 |         struct inode            *inode = container_of(head, struct inode, i_rcu);
         |                                          ^~~~~~~~~~~~
   fs/xfs/xfs_icache.c: In function '__xfs_inode_free':
>> fs/xfs/xfs_icache.c:158:28: error: 'struct inode' has no member named 'i_rcu'
     158 |         call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback);
         |                            ^~


vim +495 include/linux/kernel.h

cf14f27f82af78 Alexei Starovoitov 2018-03-28  485  
^1da177e4c3f41 Linus Torvalds     2005-04-16  486  /**
^1da177e4c3f41 Linus Torvalds     2005-04-16  487   * container_of - cast a member of a structure out to the containing structure
^1da177e4c3f41 Linus Torvalds     2005-04-16  488   * @ptr:	the pointer to the member.
^1da177e4c3f41 Linus Torvalds     2005-04-16  489   * @type:	the type of the container struct this is embedded in.
^1da177e4c3f41 Linus Torvalds     2005-04-16  490   * @member:	the name of the member within the struct.
^1da177e4c3f41 Linus Torvalds     2005-04-16  491   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  492   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  493  #define container_of(ptr, type, member) ({				\
c7acec713d14c6 Ian Abbott         2017-07-12  494  	void *__mptr = (void *)(ptr);					\
c7acec713d14c6 Ian Abbott         2017-07-12 @495  	BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&	\
c7acec713d14c6 Ian Abbott         2017-07-12  496  			 !__same_type(*(ptr), void),			\
c7acec713d14c6 Ian Abbott         2017-07-12  497  			 "pointer type mismatch in container_of()");	\
c7acec713d14c6 Ian Abbott         2017-07-12  498  	((type *)(__mptr - offsetof(type, member))); })
^1da177e4c3f41 Linus Torvalds     2005-04-16  499  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Zqiang Oct. 18, 2021, 2:02 a.m. UTC | #6
On 2021/10/15 下午9:54, kernel test robot wrote:
> Hi Zqiang,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v5.15-rc5 next-20211015]
> [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/Zqiang/fs-inode-use-queue_rcu_work-instead-of-call_rcu/20211015-160455
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ec681c53f8d2d0ee362ff67f5b98dd8263c15002
> config: arc-randconfig-r043-20211014 (attached as .config)
> compiler: arceb-elf-gcc (GCC) 11.2.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/2294caaec521b45bdc9db96423fe51762e47afd0
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Zqiang/fs-inode-use-queue_rcu_work-instead-of-call_rcu/20211015-160455
>          git checkout 2294caaec521b45bdc9db96423fe51762e47afd0
>          # save the attached .config to linux build tree
>          mkdir build_dir
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash fs/ntfs3/ fs/xfs/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>     In file included from <command-line>:
>     fs/ntfs3/super.c: In function 'ntfs_i_callback':
>>> include/linux/kernel.h:495:58: error: 'struct inode' has no member named 'i_rcu'
>       495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
>           |                                                          ^~
>     include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
>       302 |                 if (!(condition))                                       \
>           |                       ^~~~~~~~~
>     include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
>       322 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
>        39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>           |                                     ^~~~~~~~~~~~~~~~~~
>     include/linux/kernel.h:495:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
>       495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
>           |         ^~~~~~~~~~~~~~~~
>     include/linux/kernel.h:495:27: note: in expansion of macro '__same_type'
>       495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
>           |                           ^~~~~~~~~~~
>     fs/ntfs3/super.c:458:31: note: in expansion of macro 'container_of'
>       458 |         struct inode *inode = container_of(head, struct inode, i_rcu);
>           |                               ^~~~~~~~~~~~
>>> include/linux/compiler_types.h:140:41: error: 'struct inode' has no member named 'i_rcu'
>       140 | #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
>           |                                         ^~~~~~~~~~~~~~~~~~
>     include/linux/stddef.h:17:33: note: in expansion of macro '__compiler_offsetof'
>        17 | #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
>           |                                 ^~~~~~~~~~~~~~~~~~~
>     include/linux/kernel.h:498:28: note: in expansion of macro 'offsetof'
>       498 |         ((type *)(__mptr - offsetof(type, member))); })
>           |                            ^~~~~~~~
>     fs/ntfs3/super.c:458:31: note: in expansion of macro 'container_of'
>       458 |         struct inode *inode = container_of(head, struct inode, i_rcu);
>           |                               ^~~~~~~~~~~~
>     fs/ntfs3/super.c: In function 'ntfs_destroy_inode':
>>> fs/ntfs3/super.c:468:24: error: 'struct inode' has no member named 'i_rcu'
>       468 |         call_rcu(&inode->i_rcu, ntfs_i_callback);
>           |                        ^~
> --
>     In file included from <command-line>:
>     fs/xfs/xfs_icache.c: In function 'xfs_inode_free_callback':
>>> include/linux/kernel.h:495:58: error: 'struct inode' has no member named 'i_rcu'
>       495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
>           |                                                          ^~
>     include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
>       302 |                 if (!(condition))                                       \
>           |                       ^~~~~~~~~
>     include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
>       322 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
>        39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>           |                                     ^~~~~~~~~~~~~~~~~~
>     include/linux/kernel.h:495:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
>       495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
>           |         ^~~~~~~~~~~~~~~~
>     include/linux/kernel.h:495:27: note: in expansion of macro '__same_type'
>       495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
>           |                           ^~~~~~~~~~~
>     fs/xfs/xfs_icache.c:120:42: note: in expansion of macro 'container_of'
>       120 |         struct inode            *inode = container_of(head, struct inode, i_rcu);
>           |                                          ^~~~~~~~~~~~
>>> include/linux/compiler_types.h:140:41: error: 'struct inode' has no member named 'i_rcu'
>       140 | #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
>           |                                         ^~~~~~~~~~~~~~~~~~
>     include/linux/stddef.h:17:33: note: in expansion of macro '__compiler_offsetof'
>        17 | #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
>           |                                 ^~~~~~~~~~~~~~~~~~~
>     include/linux/kernel.h:498:28: note: in expansion of macro 'offsetof'
>       498 |         ((type *)(__mptr - offsetof(type, member))); })
>           |                            ^~~~~~~~
>     fs/xfs/xfs_icache.c:120:42: note: in expansion of macro 'container_of'
>       120 |         struct inode            *inode = container_of(head, struct inode, i_rcu);
>           |                                          ^~~~~~~~~~~~
>     fs/xfs/xfs_icache.c: In function '__xfs_inode_free':
>>> fs/xfs/xfs_icache.c:158:28: error: 'struct inode' has no member named 'i_rcu'
>       158 |         call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback);
>           |                            ^~
>
>
> vim +495 include/linux/kernel.h
>
> cf14f27f82af78 Alexei Starovoitov 2018-03-28  485
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  486  /**
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  487   * container_of - cast a member of a structure out to the containing structure
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  488   * @ptr:	the pointer to the member.
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  489   * @type:	the type of the container struct this is embedded in.
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  490   * @member:	the name of the member within the struct.
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  491   *
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  492   */
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  493  #define container_of(ptr, type, member) ({				\
> c7acec713d14c6 Ian Abbott         2017-07-12  494  	void *__mptr = (void *)(ptr);					\
> c7acec713d14c6 Ian Abbott         2017-07-12 @495  	BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&	\
> c7acec713d14c6 Ian Abbott         2017-07-12  496  			 !__same_type(*(ptr), void),			\
> c7acec713d14c6 Ian Abbott         2017-07-12  497  			 "pointer type mismatch in container_of()");	\
> c7acec713d14c6 Ian Abbott         2017-07-12  498  	((type *)(__mptr - offsetof(type, member))); })
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  499
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


Sorry this is my mistake, Please ignore this change.

Zqiang
diff mbox series

Patch

diff --git a/fs/inode.c b/fs/inode.c
index a49695f57e1e..300beb19aed6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -219,9 +219,9 @@  void free_inode_nonrcu(struct inode *inode)
 }
 EXPORT_SYMBOL(free_inode_nonrcu);
 
-static void i_callback(struct rcu_head *head)
+static void i_callback(struct work_struct *work)
 {
-	struct inode *inode = container_of(head, struct inode, i_rcu);
+	struct inode *inode = container_of(to_rcu_work(work), struct inode, rwork);
 	if (inode->free_inode)
 		inode->free_inode(inode);
 	else
@@ -248,7 +248,7 @@  static struct inode *alloc_inode(struct super_block *sb)
 				return NULL;
 		}
 		inode->free_inode = ops->free_inode;
-		i_callback(&inode->i_rcu);
+		i_callback(&inode->rwork.work);
 		return NULL;
 	}
 
@@ -289,7 +289,8 @@  static void destroy_inode(struct inode *inode)
 			return;
 	}
 	inode->free_inode = ops->free_inode;
-	call_rcu(&inode->i_rcu, i_callback);
+	INIT_RCU_WORK(&inode->rwork, i_callback);
+	queue_rcu_work(system_wq, &inode->rwork);
 }
 
 /**
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8903a95611a2..006d769791a8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -686,7 +686,7 @@  struct inode {
 	struct list_head	i_wb_list;	/* backing dev writeback list */
 	union {
 		struct hlist_head	i_dentry;
-		struct rcu_head		i_rcu;
+		struct rcu_work         rwork;
 	};
 	atomic64_t		i_version;
 	atomic64_t		i_sequence; /* see futex */