All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: NeilBrown <neilb@suse.de>, Josef Bacik <josef@toxicpanda.com>,
	Chris Mason <chris.mason@fusionio.com>,
	David Sterba <dsterba@suse.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-fsdevel@vger.kernel.org,
	Linux NFS list <linux-nfs@vger.kernel.org>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/4] btrfs: add numdevs= mount option.
Date: Mon, 9 Aug 2021 15:50:57 +0800	[thread overview]
Message-ID: <202108091545.FBDf88Zt-lkp@intel.com> (raw)
In-Reply-To: <162848132773.25823.8504921416553051353.stgit@noble.brown>

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

Hi NeilBrown,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on ext3/fsnotify linus/master v5.14-rc5 next-20210806]
[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/NeilBrown/Attempt-to-make-progress-with-btrfs-dev-number-strangeness/20210809-120046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: x86_64-randconfig-c001-20210809 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c5c3cdb9c92895a63993cee70d2dd776ff9519c3)
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/c5bae87ed5b72b9fd999fa935f477483da001f63
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review NeilBrown/Attempt-to-make-progress-with-btrfs-dev-number-strangeness/20210809-120046
        git checkout c5bae87ed5b72b9fd999fa935f477483da001f63
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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 >>):

>> fs/btrfs/ioctl.c:740:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (fs_info->num_devs == BTRFS_MANY_DEVS)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/ioctl.c:742:6: note: uninitialized use occurs here
           if (ret < 0)
               ^~~
   fs/btrfs/ioctl.c:740:2: note: remove the 'if' if its condition is always true
           if (fs_info->num_devs == BTRFS_MANY_DEVS)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/ioctl.c:725:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +740 fs/btrfs/ioctl.c

   716	
   717	static int create_snapshot(struct btrfs_root *root, struct inode *dir,
   718				   struct dentry *dentry, bool readonly,
   719				   struct btrfs_qgroup_inherit *inherit)
   720	{
   721		struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
   722		struct inode *inode;
   723		struct btrfs_pending_snapshot *pending_snapshot;
   724		struct btrfs_trans_handle *trans;
   725		int ret;
   726	
   727		if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
   728			return -EINVAL;
   729	
   730		if (atomic_read(&root->nr_swapfiles)) {
   731			btrfs_warn(fs_info,
   732				   "cannot snapshot subvolume with active swapfile");
   733			return -ETXTBSY;
   734		}
   735	
   736		pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_KERNEL);
   737		if (!pending_snapshot)
   738			return -ENOMEM;
   739	
 > 740		if (fs_info->num_devs == BTRFS_MANY_DEVS)
   741			ret = get_anon_bdev(&pending_snapshot->anon_dev);
   742		if (ret < 0)
   743			goto free_pending;
   744		pending_snapshot->root_item = kzalloc(sizeof(struct btrfs_root_item),
   745				GFP_KERNEL);
   746		pending_snapshot->path = btrfs_alloc_path();
   747		if (!pending_snapshot->root_item || !pending_snapshot->path) {
   748			ret = -ENOMEM;
   749			goto free_pending;
   750		}
   751	
   752		btrfs_init_block_rsv(&pending_snapshot->block_rsv,
   753				     BTRFS_BLOCK_RSV_TEMP);
   754		/*
   755		 * 1 - parent dir inode
   756		 * 2 - dir entries
   757		 * 1 - root item
   758		 * 2 - root ref/backref
   759		 * 1 - root of snapshot
   760		 * 1 - UUID item
   761		 */
   762		ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root,
   763						&pending_snapshot->block_rsv, 8,
   764						false);
   765		if (ret)
   766			goto free_pending;
   767	
   768		pending_snapshot->dentry = dentry;
   769		pending_snapshot->root = root;
   770		pending_snapshot->readonly = readonly;
   771		pending_snapshot->dir = dir;
   772		pending_snapshot->inherit = inherit;
   773	
   774		trans = btrfs_start_transaction(root, 0);
   775		if (IS_ERR(trans)) {
   776			ret = PTR_ERR(trans);
   777			goto fail;
   778		}
   779	
   780		spin_lock(&fs_info->trans_lock);
   781		list_add(&pending_snapshot->list,
   782			 &trans->transaction->pending_snapshots);
   783		spin_unlock(&fs_info->trans_lock);
   784	
   785		ret = btrfs_commit_transaction(trans);
   786		if (ret)
   787			goto fail;
   788	
   789		ret = pending_snapshot->error;
   790		if (ret)
   791			goto fail;
   792	
   793		ret = btrfs_orphan_cleanup(pending_snapshot->snap);
   794		if (ret)
   795			goto fail;
   796	
   797		inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry);
   798		if (IS_ERR(inode)) {
   799			ret = PTR_ERR(inode);
   800			goto fail;
   801		}
   802	
   803		d_instantiate(dentry, inode);
   804		ret = 0;
   805		pending_snapshot->anon_dev = 0;
   806	fail:
   807		/* Prevent double freeing of anon_dev */
   808		if (ret && pending_snapshot->snap)
   809			pending_snapshot->snap->anon_dev = 0;
   810		btrfs_put_root(pending_snapshot->snap);
   811		btrfs_subvolume_release_metadata(root, &pending_snapshot->block_rsv);
   812	free_pending:
   813		if (pending_snapshot->anon_dev)
   814			free_anon_bdev(pending_snapshot->anon_dev);
   815		kfree(pending_snapshot->root_item);
   816		btrfs_free_path(pending_snapshot->path);
   817		kfree(pending_snapshot);
   818	
   819		return ret;
   820	}
   821	

