HomeFreeBSD

fusefs: correctly handle an inode that changes file types

Description

fusefs: correctly handle an inode that changes file types

Correctly handle the situation where a FUSE server unlinks a file, then
creates a new file of a different type but with the same inode number.
Previously fuse_vnop_lookup in this situation would return EAGAIN. But
since it didn't call vgone(), the vnode couldn't be reused right away.
Fix this by immediately calling vgone() and reallocating a new vnode.

This problem can occur in three code paths, during VOP_LOOKUP,
VOP_SETATTR, or following FUSE_GETATTR, which usually happens during
VOP_GETATTR but can occur during other vops, too. Note that the correct
response actually doesn't depend on whether the entry cache has expired.
In fact, during VOP_LOOKUP, we can't even tell. Either it has expired
already, or else the vnode got reclaimed by vnlru.

Also, correct the error code during the VOP_SETATTR path.

PR: 258022
Reported by: chogata@moosefs.pro
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D33283

(cherry picked from commit 25927e068fcbcac0a5111a881de723bd984b04b3)

Details

Provenance
asomersAuthored on Dec 6 2021, 5:43 AM
Reviewer
pfg
Differential Revision
D33283: fusefs: correctly handle an inode that changes file types
Parents
rG2472f847281a: fusefs: better debugging for FUSE_RENAME in the tests
Branches
Unknown
Tags
Unknown