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