]> git.ipfire.org Git - thirdparty/grub.git/commit
kern/file: Implement filesystem reference counting
authorB Horn <b@horn.uk>
Sun, 12 May 2024 09:15:03 +0000 (10:15 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 23 Jan 2025 15:22:47 +0000 (16:22 +0100)
commit16f196874fbe360a1b3c66064ec15adadf94c57b
treed9c0d582de5a7a29f886ad0d94295cdeac900ca1
parenta7910687294b29288ac649e71b47493c93294f17
kern/file: Implement filesystem reference counting

The grub_file_open() and grub_file_close() should be the only places
that allow a reference to a filesystem to stay open. So, add grub_dl_t
to grub_fs_t and set this in the GRUB_MOD_INIT() for each filesystem to
avoid issues when filesystems forget to do it themselves or do not track
their own references, e.g. squash4.

The fs_label(), fs_uuid(), fs_mtime() and fs_read() should all ref and
unref in the same function but it is essentially redundant in GRUB
single threaded model.

Signed-off-by: B Horn <b@horn.uk>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
31 files changed:
grub-core/fs/affs.c
grub-core/fs/bfs.c
grub-core/fs/btrfs.c
grub-core/fs/cbfs.c
grub-core/fs/cpio.c
grub-core/fs/cpio_be.c
grub-core/fs/erofs.c
grub-core/fs/ext2.c
grub-core/fs/f2fs.c
grub-core/fs/fat.c
grub-core/fs/hfs.c
grub-core/fs/hfsplus.c
grub-core/fs/iso9660.c
grub-core/fs/jfs.c
grub-core/fs/minix.c
grub-core/fs/newc.c
grub-core/fs/nilfs2.c
grub-core/fs/ntfs.c
grub-core/fs/odc.c
grub-core/fs/proc.c
grub-core/fs/reiserfs.c
grub-core/fs/romfs.c
grub-core/fs/sfs.c
grub-core/fs/squash4.c
grub-core/fs/tar.c
grub-core/fs/udf.c
grub-core/fs/ufs.c
grub-core/fs/xfs.c
grub-core/fs/zfs/zfs.c
grub-core/kern/file.c
include/grub/fs.h