• Jakob Unterwurzacher's avatar
    fs: addNewChild(): handle concurrent FORGETs · 68f70527
    Jakob Unterwurzacher authored
    As seen in debug logs like shown below, concurrent
    FORGETs and inode number reuse could make use give
    an Inode to the kernel that has already been deleted
    from the nodes[] map.
    
    With this change, I can no langer trigger a panic
    in xfstests generic/007.
    
    Fixes https://github.com/hanwen/go-fuse/issues/324
    
    Nodes that appear to change type are not handled yet
    (actually caused by inode number reuse), but this is
    a separate problem.
    
    Debug log:
    
      17:09:07.651735 rx 84444: CREATE i13632136 {0100644 [WRONLY,TRUNC,CREAT,0x8000] (022)} ["XXXXXXXXXXXX.38"] 16b
      17:09:07.651790 tx 84444:     OK, {i13632483 g1 {M0100644 SZ=0 L=1 0:0 B0*4096 i0:13632483 A 1572192547.650470 M 1572192547.650470 C 1572192547.650470} &{7 0 0}}
      [...]
      17:09:07.684439 rx 87988: CREATE i13632119 {0100644 [CREAT,TRUNC,WRONLY,0x8000] (022)} ["XXXXXXXXXXXX.37"] 16b
      [...]
      17:09:07.684472 rx 87992: FORGET i13632483 {Nlookup=1}
      17:09:07.684483 tx 87988:     OK, {i13632483 g1 {M0100644 SZ=0 L=1 0:0 B0*4096 i0:13632483 A 1572192547.683470 M 1572192547.683470 C 1572192547.683470} &{8 0 0}}
      [...]
      17:09:07.684557 rx 88006: FLUSH i13632483 {Fh 8}
      17:09:07.684560 unknown node 13632483
      17:09:07.684564 tx 88002:     OK,  "XXXXXXXXXXXX.830"
      panic: unknown node 13632483
    
    Change-Id: Ibb1a7a6a459d2e4133a4e512e0816e8ed950a8d7
    68f70527
inode.go 18.9 KB