From: Jamie Lokier <jamie@shareable.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] set sigio target to current->pid and only if not already set
Date: Thu, 9 Oct 2003 02:52:32 +0100 [thread overview]
Message-ID: <20031009015232.GA18112@mail.shareable.org> (raw)
Patch: f_setown-2.6.0-test6.patch
Dear Linus,
Two minor changes:
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.
Please apply.
-- Jamie
diff -urN --exclude-from=dontdiff orig-2.6.0-test6/fs/dnotify.c f_setown-2.6.0-test6/fs/dnotify.c
--- orig-2.6.0-test6/fs/dnotify.c 2003-09-13 21:21:25.000000000 +0100
+++ f_setown-2.6.0-test6/fs/dnotify.c 2003-10-09 01:49:13.000000000 +0100
@@ -92,7 +92,7 @@
prev = &odn->dn_next;
}
- error = f_setown(filp, current->tgid, 1);
+ error = f_setown(filp, current->pid, 0);
if (error)
goto out_free;
diff -urN --exclude-from=dontdiff orig-2.6.0-test6/fs/locks.c f_setown-2.6.0-test6/fs/locks.c
--- orig-2.6.0-test6/fs/locks.c 2003-09-30 05:40:50.000000000 +0100
+++ f_setown-2.6.0-test6/fs/locks.c 2003-10-09 01:49:37.000000000 +0100
@@ -1268,7 +1268,7 @@
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;
diff -urN --exclude-from=dontdiff orig-2.6.0-test6/kernel/futex.c f_setown-2.6.0-test6/kernel/futex.c
--- orig-2.6.0-test6/kernel/futex.c 2003-09-30 05:41:14.000000000 +0100
+++ f_setown-2.6.0-test6/kernel/futex.c 2003-10-09 01:52:37.000000000 +0100
@@ -500,7 +500,7 @@
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);
reply other threads:[~2003-10-09 1:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031009015232.GA18112@mail.shareable.org \
--to=jamie@shareable.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox