On 2025/12/23 18:04, Yifan Zhao wrote:
From: Yifan Zhao <[email protected]> The current NBD connection logic has the following issues: 1.It first tries netlink (forking a child), then falls back to ioctl (forking another), causing redundant process overhead and double-opening of erofs_nbd_source on fallback.
But I don't want to open source on the main process. Especially if we'd like to trigger multiple layers. If you really want to optimize this, how about just forking one child process for both netlink and ioctl, and opening erofs_nbd_source in the child process too.
2.Child processes fail silently, hiding the error cause from the parent and confusing users. 3.erofsmount_startnbd() doesn’t ignore SIGPIPE, causing nbd_loopfn to be killed abruptly without clean up during disconnect. 4.During disconnect, -EPIPE from NBD socket I/O is expected, but erofsmount_nbd_loopfn() does not suppress it, leading to uncessary "NBD worker failed with EPIPE" message printed in erofsmount_startnbd().
Could we address these issues independently? Thanks, Gao Xiang
This patch consolidates the netlink and ioctl fallback logic into a single child process, eliminating redundant erofs_nbd_source opens. It also ensure SIGPIPE and -EPIPE are properly suppressed during disconnect in erofsmount_nbd_loopfn(), enabling cleanup and graceful exit. Additionally, the child process now reports error code via exit() for better user visibility. Signed-off-by: Yifan Zhao <[email protected]>
