]> git.hungrycats.org Git - linux/commitdiff
[PATCH] set sigio target to current->pid and only if not already set
authorJamie Lokier <jamie@shareable.org>
Wed, 8 Oct 2003 11:59:16 +0000 (04:59 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 8 Oct 2003 11:59:16 +0000 (04:59 -0700)
1. send_sigio() sends to a specific thread, _not_ a process.
   (It can also send to a process group, but that's not relevant here).
   This is useful, and should stay as it is.

   Therefore it makes _no sense_ to call f_setown() with current->tgid.
   Presently the kernel is inconsistent about it, with some places using
   current->pid and some others using current->tgid.

   This patch changes f_setown() calls to use current->pid.

2. In some places, f_setown() is called not at the user's direct request,
   but as a side effect of another function.  Specifically: dnotify and
   file leases.

   It is good to allow a program the flexibility to specify a different
   pid than the default, using F_SETOWN.  Presently they can do this after
   the dnotify or lease call, but there is a small time window when it
   will be temporarily set to current->tgid (which as pointed out above,
   is not always right).

   The window is avoidable if the program can use F_SETOWN prior to the
   dnotify or lease call.  This is exactly what the "force" argument to
   f_setown() is for, and this patch changes it to zero in those callers.

   This change is not likely to affect any existing programs.

fs/dnotify.c
fs/locks.c
kernel/futex.c

index 4a385a71a487e15033c447523a32a4789208a711..f5eb816a814e8c9c1106c970e1024eabeffd3538 100644 (file)
@@ -93,7 +93,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
                prev = &odn->dn_next;
        }
 
-       error = f_setown(filp, current->tgid, 1);
+       error = f_setown(filp, current->pid, 0);
        if (error)
                goto out_free;
 
index 70176dc909ba7ee9748da9eaaabc2a922b96a3c1..6ba8af8a7f3862ecadeb3dc59a91e0f2ebfc9ff5 100644 (file)
@@ -1288,7 +1288,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
 
        locks_insert_lock(before, fl);
 
-       error = f_setown(filp, current->tgid, 1);
+       error = f_setown(filp, current->pid, 0);
 out_unlock:
        unlock_kernel();
        return error;
index db0a81a810dd0502f1ca9716a5ad6b7a890992cc..7b1e11a08257429a4ecf36d500b69f6c823e0114 100644 (file)
@@ -500,7 +500,7 @@ static int futex_fd(unsigned long uaddr, int signal)
 
        if (signal) {
                int err;
-               err = f_setown(filp, current->tgid, 1);
+               err = f_setown(filp, current->pid, 1);
                if (err < 0) {
                        put_unused_fd(ret);
                        put_filp(filp);