babf31
From bd0246fa31ae596fed3a7f94917523798e2ab3c8 Mon Sep 17 00:00:00 2001
babf31
From: Giuseppe Scrivano <gscrivan@redhat.com>
babf31
Date: Sat, 15 Feb 2020 12:33:52 +0100
babf31
Subject: [PATCH] main: force timeout 0 for ovl_link
babf31
babf31
There is an issue on RHEL 8.1 where the nlink counter is always
babf31
incremented by one, no matter what is specified in e.attr.st_nlink.
babf31
babf31
Always set timeout to 0 to force a new stat on the inode.
babf31
babf31
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1802907
babf31
Closes: https://github.com/containers/fuse-overlayfs/issues/183
babf31
babf31
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
babf31
---
babf31
 main.c | 9 ++++++++-
babf31
 1 file changed, 8 insertions(+), 1 deletion(-)
babf31
babf31
diff --git a/main.c b/main.c
babf31
index 80c0f89..0e6dab3 100644
babf31
--- a/main.c
babf31
+++ b/main.c
babf31
@@ -3714,6 +3714,12 @@ direct_linkat (struct ovl_layer *l, const char *oldpath, const char *newpath, in
babf31
 static void
babf31
 ovl_link (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newname)
babf31
 {
babf31
+  /*
babf31
+     There is an issue on RHEL 8.1 where the nlink counter is always
babf31
+     incremented by one, no matter what is specified in e.attr.st_nlink.
babf31
+     In this function we always set timeout to 0 to force a new stat on the inode.
babf31
+   */
babf31
+
babf31
   cleanup_lock int l = enter_big_lock ();
babf31
   struct ovl_data *lo = ovl_data (req);
babf31
   struct ovl_node *node, *newparentnode, *destnode;
babf31
@@ -3809,7 +3815,8 @@ ovl_link (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newn
babf31
 
babf31
   e.ino = node_to_inode (node);
babf31
   node->ino->lookups++;
babf31
-  e.attr_timeout = get_timeout (lo);
babf31
+
babf31
+  e.attr_timeout = 0;
babf31
   e.entry_timeout = get_timeout (lo);
babf31
   fuse_reply_entry (req, &e);
babf31
 }
babf31
-- 
babf31
2.24.1
babf31