• Kirill Smelkov's avatar
    Y wcfs: Switch to custom lsof · 4da6a16f
    Kirill Smelkov authored
    Previously when error on umount we were invoking lsof(8) to show list of
    files that are still opened on the filesystem. But lsof(8) turned out to
    be unreliable because it stats the filesystem and if e.g. wcfs server
    process is stopped lsof only prints
    
        WARNING:wcfs:# lsof /dev/shm/wcfs/1439df02dfcc41ab9dfb68e7ac4ad615f3b7d46e
        WARNING:wcfs:lsof: status error on /dev/shm/wcfs/1439df02dfcc41ab9dfb68e7ac4ad615f3b7d46e: Transport endpoint is not connected
        ...
        WARNING:wcfs:(lsof failed)
    
    fuser(1) from psmisc works a bit better: it can show list of still
    opened files on the mounted tree even if filesystem server is crashed.
    
    However with some version of fuser I still saw "Transport endpoint is
    not connected" once, and in the next patches we will also need to
    inspect "using" processes more, so if we are to use fuser we will need
    to parse its output which might get fragile.
    
    -> Do our own lsof utility instead.
    
    We have all the infrastructure in place to do so in the form of MountDB
    and ProcDB, and as implemented Mount.lsof() emits Proc'esses which can
    be inspected further conveniently. For now we do not do such inspection,
    but for `wcfs status` and `wcfs stop` we will want to poke with kernel
    tracebacks of those processes.
    4da6a16f
__init__.py 26.5 KB