Blob Blame History Raw
From bd0246fa31ae596fed3a7f94917523798e2ab3c8 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Sat, 15 Feb 2020 12:33:52 +0100
Subject: [PATCH] main: force timeout 0 for ovl_link

There is an issue on RHEL 8.1 where the nlink counter is always
incremented by one, no matter what is specified in e.attr.st_nlink.

Always set timeout to 0 to force a new stat on the inode.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1802907
Closes: https://github.com/containers/fuse-overlayfs/issues/183

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
---
 main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 80c0f89..0e6dab3 100644
--- a/main.c
+++ b/main.c
@@ -3714,6 +3714,12 @@ direct_linkat (struct ovl_layer *l, const char *oldpath, const char *newpath, in
 static void
 ovl_link (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newname)
 {
+  /*
+     There is an issue on RHEL 8.1 where the nlink counter is always
+     incremented by one, no matter what is specified in e.attr.st_nlink.
+     In this function we always set timeout to 0 to force a new stat on the inode.
+   */
+
   cleanup_lock int l = enter_big_lock ();
   struct ovl_data *lo = ovl_data (req);
   struct ovl_node *node, *newparentnode, *destnode;
@@ -3809,7 +3815,8 @@ ovl_link (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newn
 
   e.ino = node_to_inode (node);
   node->ino->lookups++;
-  e.attr_timeout = get_timeout (lo);
+
+  e.attr_timeout = 0;
   e.entry_timeout = get_timeout (lo);
   fuse_reply_entry (req, &e);
 }
-- 
2.24.1