]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- wait for existing btrfs quota rescans to finish (bsc#1206814) 790/head
authorArvin Schnell <aschnell@suse.de>
Thu, 23 Feb 2023 10:20:56 +0000 (11:20 +0100)
committerArvin Schnell <aschnell@suse.de>
Thu, 23 Feb 2023 10:20:56 +0000 (11:20 +0100)
package/snapper.changes
snapper/BtrfsUtils.cc

index de5b813478b5a94787d4e71db5d907a0ddadb94f..ecf4441b3a8e209a7de5cba055185f005944ca2d 100644 (file)
@@ -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
 
index 53bcb92a8a5c393de14ef61160cd9261d689082d..47193ed16de42db74a44061f8bb6365c66fc1cf9 100644 (file)
@@ -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);