tgid fixes for filp->f_owner.pid assignments
Subsystems (5)
PATCH 1/1 tgid fixes for filp->f_owner.pid assignments
Shouldn't the f_owner.pid of the "file" structure hold the process id ("tgid" field of task_struct) as opposed to the thread id ("pid" field of task_struct)?
If agreed, the patch below fixes the obvious places. It seems to be used for determining how to post SIGIO signals. With current code, in a multi-threaded process, I think only the thread arming the SIGIO gets the signal, whereas it seems that the whole thread group should be signaled.
This has only been compile-tested.
Cheers. -ernie
Signed-off-by Ernie Petrides <[email protected]>
drivers/char/tty_io.c renamed from drivers/char/tty_io.c.orig +1 -1
@@ -2697,7 +2697,7 @@ static int tty_fasync(int fd, struct filif (on) {if (!waitqueue_active (&tty->read_wait)) tty->minimum_to_wake =1 ; - retval =f_setown (filp, (-tty->pgrp) ? : current->pid,0 ); + retval =f_setown (filp, (-tty->pgrp) ? : current->tgid,0 );if (retval)return retval; }else {
drivers/net/tun.c renamed from drivers/net/tun.c.orig +1 -1
@@ -697,7 +697,7 @@ static int tun_chr_fasync(int fd, structreturn ret;if (on) { - ret =__f_setown (file,task_pid (current),PIDTYPE_PID ,0 ); + ret =__f_setown (file,task_tgid (current),PIDTYPE_PID ,0 );if (ret)return ret; tun->flags |=TUN_FASYNC ;
fs/locks.c renamed from fs/locks.c.orig +1 -1
@@ -1514,7 +1514,7 @@ int fcntl_setlease(unsigned int fd, stru goto out_unlock; } - error =__f_setown (filp,task_pid (current),PIDTYPE_PID ,0 ); + error =__f_setown (filp,task_tgid (current),PIDTYPE_PID ,0 ); out_unlock:unlock_kernel ();return error;
fs/dnotify.c renamed from fs/dnotify.c.orig +1 -1
@@ -92,7 +92,7 @@ int fcntl_dirnotify(int fd, struct file prev = &odn->dn_next; } - error =__f_setown (filp,task_pid (current),PIDTYPE_PID ,0 ); + error =__f_setown (filp,task_tgid (current),PIDTYPE_PID ,0 );if (error) goto out_free;
kernel/futex.c renamed from kernel/futex.c.orig +1 -1
@@ -1534,7 +1534,7 @@ static int futex_fd(u32 __user *uaddr, i filp->f_mapping = filp->f_dentry->d_inode->i_mapping;if (signal) { - err =__f_setown (filp,task_pid (current),PIDTYPE_PID ,1 ); + err =__f_setown (filp,task_tgid (current),PIDTYPE_PID ,1 );if (err <0 ) { goto error; }