From 42ff27df49a0fb475b6320fd88be44ddf72b87b7 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Thu, 23 Feb 2023 11:20:56 +0100 Subject: [PATCH] - wait for existing btrfs quota rescans to finish (bsc#1206814) --- package/snapper.changes | 5 +++++ snapper/BtrfsUtils.cc | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/package/snapper.changes b/package/snapper.changes index de5b8134..ecf4441b 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Feb 23 11:14:58 CET 2023 - aschnell@suse.com + +- wait for existing btrfs quota rescans to finish (bsc#1206814) + ------------------------------------------------------------------- Mon Feb 06 10:43:33 CET 2023 - aschnell@suse.com diff --git a/snapper/BtrfsUtils.cc b/snapper/BtrfsUtils.cc index 53bcb92a..47193ed1 100644 --- a/snapper/BtrfsUtils.cc +++ b/snapper/BtrfsUtils.cc @@ -426,8 +426,22 @@ namespace snapper struct btrfs_ioctl_quota_rescan_args args; memset(&args, 0, sizeof(args)); - if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN, &args) < 0) + for (int i = 0;; ++i) + { + if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN, &args) == 0) + break; + + if (errno == EINPROGRESS) + { + if (i == 0) + y2war("waiting for old quota rescan to finish"); + + sleep(1); + continue; + } + throw runtime_error_with_errno("ioctl(BTRFS_IOC_QUOTA_RESCAN) failed", errno); + } if (ioctl(fd, BTRFS_IOC_QUOTA_RESCAN_WAIT, &args) < 0) throw runtime_error_with_errno("ioctl(BTRFS_IOC_QUOTA_WAIT_RESCAN) failed", errno); -- 2.47.3