portal_devfs: don't install cdev-only poll/write proxies on anon/sock files#80
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The issue #77 / #78 poll & write proxies (
igloo_devfs_proxy_poll,igloo_devfs_proxy_write) resolve their tracking struct withcontainer_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 byportal_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 resultigloo_devfs_proxy_writehitsif (!inode->i_cdev) return -ENODEV;and every write to an anon file or socket fails with ENODEV.This surfaced as the
anonfsunit 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_counterfails, theset -euxscript aborts beforePASS. Pre-0.0.81 the converter setout->write = ops->writedirectly, 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 thecdevandpoll_wqactually exist. The #77 blocking-poll + wake-on-write behavior for char devices is unchanged. Block devices callpython_writedirectly viaqueue_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).