Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] Refactor btrfs_ioctl_balance
@ 2022-05-03  8:36 Nikolay Borisov
  2022-05-03  8:36 ` [PATCH 1/2] btrfs: Introduce btrfs_try_lock_balance Nikolay Borisov
  2022-05-03  8:36 ` [PATCH 2/2] btrfs: Use btrfs_try_lock_balance in btrfs_ioctl_balance Nikolay Borisov
  0 siblings, 2 replies; 12+ messages in thread
From: Nikolay Borisov @ 2022-05-03  8:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-05-27 16:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox