Re: [PATCH btrfs-progs 0/2] balance: check balance errors on background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/31/19 7:36 AM, Marcos Paulo de Souza wrote:
From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>

The first patch removes the close/open operation of stderr, so we can receive
errors of balance when starting in the background.

The second patch waits up to three seconds after started the balance process, to
check is some problem happened to the balance process. This is done only when
the user issues the "balance start" in background mode.

This was tested by issuing running "btrfs balance start --background
--full-balance <path>", when the balance started, issue the same command again
in the same terminal:

# ./btrfs balance start --background --full-balance /mnt
# ./btrfs balance start --background --full-balance /mnt
ERROR: error during balancing '/mnt': Operation now in progress

These two patches together fixes the issue 167[1].

Please review,
Thanks.

[1]: https://github.com/kdave/btrfs-progs/issues/167


David,

-----
(To fix this, the parent process should wait a bit if the forked background process still runs and report errors otherwise. There are no blocking calls when the 2nd ioctl is called, so a few seconds should be enough.)
-----

 This approach might work in most of the cases. However user thread
 waiting for 3 sec is not a deterministic way to find if the balance
 was started successfully in the kernel. IMO.

 Instead can we use the balance start ioctl to spin a kthread
 to run the actual balance that is __btrfs_balance(). With means
 until call to __btrfs_balance() we shall use ioctl-thread and
 to spin up kthread to run __btrfs_balance() and return the ioctl
 thread with the interim status
 (So for the --no-background user thread has to monitor the
 balance status using the balance progress ioctl and return when
 the status becomes completed and also it should call balance control
 ioctl if the received sigint).

 We do use kthread for balance, if mount thread has to resume the
 balance. so its a kind of extension to it.

 But in the view of the backward btrfs-progs compatibility (that is new
 kernel with old progs) it looks like we need a new balance-ioctl
 altogether, but the question is if its too much infrastructure changes,
 which otherwise might have worked fairly well with a 3 sec delay? What
 do you think? I think its a good idea to fix it in the right way.


Thanks, Anand

Marcos Paulo de Souza (2):
   btrfs-progs: balance: Don't set stderr to /dev/null on balance_start
   btrfs-progs: balance: Verify EINPROGRESS on background balance

  cmds/balance.c | 19 +++++++++++++++----
  1 file changed, 15 insertions(+), 4 deletions(-)





[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux