• Tejun Heo's avatar
    kernfs: fix ino wrap-around detection · e23f568a
    Tejun Heo authored
    When the 32bit ino wraps around, kernfs increments the generation
    number to distinguish reused ino instances.  The wrap-around detection
    tests whether the allocated ino is lower than what the cursor but the
    cursor is pointing to the next ino to allocate so the condition never
    triggers.
    
    Fix it by remembering the last ino and comparing against that.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Fixes: 4a3ef68a ("kernfs: implement i_generation")
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: stable@vger.kernel.org # v4.14+
    e23f568a
dir.c 42.4 KB