Skip to content

portal_devfs: don't install cdev-only poll/write proxies on anon/sock files#80

Merged
lacraig2 merged 1 commit into
mainfrom
fix/anonfs-sock-write-proxy
Jun 19, 2026
Merged

portal_devfs: don't install cdev-only poll/write proxies on anon/sock files#80
lacraig2 merged 1 commit into
mainfrom
fix/anonfs-sock-write-proxy

Conversation

@lacraig2

Copy link
Copy Markdown
Contributor

Problem

The issue #77 / #78 poll & write proxies (igloo_devfs_proxy_poll, igloo_devfs_proxy_write) resolve their tracking struct with container_of(inode->i_cdev, struct portal_devfs_entry, cdev) — they are char-device-only.

#78 installed them inside the shared igloo_convert_ops_to_fops(), but that converter is also called by portal_anon.c (handle_op_anonfs_create_file / sockfs) to build fops for anon inodes and sockets, which have no cdev (inode->i_cdev == NULL). As a result igloo_devfs_proxy_write hits if (!inode->i_cdev) return -ENODEV; and every write to an anon file or socket fails with ENODEV.

This surfaced as the anonfs unit tests (anonfs_test_pass/_counter/_socket) going red on every arch the moment a tree pins driver 0.0.81 (e.g. penguin #845, and it will hit anyone bumping past 0.0.80). echo 5 > /tmp/anon_counter fails, the set -eux script aborts before PASS. Pre-0.0.81 the converter set out->write = ops->write directly, so anon/sock writes worked.

Fix

Keep the shared converter on the direct Python-modeled write/poll, and install the cdev-only proxies only in the char-device create path (handle_op_devfs_create_device), where the cdev and poll_wq actually exist. The #77 blocking-poll + wake-on-write behavior for char devices is unchanged. Block devices call python_write directly via queue_rq, so they don't need the proxy either.

Net diff: one file, src/portal/portal_devfs.c.

Follow-up

Once merged and 0.0.82 is released, penguin #845 will be re-pinned 0.0.81 → 0.0.82 (restores anonfs green there).

… files

The issue #77 poll/write proxies (igloo_devfs_proxy_poll/_write) resolve their
portal_devfs_entry via container_of(inode->i_cdev, ...). They are only valid for
char devices. They were installed in the shared igloo_convert_ops_to_fops(),
which portal_anon.c also uses to build fops for anon inodes and sockets. Those
files have no cdev (inode->i_cdev == NULL), so igloo_devfs_proxy_write returned
-ENODEV for every write to an anon/sock file -- breaking the anonfs/sockfs tests
once a tree moved to the 0.0.81 driver.

Keep the shared converter on the direct Python-modeled write/poll, and install
the proxies only in the char-device create path, where the cdev and poll_wq
exist. Block devices invoke python_write directly via queue_rq, so they don't
need the proxy either.
@lacraig2 lacraig2 merged commit 1086457 into main Jun 19, 2026
1 check passed
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.

1 participant