---
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: 32874 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 2/4] btrfs: add numdevs= mount option.
Date: Mon, 09 Aug 2021 15:50:57 +0800	[thread overview]
Message-ID: <202108091545.FBDf88Zt-lkp@intel.com> (raw)
In-Reply-To: <162848132773.25823.8504921416553051353.stgit@noble.brown>

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

Hi NeilBrown,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on ext3/fsnotify linus/master v5.14-rc5 next-20210806]
[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/NeilBrown/Attempt-to-make-progress-with-btrfs-dev-number-strangeness/20210809-120046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: x86_64-randconfig-c001-20210809 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c5c3cdb9c92895a63993cee70d2dd776ff9519c3)
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/c5bae87ed5b72b9fd999fa935f477483da001f63
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review NeilBrown/Attempt-to-make-progress-with-btrfs-dev-number-strangeness/20210809-120046
        git checkout c5bae87ed5b72b9fd999fa935f477483da001f63
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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 >>):

>> fs/btrfs/ioctl.c:740:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (fs_info->num_devs == BTRFS_MANY_DEVS)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/ioctl.c:742:6: note: uninitialized use occurs here
           if (ret < 0)
               ^~~
   fs/btrfs/ioctl.c:740:2: note: remove the 'if' if its condition is always true
           if (fs_info->num_devs == BTRFS_MANY_DEVS)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/ioctl.c:725:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +740 fs/btrfs/ioctl.c

   716	
   717	static int create_snapshot(struct btrfs_root *root, struct inode *dir,
   718				   struct dentry *dentry, bool readonly,
   719				   struct btrfs_qgroup_inherit *inherit)
   720	{
   721		struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
   722		struct inode *inode;
   723		struct btrfs_pending_snapshot *pending_snapshot;
   724		struct btrfs_trans_handle *trans;
   725		int ret;
   726	
   727		if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
   728			return -EINVAL;
   729	
   730		if (atomic_read(&root->nr_swapfiles)) {
   731			btrfs_warn(fs_info,
   732				   "cannot snapshot subvolume with active swapfile");
   733			return -ETXTBSY;
   734		}
   735	
   736		pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_KERNEL);
   737		if (!pending_snapshot)
   738			return -ENOMEM;
   739	
 > 740		if (fs_info->num_devs == BTRFS_MANY_DEVS)
   741			ret = get_anon_bdev(&pending_snapshot->anon_dev);
   742		if (ret < 0)
   743			goto free_pending;
   744		pending_snapshot->root_item = kzalloc(sizeof(struct btrfs_root_item),
   745				GFP_KERNEL);
   746		pending_snapshot->path = btrfs_alloc_path();
   747		if (!pending_snapshot->root_item || !pending_snapshot->path) {
   748			ret = -ENOMEM;
   749			goto free_pending;
   750		}
   751	
   752		btrfs_init_block_rsv(&pending_snapshot->block_rsv,
   753				     BTRFS_BLOCK_RSV_TEMP);
   754		/*
   755		 * 1 - parent dir inode
   756		 * 2 - dir entries
   757		 * 1 - root item
   758		 * 2 - root ref/backref
   759		 * 1 - root of snapshot
   760		 * 1 - UUID item
   761		 */
   762		ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root,
   763						&pending_snapshot->block_rsv, 8,
   764						false);
   765		if (ret)
   766			goto free_pending;
   767	
   768		pending_snapshot->dentry = dentry;
   769		pending_snapshot->root = root;
   770		pending_snapshot->readonly = readonly;
   771		pending_snapshot->dir = dir;
   772		pending_snapshot->inherit = inherit;
   773	
   774		trans = btrfs_start_transaction(root, 0);
   775		if (IS_ERR(trans)) {
   776			ret = PTR_ERR(trans);
   777			goto fail;
   778		}
   779	
   780		spin_lock(&fs_info->trans_lock);
   781		list_add(&pending_snapshot->list,
   782			 &trans->transaction->pending_snapshots);
   783		spin_unlock(&fs_info->trans_lock);
   784	
   785		ret = btrfs_commit_transaction(trans);
   786		if (ret)
   787			goto fail;
   788	
   789		ret = pending_snapshot->error;
   790		if (ret)
   791			goto fail;
   792	
   793		ret = btrfs_orphan_cleanup(pending_snapshot->snap);
   794		if (ret)
   795			goto fail;
   796	
   797		inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry);
   798		if (IS_ERR(inode)) {
   799			ret = PTR_ERR(inode);
   800			goto fail;
   801		}
   802	
   803		d_instantiate(dentry, inode);
   804		ret = 0;
   805		pending_snapshot->anon_dev = 0;
   806	fail:
   807		/* Prevent double freeing of anon_dev */
   808		if (ret && pending_snapshot->snap)
   809			pending_snapshot->snap->anon_dev = 0;
   810		btrfs_put_root(pending_snapshot->snap);
   811		btrfs_subvolume_release_metadata(root, &pending_snapshot->block_rsv);
   812	free_pending:
   813		if (pending_snapshot->anon_dev)
   814			free_anon_bdev(pending_snapshot->anon_dev);
   815		kfree(pending_snapshot->root_item);
   816		btrfs_free_path(pending_snapshot->path);
   817		kfree(pending_snapshot);
   818	
   819		return ret;
   820	}
   821	

---
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: 32874 bytes --]

  reply	other threads:[~2021-08-09  7:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  3:55 [PATCH/RFC 0/4] Attempt to make progress with btrfs dev number strangeness NeilBrown
2021-08-09  3:55 ` [PATCH 4/4] Add "tree" number to "inode" number in various /proc files NeilBrown
2021-08-09  3:55 ` [PATCH 3/4] VFS/btrfs: add STATX_TREE_ID NeilBrown
2021-08-09  3:55 ` [PATCH 1/4] btrfs: include subvol identifier in inode number if -o inumbits= NeilBrown
2021-08-09  3:55 ` [PATCH 2/4] btrfs: add numdevs= mount option NeilBrown
2021-08-09  7:50   ` kernel test robot [this message]
2021-08-09  7:50     ` kernel test robot
2021-08-10 20:51 ` [PATCH/RFC 0/4] Attempt to make progress with btrfs dev number strangeness Josef Bacik
2021-08-11 22:13   ` NeilBrown
2021-08-12 13:54     ` Josef Bacik
2021-08-12 14:06       ` Hugo Mills
2021-08-12 22:35       ` NeilBrown

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=202108091545.FBDf88Zt-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=chris.mason@fusionio.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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.