summaryrefslogtreecommitdiffstats
path: root/src/shared/import-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-01-20 21:10:31 +0100
committerLennart Poettering <lennart@poettering.net>2020-01-20 21:10:31 +0100
commit137c6c6b36597f687ebdaf5c5321ef33d54f4ebe (patch)
tree1b5773143c4996fb6bddce3a54e572d11b84fc4f /src/shared/import-util.c
parentunits: drop full paths for utilities in $PATH (diff)
downloadsystemd-137c6c6b36597f687ebdaf5c5321ef33d54f4ebe.tar.xz
systemd-137c6c6b36597f687ebdaf5c5321ef33d54f4ebe.zip
import: don't complain if FS_NOCOW_FL is not available
Let's downgrade the log message to LOG_DEBUG if triggered by an fs that doesn't support the flag.
Diffstat (limited to 'src/shared/import-util.c')
-rw-r--r--src/shared/import-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/import-util.c b/src/shared/import-util.c
index f7770e7df5..0a57c08990 100644
--- a/src/shared/import-util.c
+++ b/src/shared/import-util.c
@@ -4,6 +4,8 @@
#include "alloc-util.h"
#include "btrfs-util.h"
+#include "chattr-util.h"
+#include "errno-util.h"
#include "import-util.h"
#include "log.h"
#include "macro.h"
@@ -163,3 +165,15 @@ int import_assign_pool_quota_and_warn(const char *path) {
return 0;
}
+
+int import_set_nocow_and_log(int fd, const char *path) {
+ int r;
+
+ r = chattr_fd(fd, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
+ if (r < 0)
+ return log_full_errno(
+ ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING,
+ r, "Failed to set file attributes on %s: %m", path);
+
+ return 0;
+}