• Christian Brauner's avatar
    backing file: free directly · 6cf41fcf
    Christian Brauner authored
    Backing files as used by overlayfs are never installed into file
    descriptor tables and are explicitly documented as such. They aren't
    subject to rcu access conditions like regular files are.
    
    Their lifetime is bound to the lifetime of the overlayfs file, i.e.,
    they're stashed in ovl_file->private_data and go away otherwise. If
    they're set as vma->vm_file - which is their main purpose - then they're
    subject to regular refcount rules and vma->vm_file can't be installed
    into an fdtable after having been set. All in all I don't see any need
    for rcu delay here. So free it directly.
    
    This all hinges on such hybrid beasts to never actually be installed
    into fdtables which - as mentioned before - is not allowed. So add an
    explicit WARN_ON_ONCE() so we catch any case where someone is suddenly
    trying to install one of those things into a file descriptor table so we
    can have a nice long chat with them.
    
    Link: https://lore.kernel.org/r/20231005-sakralbau-wappnen-f5c31755ed70@braunerAcked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    6cf41fcf
file.c 34.8 KB