Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Cc: kbuild-all@lists.01.org, Nikolay Borisov <nborisov@suse.com>
Subject: Re: [PATCH 1/2] btrfs: Introduce btrfs_try_lock_balance
Date: Tue, 3 May 2022 18:20:54 +0800	[thread overview]
Message-ID: <202205031820.eWTnmpgQ-lkp@intel.com> (raw)
In-Reply-To: <20220503083637.1051023-2-nborisov@suse.com>

Hi Nikolay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on v5.18-rc5 next-20220503]
[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/intel-lab-lkp/linux/commits/Nikolay-Borisov/Refactor-btrfs_ioctl_balance/20220503-163837
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20220503/202205031820.eWTnmpgQ-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 11.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/intel-lab-lkp/linux/commit/d383145190e87f46bc73d86059724df2b3af9720
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Nikolay-Borisov/Refactor-btrfs_ioctl_balance/20220503-163837
        git checkout d383145190e87f46bc73d86059724df2b3af9720
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash fs/btrfs/

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:4350: warning: expecting prototype for Try to acquire fs_info:(). Prototype was for btrfs_try_lock_balance() instead


vim +4350 fs/btrfs/ioctl.c

  4336	
  4337	/**
  4338	 * Try to acquire fs_info::balance_Mutex as well as set BTRFS_EXLCOP_BALANCE as
  4339	 * required.
  4340	 *
  4341	 * @fs_info:       context of the filesystem
  4342	 * @excl_acquired: ptr to boolean value which is set to 'false' in case balance
  4343	 * is being resumed.
  4344	 *
  4345	 * Returns 0 on success in which case both fs_info::balance is acquired as well
  4346	 * as exclusive ops are blocked. In case of failure returns an error code.
  4347	 *
  4348	 */
  4349	static int btrfs_try_lock_balance(struct btrfs_fs_info *fs_info, bool *excl_acquired)
> 4350	{
  4351		int ret;
  4352		/*
  4353		 * mut. excl. ops lock is locked.  Three possibilities:
  4354		 *   (1) some other op is running
  4355		 *   (2) balance is running
  4356		 *   (3) balance is paused -- special case (think resume)
  4357		 */
  4358		while (1) {
  4359			if (btrfs_exclop_start(fs_info, BTRFS_EXCLOP_BALANCE)) {
  4360				*excl_acquired = true;
  4361				mutex_lock(&fs_info->balance_mutex);
  4362				return 0;
  4363			}
  4364	
  4365			mutex_lock(&fs_info->balance_mutex);
  4366			if (fs_info->balance_ctl) {
  4367				/* this is either (2) or (3) */
  4368				if (test_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags)) {
  4369					/* this is (2) */
  4370					ret = -EINPROGRESS;
  4371					goto out_failure;
  4372	
  4373				} else {
  4374					mutex_unlock(&fs_info->balance_mutex);
  4375					/*
  4376					 * Lock released to allow other waiters to continue,
  4377					 * we'll reexamine the status again.
  4378					 */
  4379					mutex_lock(&fs_info->balance_mutex);
  4380	
  4381					if (fs_info->balance_ctl &&
  4382					    !test_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags)) {
  4383						/* this is (3) */
  4384						*excl_acquired = false;
  4385						return 0;
  4386					}
  4387				}
  4388			} else {
  4389				/* this is (1) */
  4390				ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
  4391				goto out_failure;
  4392			}
  4393	
  4394			mutex_unlock(&fs_info->balance_mutex);
  4395		}
  4396	
  4397	out_failure:
  4398		mutex_unlock(&fs_info->balance_mutex);
  4399		*excl_acquired = false;
  4400		return ret;
  4401	}
  4402	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

  reply	other threads:[~2022-05-03 10:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  8:36 [PATCH 0/2] Refactor btrfs_ioctl_balance Nikolay Borisov
2022-05-03  8:36 ` [PATCH 1/2] btrfs: Introduce btrfs_try_lock_balance Nikolay Borisov
2022-05-03 10:20   ` kernel test robot [this message]
2022-05-03  8:36 ` [PATCH 2/2] btrfs: Use btrfs_try_lock_balance in btrfs_ioctl_balance Nikolay Borisov
2022-05-04  6:46   ` [kbuild] " Dan Carpenter
2022-05-04  8:44     ` Nikolay Borisov
2022-05-04 15:25       ` David Sterba
2022-05-05  7:08         ` [PATCH v2] " Nikolay Borisov
2022-05-09 19:51           ` David Sterba
2022-05-10  5:42             ` Nikolay Borisov
2022-05-27 15:58               ` David Sterba
2022-05-06  9:04   ` [btrfs] c696e46e6e: BUG:KASAN:double-free_or_invalid-free_in_btrfs_ioctl_balance kernel test robot

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=202205031820.eWTnmpgQ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox