• Christian Brauner's avatar
    ovl: port to new mount api · 1784fbc2
    Christian Brauner authored
    We recently ported util-linux to the new mount api. Now the mount(8)
    tool will by default use the new mount api. While trying hard to fall
    back to the old mount api gracefully there are still cases where we run
    into issues that are difficult to handle nicely.
    
    Now with mount(8) and libmount supporting the new mount api I expect an
    increase in the number of bug reports and issues we're going to see with
    filesystems that don't yet support the new mount api. So it's time we
    rectify this.
    
    When ovl_fill_super() fails before setting sb->s_root, we need to cleanup
    sb->s_fs_info.  The logic is a bit convoluted but tl;dr: If sget_fc() has
    succeeded fc->s_fs_info will have been transferred to sb->s_fs_info.
    So by the time ->fill_super()/ovl_fill_super() is called fc->s_fs_info
    is NULL consequently fs_context->free() won't call ovl_free_fs().
    
    If we fail before sb->s_root() is set then ->put_super() won't be called
    which would call ovl_free_fs(). IOW, if we fail in ->fill_super() before
    sb->s_root we have to clean it up.
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    1784fbc2
super.c 54.8 KB