• Han-Wen Nienhuys's avatar
    nodefs: introduce FileID, an ID type for persistent · 89a1a0c7
    Han-Wen Nienhuys authored
    identification
    
    This fixes another possible race condition if the same file is looked
    up through 2 different paths.
    
    Remove FindChildByOpaqueID(), since it is still susceptible to race
    conditions: two lookup calls might be racing, and both may see
    FindChildByOpaqueID == nil, creating two Node objects
    
    Instead, NewInode() automatically discards a new Node if it finds one
    with existing opaqueID.
    
    The FileID struct has (uint64,uint64) for Dev, Ino. While Dev
    typically is uint32 (the FUSE protocol has uint32), it is uint64
    analogous to syscall.Stat_t. The resulting 128 bits of ID space is
    also ample space for storing hashes of other IDs (eg strings)
    89a1a0c7
loopback.go 4.49 KB