]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zfs_ioctl.c
Fix zfs send progress reporting
authorMatthew Ahrens <mahrens@delphix.com>
Mon, 20 Apr 2020 17:12:48 +0000 (10:12 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Apr 2020 17:12:48 +0000 (10:12 -0700)
commit1f043c8be1bf575bae1088f150cf17b35184ad12
tree8d34f8ded3fff070305ef1fe06df98f915717f2c
parentc614fd6e12c0fe2636a82b341e9ab9d150ee3c8a
Fix zfs send progress reporting

The progress of a send is supposed to be reported by `zfs send -v`, but
it is not.  This works by creating a new user thread (with
pthread_create()) which does ZFS_IOC_SEND_PROGRESS ioctls to check how
much progress has been made.  This IOCTL finds the specified send (since
there may be multiple concurrent sends in the system).  The IOCTL also
checks that the specified send was started by the current process.

On Linux, different threads of the same process are represented as
different `struct task_struct`s (and, confusingly, have different
PID's).  To check if if two threads are in the same process, we need to
check if they have the same `struct task_struct:group_leader`.

We used to to this correctly, but it was inadvertently changed by
30af21b02569 (Redacted Send) to simply check if the current
`struct task_struct` is the one that started the send.

This commit changes the code back to checking if the send was started by
a `struct task_struct` with the same `group_leader` as the calling
thread.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Chris Wedgwood <cw@f00f.org>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #10215
Closes #10216
include/os/freebsd/spl/sys/proc.h
include/os/linux/spl/sys/proc.h
module/zfs/zfs_ioctl.c