diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/rm-rf-optionally-fsync-after-removing-directory-tree.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/rm-rf-optionally-fsync-after-removing-directory-tree.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/rm-rf-optionally-fsync-after-removing-directory-tree.patch b/meta/recipes-core/systemd/systemd/rm-rf-optionally-fsync-after-removing-directory-tree.patch new file mode 100644 index 0000000000..b860da008c --- /dev/null +++ b/meta/recipes-core/systemd/systemd/rm-rf-optionally-fsync-after-removing-directory-tree.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | Backport of the following upstream commit: | ||
2 | From bdfe7ada0d4d66e6d6e65f2822acbb1ec230f9c2 Mon Sep 17 00:00:00 2001 | ||
3 | From: Lennart Poettering <lennart@poettering.net> | ||
4 | Date: Tue, 5 Oct 2021 10:32:56 +0200 | ||
5 | Subject: [PATCH] rm-rf: optionally fsync() after removing directory tree | ||
6 | |||
7 | Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd_245.4-4ubuntu3.15.debian.tar.xz] | ||
8 | Signed-off-by: Purushottam Choudhary <Purushottam.Choudhary@kpit.com> | ||
9 | --- | ||
10 | src/basic/rm-rf.c | 3 +++ | ||
11 | src/basic/rm-rf.h | 1 + | ||
12 | 2 files changed, 4 insertions(+) | ||
13 | |||
14 | --- a/src/basic/rm-rf.c | ||
15 | +++ b/src/basic/rm-rf.c | ||
16 | @@ -161,6 +161,9 @@ | ||
17 | ret = r; | ||
18 | } | ||
19 | |||
20 | + if (FLAGS_SET(flags, REMOVE_SYNCFS) && syncfs(dirfd(d)) < 0 && ret >= 0) | ||
21 | + ret = -errno; | ||
22 | + | ||
23 | return ret; | ||
24 | } | ||
25 | |||
26 | --- a/src/basic/rm-rf.h | ||
27 | +++ b/src/basic/rm-rf.h | ||
28 | @@ -11,6 +11,7 @@ | ||
29 | REMOVE_PHYSICAL = 1 << 2, /* If not set, only removes files on tmpfs, never physical file systems */ | ||
30 | REMOVE_SUBVOLUME = 1 << 3, /* Drop btrfs subvolumes in the tree too */ | ||
31 | REMOVE_MISSING_OK = 1 << 4, /* If the top-level directory is missing, ignore the ENOENT for it */ | ||
32 | + REMOVE_SYNCFS = 1 << 7, /* syncfs() the root of the specified directory after removing everything in it */ | ||
33 | } RemoveFlags; | ||
34 | |||
35 | int rm_rf_children(int fd, RemoveFlags flags, const struct stat *root_dev); | ||