fusefrontend: -sharedstorage: fix TestRmwRace failure
The Open() and Create() paths used different inode numbers, which broke openfiletable locking against concurred readers.
This commit is contained in:
parent
692a79461a
commit
47a4d33f24
@ -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.
|
||||
|
@ -100,7 +100,8 @@ func (n *Node) prepareAtSyscall(child string) (dirfd int, cName string, errno sy
|
||||
}
|
||||
|
||||
// newChild attaches a new child inode to n.
|
||||
// The passed-in `st` will be modified to get a unique inode number.
|
||||
// The passed-in `st` will be modified to get a unique inode number
|
||||
// (or, in `-sharedstorage` mode, the inode number will be set to zero).
|
||||
func (n *Node) newChild(ctx context.Context, st *syscall.Stat_t, out *fuse.EntryOut) *fs.Inode {
|
||||
rn := n.rootNode()
|
||||
// Get stable inode number based on underlying (device,ino) pair
|
||||
|
Loading…
Reference in New Issue
Block a user