From: Kris Van Hees <kris.van.hees@oracle.com>
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 6/6] dtprobed: fix dof_stash write failure handling
Date: Fri, 12 Jun 2026 16:22:15 +0000 [thread overview]
Message-ID: <35c653a0b4b57ad6c2a7faef8268e046@oracle.com> (raw)
Use ssize_t for write() results, retry interrupted writes without treating
the negative length as progress, and unwind through the provider-close
path if writing parsed DOF fails. Replace the no-op assert(1) in the
corrupt-state path with abort().
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
dtprobed/dof_stash.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dtprobed/dof_stash.c b/dtprobed/dof_stash.c
index 6e62bdf6..144cc98d 100644
--- a/dtprobed/dof_stash.c
+++ b/dtprobed/dof_stash.c
@@ -420,10 +420,14 @@ write_chunk(int fd, const void *buf, size_t size)
char *bufptr = (char *) buf;
while (size > 0) {
- size_t len;
+ ssize_t len;
- if ((len = write(fd, bufptr, size)) < 0 && errno != EINTR)
- return -1;
+ if ((len = write(fd, bufptr, size)) < 0) {
+ if (errno != EINTR)
+ return -1;
+ else
+ continue;
+ }
size -= len;
bufptr += len;
@@ -796,7 +800,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
state = accump->parsed->type;
if (write_chunk(parsed_fd, accump->parsed, accump->parsed->size) < 0)
- goto err_probe_link;
+ goto err_provider_close;
break;
/* Error return from parser. */
@@ -817,7 +821,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
*/
fuse_log(FUSE_LOG_ERR, "dtprobed: PID %i, %lx/%lx: internal error: corrupt parsed DOF: type %i\n",
pid, dev, ino, accump->parsed->type);
- assert(1);
+ abort();
}
free(parsedfn);
--
2.47.3
reply other threads:[~2026-06-12 16:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35c653a0b4b57ad6c2a7faef8268e046@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox