All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 0/2] Refactor btrfs_ioctl_balance
Date: Tue,  3 May 2022 11:36:35 +0300	[thread overview]
Message-ID: <20220503083637.1051023-1-nborisov@suse.com> (raw)

A recent bug report about a memleak as a result from my refactoring of
btrfs_ioctl_balance clearly demonstrated that the function has become quite
unwieldy and fragile. This stems from the fact that it involves some fairly
convoluted logic in order to acquire the necessary locks (balance_mutex and the
exclusive ops) and the requirement to handle in-progress or paused balance.

In order to simplify btrfs_ioctl_balance this series first factors out the locking
code as it's de-facto separate functionality. It then replaces the open-coded
locking logic with the newly introduced helper. This makes the code-flow in
btrfs_ioctl_balance more linear and simple to follow.

Nikolay Borisov (2):
  btrfs: Introduce btrfs_try_lock_balance
  btrfs: Use btrfs_try_lock_balance in btrfs_ioctl_balance

 fs/btrfs/ioctl.c | 118 +++++++++++++++++++++++++++++------------------
 1 file changed, 72 insertions(+), 46 deletions(-)

--
2.25.1


             reply	other threads:[~2022-05-03  8:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  8:36 Nikolay Borisov [this message]
2022-05-03  8:36 ` [PATCH 1/2] btrfs: Introduce btrfs_try_lock_balance Nikolay Borisov
2022-05-03 10:20   ` kernel test robot
2022-05-03  8:36 ` [PATCH 2/2] btrfs: Use btrfs_try_lock_balance in btrfs_ioctl_balance Nikolay Borisov
2022-05-06  9:04   ` [btrfs] c696e46e6e: BUG:KASAN:double-free_or_invalid-free_in_btrfs_ioctl_balance kernel test robot
2022-05-06  9:04     ` kernel test robot
2022-05-04  6:20 [PATCH 2/2] btrfs: Use btrfs_try_lock_balance in btrfs_ioctl_balance kernel test robot
2022-05-04  6:46 ` [kbuild] " Dan Carpenter
2022-05-04  6:46 ` Dan Carpenter
2022-05-04  8:44 ` Nikolay Borisov
2022-05-04  8:44   ` Nikolay Borisov
2022-05-04 15:25   ` David Sterba
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

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=20220503083637.1051023-1-nborisov@suse.com \
    --to=nborisov@suse.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.