190 lines
6.1 KiB
Diff
190 lines
6.1 KiB
Diff
From 214d606084453f0d2831317a9048a3cbc554fcc4 Mon Sep 17 00:00:00 2001
|
|
From: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
Date: Wed, 15 Jan 2020 00:02:43 +0100
|
|
Subject: [PATCH 1/2] 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>
|
|
---
|
|
main.c | 34 +++++++++++++++++-----------------
|
|
1 file changed, 17 insertions(+), 17 deletions(-)
|
|
|
|
|
|
From ce93abae5fcb3be98867bbfd8e13abb2c086d1c2 Mon Sep 17 00:00:00 2001
|
|
From: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
Date: Wed, 15 Jan 2020 17:52:13 +0100
|
|
Subject: [PATCH 2/2] main: do not copyup opaque xattr
|
|
|
|
when performing the copyup, do not copy the private xattrs.
|
|
|
|
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
---
|
|
main.c | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff -up ./fuse-overlayfs-8c59873b00b3e8ee98be998fec8dbce4cfe984cc/main.c.1804849 ./fuse-overlayfs-8c59873b00b3e8ee98be998fec8dbce4cfe984cc/main.c
|
|
--- fuse-overlayfs-8c59873b00b3e8ee98be998fec8dbce4cfe984cc/main.c.1804849 2020-02-20 14:38:04.204508810 +0100
|
|
+++ fuse-overlayfs-8c59873b00b3e8ee98be998fec8dbce4cfe984cc/main.c 2020-02-20 14:38:04.208508867 +0100
|
|
@@ -2265,7 +2265,7 @@ ovl_getxattr (fuse_req_t req, fuse_ino_t
|
|
}
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -2334,7 +2334,13 @@ copy_xattr (int sfd, int dfd, char *buf,
|
|
for (it = buf; it - buf < xattr_len; it += strlen (it) + 1)
|
|
{
|
|
cleanup_free char *v = NULL;
|
|
- ssize_t s = safe_read_xattr (&v, sfd, it, 256);
|
|
+ ssize_t s;
|
|
+
|
|
+ if (has_prefix (it, XATTR_PREFIX)
|
|
+ || has_prefix (it, PRIVILEGED_XATTR_PREFIX))
|
|
+ continue;
|
|
+
|
|
+ s = safe_read_xattr (&v, sfd, it, 256);
|
|
if (s < 0)
|
|
return -1;
|
|
|
|
@@ -2858,7 +2864,7 @@ do_rm (fuse_req_t req, fuse_ino_t parent
|
|
struct ovl_node key, *rm;
|
|
|
|
node = do_lookup_file (lo, parent, name);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -2904,7 +2910,7 @@ do_rm (fuse_req_t req, fuse_ino_t parent
|
|
}
|
|
|
|
pnode = do_lookup_file (lo, parent, NULL);
|
|
- if (pnode == NULL)
|
|
+ if (pnode == NULL || pnode->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3009,7 +3015,7 @@ ovl_setxattr (fuse_req_t req, fuse_ino_t
|
|
}
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3069,7 +3075,7 @@ ovl_removexattr (fuse_req_t req, fuse_in
|
|
fprintf (stderr, "ovl_removexattr(ino=%" PRIu64 "s, name=%s)\n", ino, name);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3447,7 +3453,7 @@ ovl_getattr (fuse_req_t req, fuse_ino_t
|
|
fprintf (stderr, "ovl_getattr(ino=%" PRIu64 ")\n", ino);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3481,7 +3487,7 @@ ovl_setattr (fuse_req_t req, fuse_ino_t
|
|
fprintf (stderr, "ovl_setattr(ino=%" PRIu64 "s, to_set=%d)\n", ino, to_set);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3663,7 +3669,7 @@ ovl_link (fuse_req_t req, fuse_ino_t ino
|
|
fprintf (stderr, "ovl_link(ino=%" PRIu64 "s, newparent=%" PRIu64 "s, newname=%s)\n", ino, newparent, newname);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3677,7 +3683,7 @@ ovl_link (fuse_req_t req, fuse_ino_t ino
|
|
}
|
|
|
|
newparentnode = do_lookup_file (lo, newparent, NULL);
|
|
- if (newparentnode == NULL)
|
|
+ if (newparentnode == NULL || newparentnode->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3802,7 +3808,7 @@ ovl_symlink (fuse_req_t req, const char
|
|
fprintf (stderr, "ovl_symlink(link=%s, ino=%" PRIu64 "s, name=%s)\n", link, parent, name);
|
|
|
|
pnode = do_lookup_file (lo, parent, NULL);
|
|
- if (pnode == NULL)
|
|
+ if (pnode == NULL || pnode->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -3896,7 +3902,7 @@ ovl_rename_exchange (fuse_req_t req, fus
|
|
char *tmp;
|
|
|
|
node = do_lookup_file (lo, parent, name);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -4255,7 +4261,7 @@ ovl_readlink (fuse_req_t req, fuse_ino_t
|
|
fprintf (stderr, "ovl_readlink(ino=%" PRIu64 "s)\n", ino);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -4661,7 +4667,7 @@ ovl_ioctl (fuse_req_t req, fuse_ino_t in
|
|
ino, cmd, arg, fi, flags, in_buf, in_bufsz, out_bufsz);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -4730,7 +4736,7 @@ ovl_fallocate (fuse_req_t req, fuse_ino_
|
|
ino, mode, offset, length, fi);
|
|
|
|
node = do_lookup_file (lo, ino, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
@@ -4781,14 +4787,14 @@ ovl_copy_file_range (fuse_req_t req, fus
|
|
ino_in, off_in, fi_in, ino_out, off_out, fi_out, len, flags);
|
|
|
|
node = do_lookup_file (lo, ino_in, NULL);
|
|
- if (node == NULL)
|
|
+ if (node == NULL || node->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|
|
}
|
|
|
|
dnode = do_lookup_file (lo, ino_out, NULL);
|
|
- if (dnode == NULL)
|
|
+ if (dnode == NULL || dnode->whiteout)
|
|
{
|
|
fuse_reply_err (req, ENOENT);
|
|
return;
|