• Al Viro's avatar
    file: massage cleanup of files that failed to open · 7cb537b6
    Al Viro authored
    A file that has never gotten FMODE_OPENED will never have RCU-accessed
    references, its final fput() is equivalent to file_free() and if it
    doesn't have FMODE_BACKING either, it can be done from any context and
    won't need task_work treatment.
    
    Now that we have SLAB_TYPESAFE_BY_RCU we can simplify this and have
    other callers benefit. All of that can be achieved easier is to make
    fput() recoginze that case and call file_free() directly.
    
    No need to introduce a special primitive for that. It also allowed
    things like failing dentry_open() could benefit from that as well.
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    [Christian Brauner <brauner@kernel.org>: massage commit message]
    Link: https://lore.kernel.org/r/20231126020834.GC38156@ZenIVSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
    7cb537b6
file_table.c 12.4 KB