Skip to content

Support Linux 7.3 - #99

Merged
jserv merged 2 commits into
sysprog21:masterfrom
EricKim27:master
Oct 11, 2026
Merged

jserv merged 2 commits into
sysprog21:masterfrom
EricKim27:master

Conversation

@EricKim27

@EricKim27 EricKim27 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

This set of patches adds support for linux 7.3, which has:

  • changed simplefs_create for inode_operations->create changes
  • changed get block device function in getting journal dev due to changes in fs_holder_ops' visibility

Summary by cubic

Adds support for Linux kernel 7.3 by adapting to two kernel API changes.

  • Dropped the unused excl argument from simplefs_create() and simplefs_mkdir(), matching the new inode_operations->create signature in 7.3.
  • Replaced bdev_file_open_by_dev() with fs_bdev_file_open_by_dev() for journal device opening since fs_holder_ops became private in 7.3.

Written for commit 6b3d061. Summary will update on new commits.

View guided diff

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread super.c
#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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@jserv
jserv merged commit c7c8714 into sysprog21:master Oct 11, 2026
4 checks passed
@jserv

jserv commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Thank @EricKim27 for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants