<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2025/12/26 14:57, Gao Xiang wrote:<br>
</div>
<blockquote type="cite"
cite="mid:706b0839-ab0f-4f66-959e-74152a4e1243@linux.alibaba.com">
<br>
<br>
On 2025/12/23 18:04, Yifan Zhao wrote:
<br>
<blockquote type="cite">From: Yifan Zhao
<a class="moz-txt-link-rfc2396E" href="mailto:yifan.yfzhao@foxmail.com"><yifan.yfzhao@foxmail.com></a>
<br>
<br>
The current NBD connection logic has the following issues:
<br>
<br>
1.It first tries netlink (forking a child), then falls back to
ioctl
<br>
(forking another), causing redundant process overhead and
double-opening
<br>
of erofs_nbd_source on fallback.
<br>
</blockquote>
<br>
But I don't want to open source on the main process. Especially
if we'd
<br>
like to trigger multiple layers.
<br>
<br>
If you really want to optimize this, how about just forking one
child
<br>
process for both netlink and ioctl, and opening erofs_nbd_source
in
<br>
the child process too. <br>
<br>
</blockquote>
yeah, this is exactly what this patchset did, one child for both
netlink and ioctl.
<blockquote type="cite"
cite="mid:706b0839-ab0f-4f66-959e-74152a4e1243@linux.alibaba.com">
<blockquote type="cite">2.Child processes fail silently, hiding
the error cause from the parent
<br>
and confusing users.
<br>
3.erofsmount_startnbd() doesn’t ignore SIGPIPE, causing
nbd_loopfn to be
<br>
killed abruptly without clean up during disconnect.
<br>
4.During disconnect, -EPIPE from NBD socket I/O is expected, but
<br>
erofsmount_nbd_loopfn() does not suppress it, leading to
uncessary
<br>
"NBD worker failed with EPIPE" message printed in
erofsmount_startnbd().
<br>
</blockquote>
<br>
Could we address these issues independently?</blockquote>
<p>Fixing issue 2 is limited by the current thread model (previous
'double error print') problem.</p>
<p>Issue 3 & 4 <span
style="color: rgb(29, 29, 31); font-family: system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, Inter, NotoSansHans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">are almost identical; however, fixing them under the current codebase would</span></p>
<p><span
style="color: rgb(29, 29, 31); font-family: system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, Inter, NotoSansHans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">require additional modifications after this patch is merged. That’s why I’ve included them in</span></p>
<p><span
style="color: rgb(29, 29, 31); font-family: system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, Inter, NotoSansHans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">this patch. I believe they could alternatively be deferred and addressed separately in a subsequent patch.</span></p>
<p><span
style="color: rgb(29, 29, 31); font-family: system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, Inter, NotoSansHans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">
</span></p>
<p><span
style="color: rgb(29, 29, 31); font-family: system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, Inter, NotoSansHans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Thanks,</span></p>
<p><span
style="color: rgb(29, 29, 31); font-family: system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, Inter, NotoSansHans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Yifan</span></p>
<blockquote type="cite"
cite="mid:706b0839-ab0f-4f66-959e-74152a4e1243@linux.alibaba.com"> <br>
Thanks,
<br>
Gao Xiang
<br>
<br>
<blockquote type="cite">
<br>
This patch consolidates the netlink and ioctl fallback logic
into a
<br>
single child process, eliminating redundant erofs_nbd_source
opens. It
<br>
also ensure SIGPIPE and -EPIPE are properly suppressed during
disconnect
<br>
in erofsmount_nbd_loopfn(), enabling cleanup and graceful exit.
<br>
Additionally, the child process now reports error code via
exit() for
<br>
better user visibility.
<br>
<br>
Signed-off-by: Yifan Zhao <a class="moz-txt-link-rfc2396E" href="mailto:zhaoyifan28@huawei.com"><zhaoyifan28@huawei.com></a>
<br>
</blockquote>
<br>
</blockquote>
</body>
</html>