Message ID | 20230831053157.256319-2-hch@lst.de (mailing list archive) |
---|---|
State | Handled Elsewhere |
Delegated to: | Paul Moore |
Headers | show |
Series | [1/4] ramfs: free sb->s_fs_info after shutting down the super block | expand |
On Thu, Aug 31, 2023 at 07:31:54AM +0200, Christoph Hellwig wrote: > sb->s_fs_info can only be safely freed after generic_shutdown_super was > called and all access to the super_block has stopped. > > Thus only free the private data after calling kill_litter_super, which > calls generic_shutdown_super internally. Take a look at what ramfs uses that thing for. Remount and ->show_options(). Neither is an issue in ->kill_sb(). I don't really hate that patch, but commit message is flat-out incorrect in this case.
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index 18e8387cab4148..0f37ecbae59dad 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c @@ -280,8 +280,8 @@ int ramfs_init_fs_context(struct fs_context *fc) void ramfs_kill_sb(struct super_block *sb) { - kfree(sb->s_fs_info); kill_litter_super(sb); + kfree(sb->s_fs_info); } static struct file_system_type ramfs_fs_type = {
sb->s_fs_info can only be safely freed after generic_shutdown_super was called and all access to the super_block has stopped. Thus only free the private data after calling kill_litter_super, which calls generic_shutdown_super internally. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/ramfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)