aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-03-21 09:02:50 +0100
committerJakob Unterwurzacher2021-03-21 09:02:50 +0100
commit47a4d33f24509ac9db6b924f84a7102cbe0f98c3 (patch)
treea465cf393f767e2f082ee04c825724ed7c58cd99 /internal/fusefrontend/node.go
parent692a79461a7b0f60625ecf8b1a136bc6595f1273 (diff)
fusefrontend: -sharedstorage: fix TestRmwRace failure
The Open() and Create() paths used different inode numbers, which broke openfiletable locking against concurred readers.
Diffstat (limited to 'internal/fusefrontend/node.go')
-rw-r--r--internal/fusefrontend/node.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go
index 87ba835..2e5d370 100644
--- a/internal/fusefrontend/node.go
+++ b/internal/fusefrontend/node.go
@@ -130,10 +130,15 @@ func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint3
errno = fs.ToErrno(err)
return
}
+ // Save original stat values before newChild() translates the inode number.
+ // For an open fd, we assume the inode number cannot change behind our back,
+ // even in `-sharedstorage` mode.
+ origSt := st
+
ch := n.newChild(ctx, &st, out)
f := os.NewFile(uintptr(fd), cName)
- return ch, NewFile(f, rn, &st), 0, 0
+ return ch, NewFile(f, rn, &origSt), 0, 0
}
// Unlink - FUSE call. Delete a file.