]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- throw QuotaException
authorArvin Schnell <aschnell@suse.de>
Mon, 8 Aug 2016 12:49:30 +0000 (14:49 +0200)
committerArvin Schnell <aschnell@suse.de>
Mon, 8 Aug 2016 12:49:30 +0000 (14:49 +0200)
snapper/Snapper.cc

index a2da3c8b9fa5aa5f6143790e70add1ca09bded27..c428437b7e1191598cfa1ec13198b7e8569035ce 100644 (file)
@@ -696,33 +696,38 @@ namespace snapper
 
        SDir subvolume_dir = openSubvolumeDir();
 
-       vector<qgroup_t> children = qgroup_query_children(subvolume_dir.fd(), btrfs->getQGroup());
-       sort(children.begin(), children.end());
+       try
+       {
+           vector<qgroup_t> children = qgroup_query_children(subvolume_dir.fd(), btrfs->getQGroup());
+           sort(children.begin(), children.end());
 
-       // Iterate all snapshot and ensure that those and only those with a
-       // cleanup algorithm are included in the high level qgroup.
+           // Iterate all snapshot and ensure that those and only those with a
+           // cleanup algorithm are included in the high level qgroup.
 
-       for (const Snapshot& snapshot : snapshots)
-       {
-           if (snapshot.isCurrent())
-               continue;
+           for (const Snapshot& snapshot : snapshots)
+           {
+               if (snapshot.isCurrent())
+                   continue;
 
-           subvolid_t subvolid = get_id(snapshot.openSnapshotDir().fd());
-           qgroup_t qgroup = calc_qgroup(0, subvolid);
+               subvolid_t subvolid = get_id(snapshot.openSnapshotDir().fd());
+               qgroup_t qgroup = calc_qgroup(0, subvolid);
 
-           bool included = binary_search(children.begin(), children.end(), qgroup);
+               bool included = binary_search(children.begin(), children.end(), qgroup);
 
-           if (!snapshot.getCleanup().empty() && !included)
-           {
-               qgroup_assign(subvolume_dir.fd(), qgroup, btrfs->getQGroup());
-           }
-           else if (snapshot.getCleanup().empty() && included)
-           {
-               qgroup_remove(subvolume_dir.fd(), qgroup, btrfs->getQGroup());
+               if (!snapshot.getCleanup().empty() && !included)
+               {
+                   qgroup_assign(subvolume_dir.fd(), qgroup, btrfs->getQGroup());
+               }
+               else if (snapshot.getCleanup().empty() && included)
+               {
+                   qgroup_remove(subvolume_dir.fd(), qgroup, btrfs->getQGroup());
+               }
            }
        }
-
-       quota_rescan(subvolume_dir.fd());
+       catch (const runtime_error& e)
+       {
+           SN_THROW(QuotaException("preparing quota failed"));
+       }
 
 #else