diff options
| author | Tiwei Bie <tiwei.btw@antgroup.com> | 2025-03-19 21:55:21 +0800 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2025-03-20 09:26:38 +0100 |
| commit | d7f89a9da4328eee450d2e72631d1ec7e52976f0 (patch) | |
| tree | 1740868208e3142829437a72dc91225a29b5b074 /arch/um/drivers/ubd_user.c | |
| parent | 4f087eafdcef24b7160b097ddb9704084767b77a (diff) | |
um: ubd: Switch to the pthread-based helper
The ubd io thread and UML kernel thread share the same errno, which
can lead to conflicts when both call syscalls concurrently. Switch to
the pthread-based helper to address this issue.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20250319135523.97050-3-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'arch/um/drivers/ubd_user.c')
| -rw-r--r-- | arch/um/drivers/ubd_user.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c index b4f8b8e60564..c5e6545f6fcf 100644 --- a/arch/um/drivers/ubd_user.c +++ b/arch/um/drivers/ubd_user.c @@ -25,9 +25,9 @@ static struct pollfd kernel_pollfd; -int start_io_thread(unsigned long sp, int *fd_out) +int start_io_thread(struct os_helper_thread **td_out, int *fd_out) { - int pid, fds[2], err; + int fds[2], err; err = os_pipe(fds, 1, 1); if(err < 0){ @@ -47,14 +47,14 @@ int start_io_thread(unsigned long sp, int *fd_out) goto out_close; } - pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM, NULL); - if(pid < 0){ - err = -errno; - printk("start_io_thread - clone failed : errno = %d\n", errno); + err = os_run_helper_thread(td_out, io_thread, NULL); + if (err < 0) { + printk("%s - failed to run helper thread, err = %d\n", + __func__, -err); goto out_close; } - return(pid); + return 0; out_close: os_close_file(fds[0]); |