319 Commits

Author SHA1 Message Date
Giuseppe Scrivano
0e33eb5da8
main: drop the ino if the last node is removed
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-10-06 17:47:36 +02:00
Giuseppe Scrivano
228544e71d
main: remove unreferenced inodes on forget_multi
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-10-06 17:47:35 +02:00
Giuseppe Scrivano
6e2675593c
main: attempt an inode free on releasedir
if the reference held by the directory is the last one, it would miss
to clean up the inode.  Fix it by calling do_forget.

Closes: https://github.com/containers/fuse-overlayfs/issues/238

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-10-06 17:47:34 +02:00
Giuseppe Scrivano
e9cdbc444c
main: print usage statistics on USR1
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-10-06 11:10:33 +02:00
Giuseppe Scrivano
540f80dbe8
main: record how many objects are in memory
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-10-06 11:10:33 +02:00
Daniel J Walsh
cb6b7d55bc
Fix problems found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-11 10:29:03 -04:00
Giuseppe Scrivano
b1cc0e2b98
main: honor chownat flags
honor the specified flags to fchownat.

commit 50787d38278fa41c1b3f8167ccfe13ec83d9a063 introduced the
regression.

Closes: https://github.com/containers/fuse-overlayfs/issues/233

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2020-09-03 22:25:02 +02:00
Giuseppe Scrivano
b958a3062e
Merge pull request #230 from mgoltzsche/fix_alpine_file_exists_at
utils.c: fix file_exists_at on musl.
2020-08-27 09:43:56 +02:00
Max Goltzsche
d5b725b6f1
utils.c: fix file_exists_at musl compatibility.
utils.c: file_exists_at: fallback to `fstatat` when `faccessat` fails with `EINVAL` (on musl).
.travis.yml: alpine test added.
main.c: reallocate path before appending.

Closes #174.

Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2020-08-26 02:22:53 +02:00
Giuseppe Scrivano
b8086b58fa
main: support writing uid/gid/mode to xattr
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-08-21 19:52:28 +02:00
Giuseppe Scrivano
50787d3827
main: prepare wrappers for chown/chmod
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-08-21 16:43:59 +02:00
Giuseppe Scrivano
ab407f7c9e
direct: store if the layer must be remapped
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-08-21 16:02:59 +02:00
Giuseppe Scrivano
8f666d4820
main: fix segfault if no mountpoint specified
Closes: https://github.com/containers/fuse-overlayfs/issues/225

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2020-07-17 23:39:03 +02:00
Giuseppe Scrivano
2b8dff330f
main: fix memory leak when creating a whiteout
Closes: https://github.com/containers/fuse-overlayfs/issues/222

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-29 13:54:22 +02:00
Giuseppe Scrivano
1d8f4b529d
main: fix lookup for overflow uid
we were mistakenly using the overflow GID also for UIDs lookups.  Not
a big issue as they usually have the same value.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-20 20:34:28 +02:00
Giuseppe Scrivano
0d985794d9
main: add error checks for workdir initialization
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-20 20:33:52 +02:00
Giuseppe Scrivano
f26f1f71ae
mkdir: if the destination exists atomically swap them
if the destination already exists as it could not be properly cleaned
up, attempt to atomically swap the two directories and free the old
one.

Closes: https://github.com/containers/fuse-overlayfs/issues/213

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-17 15:05:00 +02:00
Giuseppe Scrivano
6d75146e29
main: correctly report copyup error
the copyup function returns the error code set in ret.  Make sure ret
has the correct return code if set_fd_origin fails.

Closes: https://github.com/containers/fuse-overlayfs/issues/211

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-05-26 22:20:15 +02:00
Giuseppe Scrivano
f6262ed778
main: fix copy loop
fix potential infinite loop on a short read.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-30 15:13:32 +02:00
Giuseppe Scrivano
9b687001bb
main: fix signature for ovl_ioctl
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-30 15:13:31 +02:00
Giuseppe Scrivano
cb934ef871
main: delete dead code
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-30 15:13:30 +02:00
Giuseppe Scrivano
b947555f87
main: remove superflous check
pnode cannot be NULL.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-30 15:13:30 +02:00
Giuseppe Scrivano
33a3a7970e
main: avoid double free on cleanup
the cleanup_node_init label already takes care of it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-30 15:13:29 +02:00
Giuseppe Scrivano
5b271aa796
main: add check for malloc
Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2020-04-25 13:43:00 +02:00
Giuseppe Scrivano
26e4226a41
main: fix set mtime for a symlink
Closes: https://github.com/containers/fuse-overlayfs/issues/204

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2020-04-25 13:28:33 +02:00
Giuseppe Scrivano
fb8eb3300e
main: use openat2 where available
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-21 18:33:33 +02:00
Giuseppe Scrivano
dd985bccba
main.c: accept "ro" as a mount option
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-20 12:28:53 +02:00
Daniel J Walsh
6cb22ea674
Merge pull request #194 from giuseppe/correct-nlink-dirs
main: drop nlink optimization
2020-03-16 10:23:52 -04:00
Giuseppe Scrivano
f703870668
main: drop nlink optimization
calculate the nlink for the directory on each stat.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-03-16 11:54:39 +01:00
Giuseppe Scrivano
e63c9b133d
main: stop ino lookup without an open fd
stop the lookup for the dev/ino if there is not an ino open as it also
prevents reading the origin xattr.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-03-16 11:36:55 +01:00
Giuseppe Scrivano
9660aaed2f
main: preserve errno for create_directory
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-03-03 16:50:16 +01:00
Giuseppe Scrivano
47218d09ab
main, rename: make sure destination is deleted
before doing a rename(2) make sure the destination is cleaned up,
otherwise a left-over directory can cause the rename to fail with
EEXIST.

