diff --git a/include/os/freebsd/spl/sys/proc.h b/include/os/freebsd/spl/sys/proc.h index fca833018ea..07201dd6a09 100644 --- a/include/os/freebsd/spl/sys/proc.h +++ b/include/os/freebsd/spl/sys/proc.h @@ -117,4 +117,11 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, int uread(proc_t *, void *, size_t, uintptr_t); int uwrite(proc_t *, void *, size_t, uintptr_t); + +static inline boolean_t +zfs_proc_is_caller(proc_t *p) +{ + return (p == curproc); +} + #endif /* _OPENSOLARIS_SYS_PROC_H_ */ diff --git a/include/os/linux/spl/sys/proc.h b/include/os/linux/spl/sys/proc.h index 28768392077..fefce515eb2 100644 --- a/include/os/linux/spl/sys/proc.h +++ b/include/os/linux/spl/sys/proc.h @@ -26,10 +26,17 @@ #define _SPL_PROC_H #include +#include extern struct proc_dir_entry *proc_spl_kstat; int spl_proc_init(void); void spl_proc_fini(void); +static inline boolean_t +zfs_proc_is_caller(struct task_struct *t) +{ + return (t->group_leader == current->group_leader); +} + #endif /* SPL_PROC_H */ diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index fb9435341db..5c53eb63779 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -5468,7 +5468,7 @@ zfs_ioc_send_progress(zfs_cmd_t *zc) for (dsp = list_head(&ds->ds_sendstreams); dsp != NULL; dsp = list_next(&ds->ds_sendstreams, dsp)) { if (dsp->dss_outfd == zc->zc_cookie && - dsp->dss_proc == curproc) + zfs_proc_is_caller(dsp->dss_proc)) break; }