From: Arvin Schnell Date: Thu, 23 Feb 2023 10:20:56 +0000 (+0100) Subject: - wait for existing btrfs quota rescans to finish (bsc#1206814) X-Git-Tag: v0.10.5~34^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F790%2Fhead;p=thirdparty%2Fsnapper.git - wait for existing btrfs quota rescans to finish (bsc#1206814) --- 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);