Skip to content

Commit b1acfeb

Browse files
vfs: fix some log spam if an fd is closed after unlinking (#9102)
We try to refresh attributes when a file is closed but the backing file won't be there if unlink is called first.
1 parent 8dfe042 commit b1acfeb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

enterprise/server/util/vfs_server/vfs_server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,12 +997,15 @@ func (p *Server) Open(ctx context.Context, request *vfspb.OpenRequest) (*vfspb.O
997997
return nil, syscallErrStatus(err)
998998
}
999999
openedFile = f
1000-
} else {
1000+
} else if node.fileNode != nil {
10011001
f, err := p.casFetcher.Open(p.taskCtx(), node)
10021002
if err != nil {
10031003
return nil, err
10041004
}
10051005
openedFile = f
1006+
} else {
1007+
log.CtxWarningf(p.taskCtx(), "Open called on an unlinked node %q", node.Path())
1008+
return nil, syscallErrStatus(syscall.EINVAL)
10061009
}
10071010

10081011
fh := &fileHandle{
@@ -1389,6 +1392,7 @@ func unlink(parentNode *fsNode, childNode *fsNode, childName string) error {
13891392
childNode.mu.Unlock()
13901393
return syscallErrStatus(err)
13911394
}
1395+
childNode.backingPath = ""
13921396
childNode.server.mu.Lock()
13931397
childNode.server.blocks -= childNode.server.statBlocksToFSBlocks(childNode.attrs.Blocks)
13941398
childNode.server.mu.Unlock()

0 commit comments

Comments
 (0)