Closes: https://github.com/containers/fuse-overlayfs/issues/189

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-03-03 16:50:15 +01:00
Daniel J Walsh
14b1e91521
Add support for debug to match help
The help message that is printed does not match reality for the command line.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-18 11:09:12 -05:00
Giuseppe Scrivano
f8b554aa9a
main: lookup skip ino if there is no origin
if there is no origin xattr specified, do not overwrite the ino
number.

Closes: https://github.com/containers/fuse-overlayfs/issues/177

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-31 15:39:41 +01:00
Giuseppe Scrivano
d4a957dea9
main: use the rename version when setting opaque
so that it can be correctly set on the directory before renaming it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-17 22:01:17 +01:00
Giuseppe Scrivano
632c56f4b9
listxattr/getxattr: do not access private xattrs
Closes: https://github.com/containers/fuse-overlayfs/issues/173

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-17 18:48:27 +01:00
Giuseppe Scrivano
ce93abae5f
main: do not copyup opaque xattr
when performing the copyup, do not copy the private xattrs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-15 17:52:16 +01:00
Giuseppe Scrivano
214d606084
main: check if file is whiteout
when doing a lookup, make sure the returned file is not a whiteout for
functions that expect the file to exist.

Close: https://github.com/containers/fuse-overlayfs/issues/169

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-15 00:09:31 +01:00
Giuseppe Scrivano
724ab6d2b3
main: reset O_DIRECT on open
having the fd open with O_DIRECT causes pwrite64 to fail with EINVAL
if the write buffer is not aligned.  Since we have no control on the
buffer provided by libfuse, just drop O_DIRECT.

Closes: https://github.com/containers/fuse-overlayfs/issues/167

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-14 12:28:54 +01:00
Giuseppe Scrivano
ffc83a4ed6
main: specify FUSE_BUF_FD_RETRY to libfuse
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-14 12:27:17 +01:00
Giuseppe Scrivano
dfea3f9b63
main: fix fallocate for deleted files
allow to use fallocate on an unlinked path if there is still a
reference to it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-13 22:24:34 +01:00
Daniel J Walsh
a0ba68151a
Merge pull request #164 from giuseppe/fix-160
main: force a dir reload after a move
2020-01-08 12:20:29 -05:00
Giuseppe Scrivano
9f27377e13
Merge pull request #163 from saschagrunert/segfault
Fix possible segmentation fault in direct_fsync()
2020-01-08 13:25:41 +01:00
Giuseppe Scrivano
a9c49ec18d
main: create_missing_whiteouts uses datastore
refactor create_missing_whiteouts to use the datastore API so it works
correctly with plugins.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-08 13:24:00 +01:00
Giuseppe Scrivano
efcfb045b4
main: skip whiteouts file when creating missing ones
do not attempt to create a whiteout if the file itself is already a
whiteout.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-08 13:23:16 +01:00
Giuseppe Scrivano
b29a8f1587
main: force a dir reload after a move
if the directory was moved, invalidate its cache and force a reload.

Closes: https://github.com/containers/fuse-overlayfs/issues/160

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-08 13:22:20 +01:00
Sascha Grunert
0aa0537459
Fix possible segmentation fault in direct_fsync()
If the call to `get_upper_layer(lo)` returns `NULL` then the
`node->layer` will be `NULL`, too. If this is the case we pass `NULL` to
`direct_fsync()` which will cause a segmentation fault in:

```c
cfd = openat(l->fd, path, O_NOFOLLOW|O_DIRECTORY);
```

To fix this we now apply an additional check and error in the case of
`get_upper_layer(lo) == NULL`.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-08 09:33:48 +01:00
Sascha Grunert
07627d4ddb
Fix dead assignment in main.c
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-08 09:23:42 +01:00
Sascha Grunert
8f3a1dde24
Fix dead increment in main.c
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-08 09:22:22 +01:00
Giuseppe Scrivano
884052db48
build: fix compiler warnings found by gcc
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-12-09 14:49:34 +01:00