Repository navigation
Support Linux 7.3 - #99
Conversation
In linux kernel 7.3, inode_operations->create changed its argument to not have bool excl arguemnt because it is not used in all mainline linux source code base. Remove the excl argument for kernels higher than 7.3
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="super.c">
<violation number="1" location="super.c:270">
P2: `fs_bdev_file_open_by_dev()` registers a (device, superblock) claim entry and must be paired with `fs_bdev_file_release()`, but both cleanup paths still use the plain-file model: the `out_bdev:` error path calls bare `fput(bdev_file)` (line ~395) and `simplefs_put_super()` (line ~139) never releases `sbi->s_journal_bdev_file` at all. On the 7.3 path this leaks the claim entry and leaves the device-to-superblock table referencing a freed `struct super_block` after unmount, so later device removal/freeze/thaw propagation can hit a dangling pointer. Add a `SIMPLEFS_AT_LEAST(7, 3, 0)` branch that calls `fs_bdev_file_release(bdev_file, sb)` in `out_bdev:` and in `simplefs_put_super()` (and NULL out `sbi->s_journal_bdev_file`) before the generic 6.9 `fput`/sync paths.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| #if SIMPLEFS_AT_LEAST(6, 9, 0) | ||
| #if SIMPLEFS_AT_LEAST(7, 3, 0) | ||
| struct file *bdev_file; | ||
| bdev_file = fs_bdev_file_open_by_dev( |
There was a problem hiding this comment.
P2: fs_bdev_file_open_by_dev() registers a (device, superblock) claim entry and must be paired with fs_bdev_file_release(), but both cleanup paths still use the plain-file model: the out_bdev: error path calls bare fput(bdev_file) (line ~395) and simplefs_put_super() (line ~139) never releases sbi->s_journal_bdev_file at all. On the 7.3 path this leaks the claim entry and leaves the device-to-superblock table referencing a freed struct super_block after unmount, so later device removal/freeze/thaw propagation can hit a dangling pointer. Add a SIMPLEFS_AT_LEAST(7, 3, 0) branch that calls fs_bdev_file_release(bdev_file, sb) in out_bdev: and in simplefs_put_super() (and NULL out sbi->s_journal_bdev_file) before the generic 6.9 fput/sync paths.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At super.c, line 270:
<comment>`fs_bdev_file_open_by_dev()` registers a (device, superblock) claim entry and must be paired with `fs_bdev_file_release()`, but both cleanup paths still use the plain-file model: the `out_bdev:` error path calls bare `fput(bdev_file)` (line ~395) and `simplefs_put_super()` (line ~139) never releases `sbi->s_journal_bdev_file` at all. On the 7.3 path this leaks the claim entry and leaves the device-to-superblock table referencing a freed `struct super_block` after unmount, so later device removal/freeze/thaw propagation can hit a dangling pointer. Add a `SIMPLEFS_AT_LEAST(7, 3, 0)` branch that calls `fs_bdev_file_release(bdev_file, sb)` in `out_bdev:` and in `simplefs_put_super()` (and NULL out `sbi->s_journal_bdev_file`) before the generic 6.9 `fput`/sync paths.</comment>
<file context>
@@ -265,7 +265,12 @@ static journal_t *simplefs_get_dev_journal(struct super_block *sb,
-#if SIMPLEFS_AT_LEAST(6, 9, 0)
+#if SIMPLEFS_AT_LEAST(7, 3, 0)
+ struct file *bdev_file;
+ bdev_file = fs_bdev_file_open_by_dev(
+ journal_dev, BLK_OPEN_READ | BLK_OPEN_WRITE | BLK_OPEN_RESTRICT_WRITES,
+ sb, sb);
</file context>
Linux 7.3 removed extern fs_holder_ops and made
it private as filesystems can open and claim
block devices with fs_bdev_file_open_by_{dev,path}().
Replace bdev_file_open_by_dev() which requires
fs_holder_ops with fs_bdev_file_open_by_dev(),
which does not.
|
Thank @EricKim27 for contributing! |
This set of patches adds support for linux 7.3, which has:
Summary by cubic
Adds support for Linux kernel 7.3 by adapting to two kernel API changes.
exclargument fromsimplefs_create()andsimplefs_mkdir(), matching the newinode_operations->createsignature in 7.3.bdev_file_open_by_dev()withfs_bdev_file_open_by_dev()for journal device opening sincefs_holder_opsbecame private in 7.3.Written for commit 6b3d061. Summary will update on new commits.