414 Commits

Author SHA1 Message Date
Giuseppe Scrivano
57b1e98d69
build: provide replacement for open_by_handle_at(2) if not present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-07 10:22:12 +01:00
Giuseppe Scrivano
40ba2786d2
build: provide replacement for error(3) if not present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-07 10:21:20 +01:00
Giuseppe Scrivano
1a5ba7a3ef
fuse-overlayfs: ignore xattrs copy errors when not supported
it solves this error on copy_xattrs when the underlying file system is
overlay:

flistxattr(9, "security.selinux\0", 1048576) = 17
fgetxattr(9, "security.selinux", "system_u:object_r:container_file"..., 256) = 48
fsetxattr(10, "security.selinux", "system_u:object_r:container_file"..., 48, 0) = -1

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-22 10:37:18 +01:00
Giuseppe Scrivano
1533c9f596
fuse-overlayfs: skip whiteout if not present in lower layers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-18 20:13:50 +01:00
Giuseppe Scrivano
130e0000e5
fuse-overlayfs: accept nosuid,nodev,exec,noexec
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-18 20:05:41 +01:00
Giuseppe Scrivano
7f21f8fcf9
fuse-overlayfs: add cleanup for layers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-17 21:16:47 +01:00
Giuseppe Scrivano
67fa787735
fuse-overlayfs: use cleanup function for initializing node
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-17 21:16:46 +01:00
Giuseppe Scrivano
f1b1e52a15
fuse-overlayfs: refactor some xattrs common code
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-17 20:44:55 +01:00
Giuseppe Scrivano
f64f652878
fuse-overlayfs: drop usage of static arrays for paths
now that we are using autocleanup macros, there are no excuses for
using static arrays.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-02-17 20:44:53 +01:00
Giuseppe Scrivano
346067ab87
fuse-overlayfs: accept option "dev"
Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-02-17 20:44:53 +01:00
Giuseppe Scrivano
43b6b2ecf9
fuse-overlayfs: add check to readdir for the node parent
ensure the node was not moved and that its parent is the same as the
directory we are reading.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-02-17 20:44:52 +01:00
Giuseppe Scrivano
3ff2c01cbb
main: add missing debug messages
Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-02-17 20:44:51 +01:00
Giuseppe Scrivano
37d91db36e
fuse-overlayfs: start using GCC autocleanup
let's start using __attribute__((cleanup)), it helps to simplify
a lot of code, and hopefully avoid some bugs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-17 20:44:50 +01:00
Giuseppe Scrivano
090f9e11c2
main: do the unlink only after we created the temporary file
in case of failures when we open the temporary file, we don't do any
modification to the file system.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-15 22:13:16 +01:00
Giuseppe Scrivano
cf17de5a8a
main: fix a fd leak
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-15 22:13:12 +01:00
Giuseppe Scrivano
bbf631d046
fuse-overlays: fix interaction of unlink(2) with readdir(2)
fix an interesting interaction between unlink(2) and readdir(2) that
can confuse the cache.

If a file is unlinked before the readdir(2) is done, it is not removed
from the list generated when the directory was first opened.  Thus the
result is that readdir(2) will return the file even if it was unlinked
and moved to the work dir until the cache is released.

The fix is to skip dentries that are hidden while iterating the list.

