From: David Howells <dhowells@redhat.com>
To: torvalds@transmeta.com, alan@redhat.com
Cc: linux-kernel@vger.kernel.org, dhowells@redhat.com
Subject: manipulating sigmask from filesystems and drivers
Date: Wed, 31 Jul 2002 12:52:43 +0100 [thread overview]
Message-ID: <15189.1028116363@warthog.cambridge.redhat.com> (raw)
Hi Linus, Alan,
Can you confirm that this is A Bad Thing(TM)? I've been poking around in the
OpenAFS filesystem driver, and it tries to achieve uninterruptible I/O waiting
by the following means:
/* CV_WAIT and CV_TIMEDWAIT rely on the fact that the Linux kernel has
* a global lock. Thus we can safely drop our locks before calling the
* kernel sleep services.
*/
static inline int CV_WAIT(afs_kcondvar_t *cv, afs_kmutex_t *l)
{
int isAFSGlocked = ISAFS_GLOCK();
sigset_t saved_set;
#ifdef DECLARE_WAITQUEUE
DECLARE_WAITQUEUE(wait, current);
#else
struct wait_queue wait = { current, NULL };
#endif
add_wait_queue((wait_queue_head_t *)cv, &wait);
set_current_state(TASK_INTERRUPTIBLE);
if (isAFSGlocked) AFS_GUNLOCK();
MUTEX_EXIT(l);
spin_lock_irq(¤t->sigmask_lock);
saved_set = current->blocked;
sigfillset(¤t->blocked);
recalc_sigpending(current);
spin_unlock_irq(¤t->sigmask_lock);
schedule();
remove_wait_queue(cv, &wait);
spin_lock_irq(¤t->sigmask_lock);
current->blocked = saved_set;
recalc_sigpending(current);
spin_unlock_irq(¤t->sigmask_lock);
if (isAFSGlocked) AFS_GLOCK();
MUTEX_ENTER(l);
return 0;
}
The reason for them doing this is so that they can get the process to appear
in the "S" state and thus avoid increasing the load average.
What I'm concerned about is that they wait for an event to happen by blocking
all signals (by accessing the process's signal masks directly) and then
sitting in TASK_INTERRUPTIBLE (which _mostly_ works, but ptrace(PTRACE_KILL)
can interrupt).
Can you comment on whether a driver is allowed to block signals like this, and
whether they should be waiting in TASK_UNINTERRUPTIBLE?
Cheers,
David
next reply other threads:[~2002-07-31 11:49 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-31 11:52 David Howells [this message]
2002-07-31 11:58 ` manipulating sigmask from filesystems and drivers Alan Cox
2002-08-01 19:09 ` Linus Torvalds
2002-08-01 20:10 ` David Woodhouse
2002-08-01 20:21 ` Linus Torvalds
2002-08-01 20:47 ` Roman Zippel
2002-08-01 20:51 ` Linus Torvalds
2002-08-01 21:15 ` Roman Zippel
2002-08-01 21:42 ` Linus Torvalds
2002-08-01 22:29 ` David Woodhouse
2002-08-01 22:40 ` Linus Torvalds
2002-08-01 22:50 ` David Woodhouse
2002-08-02 15:59 ` yodaiken
2002-08-01 22:35 ` Roman Zippel
2002-08-01 23:30 ` Linus Torvalds
2002-08-02 0:31 ` Olivier Galibert
2002-08-02 8:00 ` Kai Henningsen
2002-08-02 10:02 ` Roman Zippel
2002-08-02 12:38 ` Ryan Anderson
2002-08-02 15:39 ` Linus Torvalds
2002-08-02 16:00 ` Benjamin LaHaise
2002-08-02 16:27 ` Linus Torvalds
2002-08-02 17:13 ` Jamie Lokier
2002-08-02 17:29 ` Linus Torvalds
2002-08-02 17:57 ` Trond Myklebust
2002-08-02 18:10 ` Linus Torvalds
2002-08-02 17:33 ` Oliver Neukum
2002-08-03 18:27 ` David Woodhouse
2002-10-17 8:32 ` David Woodhouse
2002-08-02 19:27 ` Roman Zippel
2002-08-02 7:31 ` Giuliano Pochini
[not found] ` <mailman.1028232841.11555.linux-kernel2news@redhat.com>
2002-08-01 23:37 ` Pete Zaitcev
2002-08-01 23:46 ` David Woodhouse
[not found] <0C01A29FBAE24448A792F5C68F5EA47D2D3E2B@nasdaq.ms.ensim.com>
2002-08-02 17:57 ` Paul Menage
2002-08-02 23:25 ` Ryan Anderson
2002-08-02 23:30 ` Paul Menage
-- strict thread matches above, loose matches on Subject: below --
2002-08-02 18:24 Jesse Pollard
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=15189.1028116363@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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