All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Cc: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/2] btrfs: convert block group refcount to refcount_t
Date: Thu, 2 Jul 2020 13:22:07 +0800	[thread overview]
Message-ID: <202007021321.ffWfAzPH%lkp@intel.com> (raw)
In-Reply-To: <20200701202219.11984-1-josef@toxicpanda.com>

[-- Attachment #1: Type: text/plain, Size: 7865 bytes --]

Hi Josef,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on v5.8-rc3 next-20200701]
[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/Josef-Bacik/btrfs-convert-block-group-refcount-to-refcount_t/20200702-042305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: i386-randconfig-a003-20200701 (attached as .config)
compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   In file included from fs/btrfs/free-space-cache.c:14:0:
   fs/btrfs/ctree.h:2216:16: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    size_t __const btrfs_get_num_csums(void);
                   ^
   fs/btrfs/free-space-cache.c: In function 'btrfs_return_cluster_to_free_space':
>> fs/btrfs/free-space-cache.c:2930:13: warning: passing argument 1 of 'atomic_inc' from incompatible pointer type
     atomic_inc(&block_group->count);
                ^
   In file included from arch/x86/include/asm/atomic.h:265:0,
                    from include/linux/atomic.h:7,
                    from include/linux/jump_label.h:249,
                    from include/linux/static_key.h:1,
                    from arch/x86/include/asm/nospec-branch.h:6,
                    from arch/x86/include/asm/paravirt_types.h:46,
                    from arch/x86/include/asm/ptrace.h:94,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/pagemap.h:8,
                    from fs/btrfs/free-space-cache.c:6:
   include/asm-generic/atomic-instrumented.h:237:1: note: expected 'struct atomic_t *' but argument is of type 'struct refcount_t *'
    atomic_inc(atomic_t *v)
    ^
   fs/btrfs/free-space-cache.c: In function 'btrfs_find_space_cluster':
   fs/btrfs/free-space-cache.c:3361:14: warning: passing argument 1 of 'atomic_inc' from incompatible pointer type
      atomic_inc(&block_group->count);
                 ^
   In file included from arch/x86/include/asm/atomic.h:265:0,
                    from include/linux/atomic.h:7,
                    from include/linux/jump_label.h:249,
                    from include/linux/static_key.h:1,
                    from arch/x86/include/asm/nospec-branch.h:6,
                    from arch/x86/include/asm/paravirt_types.h:46,
                    from arch/x86/include/asm/ptrace.h:94,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/pagemap.h:8,
                    from fs/btrfs/free-space-cache.c:6:
   include/asm-generic/atomic-instrumented.h:237:1: note: expected 'struct atomic_t *' but argument is of type 'struct refcount_t *'
    atomic_inc(atomic_t *v)
    ^

vim +/atomic_inc +2930 fs/btrfs/free-space-cache.c

fa9c0d795f7b57 Chris Mason  2009-04-03  2901  
fa9c0d795f7b57 Chris Mason  2009-04-03  2902  /*
fa9c0d795f7b57 Chris Mason  2009-04-03  2903   * given a cluster, put all of its extents back into the free space
fa9c0d795f7b57 Chris Mason  2009-04-03  2904   * cache.  If a block group is passed, this function will only free
fa9c0d795f7b57 Chris Mason  2009-04-03  2905   * a cluster that belongs to the passed block group.
fa9c0d795f7b57 Chris Mason  2009-04-03  2906   *
fa9c0d795f7b57 Chris Mason  2009-04-03  2907   * Otherwise, it'll get a reference on the block group pointed to by the
fa9c0d795f7b57 Chris Mason  2009-04-03  2908   * cluster and remove the cluster from it.
fa9c0d795f7b57 Chris Mason  2009-04-03  2909   */
fa9c0d795f7b57 Chris Mason  2009-04-03  2910  int btrfs_return_cluster_to_free_space(
32da5386d9a4fd David Sterba 2019-10-29  2911  			       struct btrfs_block_group *block_group,
fa9c0d795f7b57 Chris Mason  2009-04-03  2912  			       struct btrfs_free_cluster *cluster)
fa9c0d795f7b57 Chris Mason  2009-04-03  2913  {
34d52cb6c50b5a Li Zefan     2011-03-29  2914  	struct btrfs_free_space_ctl *ctl;
fa9c0d795f7b57 Chris Mason  2009-04-03  2915  	int ret;
fa9c0d795f7b57 Chris Mason  2009-04-03  2916  
fa9c0d795f7b57 Chris Mason  2009-04-03  2917  	/* first, get a safe pointer to the block group */
fa9c0d795f7b57 Chris Mason  2009-04-03  2918  	spin_lock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2919  	if (!block_group) {
fa9c0d795f7b57 Chris Mason  2009-04-03  2920  		block_group = cluster->block_group;
fa9c0d795f7b57 Chris Mason  2009-04-03  2921  		if (!block_group) {
fa9c0d795f7b57 Chris Mason  2009-04-03  2922  			spin_unlock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2923  			return 0;
fa9c0d795f7b57 Chris Mason  2009-04-03  2924  		}
fa9c0d795f7b57 Chris Mason  2009-04-03  2925  	} else if (cluster->block_group != block_group) {
fa9c0d795f7b57 Chris Mason  2009-04-03  2926  		/* someone else has already freed it don't redo their work */
fa9c0d795f7b57 Chris Mason  2009-04-03  2927  		spin_unlock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2928  		return 0;
fa9c0d795f7b57 Chris Mason  2009-04-03  2929  	}
fa9c0d795f7b57 Chris Mason  2009-04-03 @2930  	atomic_inc(&block_group->count);
fa9c0d795f7b57 Chris Mason  2009-04-03  2931  	spin_unlock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2932  
34d52cb6c50b5a Li Zefan     2011-03-29  2933  	ctl = block_group->free_space_ctl;
34d52cb6c50b5a Li Zefan     2011-03-29  2934  
fa9c0d795f7b57 Chris Mason  2009-04-03  2935  	/* now return any extents the cluster had on it */
34d52cb6c50b5a Li Zefan     2011-03-29  2936  	spin_lock(&ctl->tree_lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2937  	ret = __btrfs_return_cluster_to_free_space(block_group, cluster);
34d52cb6c50b5a Li Zefan     2011-03-29  2938  	spin_unlock(&ctl->tree_lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2939  
6e80d4f8c422d3 Dennis Zhou  2019-12-13  2940  	btrfs_discard_queue_work(&block_group->fs_info->discard_ctl, block_group);
6e80d4f8c422d3 Dennis Zhou  2019-12-13  2941  
fa9c0d795f7b57 Chris Mason  2009-04-03  2942  	/* finally drop our ref */
fa9c0d795f7b57 Chris Mason  2009-04-03  2943  	btrfs_put_block_group(block_group);
fa9c0d795f7b57 Chris Mason  2009-04-03  2944  	return ret;
fa9c0d795f7b57 Chris Mason  2009-04-03  2945  }
fa9c0d795f7b57 Chris Mason  2009-04-03  2946  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34994 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/2] btrfs: convert block group refcount to refcount_t
Date: Thu, 02 Jul 2020 13:22:07 +0800	[thread overview]
Message-ID: <202007021321.ffWfAzPH%lkp@intel.com> (raw)
In-Reply-To: <20200701202219.11984-1-josef@toxicpanda.com>

[-- Attachment #1: Type: text/plain, Size: 8001 bytes --]

Hi Josef,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on v5.8-rc3 next-20200701]
[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/Josef-Bacik/btrfs-convert-block-group-refcount-to-refcount_t/20200702-042305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: i386-randconfig-a003-20200701 (attached as .config)
compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   In file included from fs/btrfs/free-space-cache.c:14:0:
   fs/btrfs/ctree.h:2216:16: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    size_t __const btrfs_get_num_csums(void);
                   ^
   fs/btrfs/free-space-cache.c: In function 'btrfs_return_cluster_to_free_space':
>> fs/btrfs/free-space-cache.c:2930:13: warning: passing argument 1 of 'atomic_inc' from incompatible pointer type
     atomic_inc(&block_group->count);
                ^
   In file included from arch/x86/include/asm/atomic.h:265:0,
                    from include/linux/atomic.h:7,
                    from include/linux/jump_label.h:249,
                    from include/linux/static_key.h:1,
                    from arch/x86/include/asm/nospec-branch.h:6,
                    from arch/x86/include/asm/paravirt_types.h:46,
                    from arch/x86/include/asm/ptrace.h:94,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/pagemap.h:8,
                    from fs/btrfs/free-space-cache.c:6:
   include/asm-generic/atomic-instrumented.h:237:1: note: expected 'struct atomic_t *' but argument is of type 'struct refcount_t *'
    atomic_inc(atomic_t *v)
    ^
   fs/btrfs/free-space-cache.c: In function 'btrfs_find_space_cluster':
   fs/btrfs/free-space-cache.c:3361:14: warning: passing argument 1 of 'atomic_inc' from incompatible pointer type
      atomic_inc(&block_group->count);
                 ^
   In file included from arch/x86/include/asm/atomic.h:265:0,
                    from include/linux/atomic.h:7,
                    from include/linux/jump_label.h:249,
                    from include/linux/static_key.h:1,
                    from arch/x86/include/asm/nospec-branch.h:6,
                    from arch/x86/include/asm/paravirt_types.h:46,
                    from arch/x86/include/asm/ptrace.h:94,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/pagemap.h:8,
                    from fs/btrfs/free-space-cache.c:6:
   include/asm-generic/atomic-instrumented.h:237:1: note: expected 'struct atomic_t *' but argument is of type 'struct refcount_t *'
    atomic_inc(atomic_t *v)
    ^

vim +/atomic_inc +2930 fs/btrfs/free-space-cache.c

fa9c0d795f7b57 Chris Mason  2009-04-03  2901  
fa9c0d795f7b57 Chris Mason  2009-04-03  2902  /*
fa9c0d795f7b57 Chris Mason  2009-04-03  2903   * given a cluster, put all of its extents back into the free space
fa9c0d795f7b57 Chris Mason  2009-04-03  2904   * cache.  If a block group is passed, this function will only free
fa9c0d795f7b57 Chris Mason  2009-04-03  2905   * a cluster that belongs to the passed block group.
fa9c0d795f7b57 Chris Mason  2009-04-03  2906   *
fa9c0d795f7b57 Chris Mason  2009-04-03  2907   * Otherwise, it'll get a reference on the block group pointed to by the
fa9c0d795f7b57 Chris Mason  2009-04-03  2908   * cluster and remove the cluster from it.
fa9c0d795f7b57 Chris Mason  2009-04-03  2909   */
fa9c0d795f7b57 Chris Mason  2009-04-03  2910  int btrfs_return_cluster_to_free_space(
32da5386d9a4fd David Sterba 2019-10-29  2911  			       struct btrfs_block_group *block_group,
fa9c0d795f7b57 Chris Mason  2009-04-03  2912  			       struct btrfs_free_cluster *cluster)
fa9c0d795f7b57 Chris Mason  2009-04-03  2913  {
34d52cb6c50b5a Li Zefan     2011-03-29  2914  	struct btrfs_free_space_ctl *ctl;
fa9c0d795f7b57 Chris Mason  2009-04-03  2915  	int ret;
fa9c0d795f7b57 Chris Mason  2009-04-03  2916  
fa9c0d795f7b57 Chris Mason  2009-04-03  2917  	/* first, get a safe pointer to the block group */
fa9c0d795f7b57 Chris Mason  2009-04-03  2918  	spin_lock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2919  	if (!block_group) {
fa9c0d795f7b57 Chris Mason  2009-04-03  2920  		block_group = cluster->block_group;
fa9c0d795f7b57 Chris Mason  2009-04-03  2921  		if (!block_group) {
fa9c0d795f7b57 Chris Mason  2009-04-03  2922  			spin_unlock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2923  			return 0;
fa9c0d795f7b57 Chris Mason  2009-04-03  2924  		}
fa9c0d795f7b57 Chris Mason  2009-04-03  2925  	} else if (cluster->block_group != block_group) {
fa9c0d795f7b57 Chris Mason  2009-04-03  2926  		/* someone else has already freed it don't redo their work */
fa9c0d795f7b57 Chris Mason  2009-04-03  2927  		spin_unlock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2928  		return 0;
fa9c0d795f7b57 Chris Mason  2009-04-03  2929  	}
fa9c0d795f7b57 Chris Mason  2009-04-03 @2930  	atomic_inc(&block_group->count);
fa9c0d795f7b57 Chris Mason  2009-04-03  2931  	spin_unlock(&cluster->lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2932  
34d52cb6c50b5a Li Zefan     2011-03-29  2933  	ctl = block_group->free_space_ctl;
34d52cb6c50b5a Li Zefan     2011-03-29  2934  
fa9c0d795f7b57 Chris Mason  2009-04-03  2935  	/* now return any extents the cluster had on it */
34d52cb6c50b5a Li Zefan     2011-03-29  2936  	spin_lock(&ctl->tree_lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2937  	ret = __btrfs_return_cluster_to_free_space(block_group, cluster);
34d52cb6c50b5a Li Zefan     2011-03-29  2938  	spin_unlock(&ctl->tree_lock);
fa9c0d795f7b57 Chris Mason  2009-04-03  2939  
6e80d4f8c422d3 Dennis Zhou  2019-12-13  2940  	btrfs_discard_queue_work(&block_group->fs_info->discard_ctl, block_group);
6e80d4f8c422d3 Dennis Zhou  2019-12-13  2941  
fa9c0d795f7b57 Chris Mason  2009-04-03  2942  	/* finally drop our ref */
fa9c0d795f7b57 Chris Mason  2009-04-03  2943  	btrfs_put_block_group(block_group);
fa9c0d795f7b57 Chris Mason  2009-04-03  2944  	return ret;
fa9c0d795f7b57 Chris Mason  2009-04-03  2945  }
fa9c0d795f7b57 Chris Mason  2009-04-03  2946  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34994 bytes --]

  parent reply	other threads:[~2020-07-02  5:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 20:22 [PATCH 1/2] btrfs: convert block group refcount to refcount_t Josef Bacik
2020-07-01 20:22 ` [PATCH 2/2] btrfs: fix block group UAF bug with nocow Josef Bacik
2020-07-02 11:24   ` Filipe Manana
2020-07-02  1:25 ` [PATCH 1/2] btrfs: convert block group refcount to refcount_t kernel test robot
2020-07-02  1:25   ` kernel test robot
2020-07-02  1:32 ` kernel test robot
2020-07-02  5:22 ` kernel test robot [this message]
2020-07-02  5:22   ` kernel test robot
2020-07-02 11:24 ` Filipe Manana
2020-07-03 12:54 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202007021321.ffWfAzPH%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=josef@toxicpanda.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.