On Fri, Jun 16, 2023 at 1:28 PM Christian Brauner <brauner@xxxxxxxxxx> wrote: > > Cleanup sb->s_fs_info when ovl_fill_super() fails before setting > sb->s_root. 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. > > Amir reported an issue when running xfstests overlay/037 which made me > investigate and detect this. > > Fixes: fc0dc3a9b73b ("ovl: port to new mount api") > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> > --- > > --- > I would just fold this into ("ovl: port to new mount api"). The patch > here is mostly so we have a track record of the issue. Folder (with commit message) and applied to https://github.com/amir73il/linux/commits/fs-overlayfs-mount_api I've split out two prep patches, so "port to new mount api" patch is now as clean as it can be. > > Passes both > > sudo ./check -overlay overlay/* > sudo ./check -overlay -g overlay/union > > I somehow must've missed the earlier failure of overlay/037. No failures on my tests so far. Thanks! Amir.