Closes: https://github.com/containers/libpod/issues/2342

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-15 19:19:21 +01:00
Giuseppe Scrivano
81e220147a
main: ignore EINVAL when copying xattrs
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-12 11:33:18 +01:00
Stephane Thiell
a9091e4bd8 setattr: use fd from fi->fh for ftruncate() whenever possible
When a file is created with restricted permissions (like 000), ftruncate() should
still work as long as the fd is open. If fi->fh is available, use it to fix that
and avoid the call to openat() which failed in that case.
2019-02-07 16:16:45 -08:00
Stephane Thiell
f0cd15ec64 create_directory: do not redeclare variable buf 2019-02-04 14:46:29 -08:00
Daniel J Walsh
6dbbd3c712
Merge pull request #39 from giuseppe/no-allow-others-when-uid-not-zero
fuse-overlayfs: use allow_other only when running with uid=0
2019-01-12 09:19:30 -05:00
Giuseppe Scrivano
0a3665a7a0
mkdir: honor calling process umask
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-09 16:01:25 +01:00
Giuseppe Scrivano
830d634b2d
fuse-overlayfs: use allow_other only when running with uid=0
Closes: https://github.com/containers/fuse-overlayfs/issues/35

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-09 11:37:59 +01:00
Giuseppe Scrivano
2dbd61c52e
mknod: honor umask from the calling process
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-07 15:27:34 +01:00
Giuseppe Scrivano
8935bb1d8f
fuse-overlayfs: honor process umask
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-07 10:03:45 +01:00
Giuseppe Scrivano
bbc8181f59
fuse-overlayfs: create symlinks with the correct owner
Closes: https://github.com/containers/libpod/issues/2091

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-07 09:57:20 +01:00
Giuseppe Scrivano
d3729baa93
fuse-overlays: bump max open files to hard limit
Increase the soft limit for the open files to the hard limit.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-04 13:22:06 +01:00
Giuseppe Scrivano
b27d7ebc2c
fuse-overlayfs: print diagnostics to stderr
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-01-04 09:14:12 +01:00
Giuseppe Scrivano
d3e36f332e
fuse-overlayfs: set suid when running in a user namespace
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-20 12:44:31 +01:00
Giuseppe Scrivano
b31d6d50fb
main: fix some dead assignments
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-19 11:20:46 +01:00
Giuseppe Scrivano
63a6dae075
copyup: fix error if lower file cannot be opened
propagate the error code to the caller if the lower file cannot be
opened.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2018-12-14 22:42:54 +01:00
Giuseppe Scrivano
d49ce33689
fuse-overlayfs: set umask to 0
be sure we are able to set all the bits on created files/directories.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-11 22:08:20 +01:00
Giuseppe Scrivano
d5be66901f
main: print fuse-overlayfs version
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-11 12:09:02 +01:00
Giuseppe Scrivano
05843eb2af
fuse-overlayfs: honor --help and --version
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-11 12:07:52 +01:00
Giuseppe Scrivano
55b068e823
lookup: check for a .wh. file in the same layer
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-07 11:59:55 +01:00
Giuseppe Scrivano
4007f8b65f
readdir: check if there is a .wh. file in the same directory
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-07 11:59:55 +01:00
Giuseppe Scrivano
4d7ac8d50a
tests: add way to test out .wh. whiteout variant
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-07 11:36:35 +01:00
Giuseppe Scrivano
b54426b6c3
fuse-overlayfs: honor .wh. whiteout files
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-07 09:20:34 +01:00
Giuseppe Scrivano
a147df9b11
fuse-overlayfs: reset times struct before using it
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-07 09:02:13 +01:00
Giuseppe Scrivano
a289a24acc
fuse-overlayfs: read correctly inode for dangling symlinks
do not follow symlinks when stat'ing a path, so that we read the inode
of the symlink itself.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-06 18:37:02 +01:00
Giuseppe Scrivano
aa23169fec
fuse-overlayfs: use O_NONBLOCK for opening files
avoid blocking on opening a fifo:

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-10-17 16:26:07 +02:00
Giuseppe Scrivano
2bcddc680c
fuse-overlayfs: try alternative whiteout on ENOTSUP
if mknod fails with ENOTSUP then use the .wh.FILE variant.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-10-06 11:43:52 +02:00
Giuseppe Scrivano
d40ac752b4
Merge pull request #14 from giuseppe/honor-overlay-origin-xattr
fuse-overlayfs: honor trusted.overlay.origin
2018-08-07 08:26:53 +02:00
Giuseppe Scrivano
b3898da66d
overlay: honor trusted.overlay.origin
While fuse-overlayfs doesn't set this xattr, ensure that we honor it
when it exists so that we report the correct st_ino on lower layers
that were created using the kernel implementation.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-01 13:54:08 +02:00
Giuseppe Scrivano
78f00d6449
setxattr: do not allow to set trusted.overlay.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-01 13:51:18 +02:00
Giuseppe Scrivano
21cb0e199d
read_dirs: always initialize l->next to NULL
Resolve a segfault when using multiple lower layers.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-01 13:51:18 +02:00
Giuseppe Scrivano
1dadd3738f
main: improve errors logging
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-01 10:29:24 +02:00
Giuseppe Scrivano
71a8ad3175 fuse-overlayfs: try RENAME_EXCHANGE if the destination is a whiteout
if we are trying to move over an existing whiteout, try a rename2(...,
RENAME_EXCHANGE) first, so in one atomic operation we get both the
file renamed and the whiteout created in the old source.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-23 22:11:56 +02:00
Giuseppe Scrivano
3c0e4fac10
main: define RENAME_WHITEOUT if the definition is missing
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-20 13:40:50 +02:00
Giuseppe Scrivano
a5431eda02
main: remove include for unused file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-20 13:40:50 +02:00
Giuseppe Scrivano
552afbf2db fuse-overlayfs: mountpoint is the last argument passed
Consider the mountpoint to be the last argument passed, so that
fuse-overlayfs can be used as a mount helper.

This enables to run the github.com/amir73il/unionmount-testsuite
testsuite on fuse-overlayfs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-20 12:36:12 +02:00