summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-01-26 19:00:56 +0100
committerLennart Poettering <lennart@poettering.net>2016-01-27 02:21:28 +0100
commit05e8f270a9ca97e1014184df113494b143639fb8 (patch)
tree2ee7ed4453ab0501e3c74bf1313d289ad014dc83 /src
parent1cdc94482302cca88e0a7282bbc161c1d77c381c (diff)
machined: when the pool limit is set to infinity don't resize backing loopback file
An unlimited quota makes a lot of sense, but we really should try to propagate this onto the loopback file size, since an infinitely sized file makes no sense. Fixes: #2314 #2253
Diffstat (limited to 'src')
-rw-r--r--src/machine/machined-dbus.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 28134f61bf..521043f6a3 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -833,11 +833,14 @@ static int method_set_pool_limit(sd_bus_message *message, void *userdata, sd_bus
if (r < 0)
return r;
- r = btrfs_resize_loopback("/var/lib/machines", limit, false);
- if (r == -ENOTTY)
- return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Quota is only supported on btrfs.");
- if (r < 0 && r != -ENODEV) /* ignore ENODEV, as that's what is returned if the file system is not on loopback */
- return sd_bus_error_set_errnof(error, r, "Failed to adjust loopback limit: %m");
+ /* Resize the backing loopback device, if there is one, except if we asked to drop any limit */
+ if (limit != (uint64_t) -1) {
+ r = btrfs_resize_loopback("/var/lib/machines", limit, false);
+ if (r == -ENOTTY)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Quota is only supported on btrfs.");
+ if (r < 0 && r != -ENODEV) /* ignore ENODEV, as that's what is returned if the file system is not on loopback */
+ return sd_bus_error_set_errnof(error, r, "Failed to adjust loopback limit: %m");
+ }
(void) btrfs_qgroup_set_limit("/var/lib/machines", 0, limit);