From: Kari Hurtta <hurtta@leija.mh.fmi.fi>
To: rgooch@atnf.csiro.au
Cc: linux-kernel@vger.kernel.org
Subject: [2.4.13] [devfs 0.119 (20011009)] base.c: devfsd_ioctl
Date: Sun, 28 Oct 2001 14:03:54 +0200 (EET) [thread overview]
Message-ID: <200110281203.f9SC3soW005371@leija.fmi.fi> (raw)
Can you say where I have wrong?
Code on devfsd_ioctl() [base.c]:
if (fs_info->devfsd_task == NULL)
{
if ( !spin_trylock (&lock) ) return -EBUSY;
fs_info->devfsd_task = current;
spin_unlock (&lock);
To me that spinlock looks like it is useless.
Either
1) If it is mean that lock protects two CPUs settting
fs_info->devfsd_task when another is set it,
then test about fs_info->devfsd_task == NULL
should be inside of locked code
or 2) this is protected with some other lock as comment
perhaps indicates:
/* Ensure only one reader has access to the queue. This scheme will
work even if the global kernel lock were to be removed, because it
doesn't matter who gets in first, as long as only one gets it
*/
if (fs_info->devfsd_task == NULL)
{
if ( !spin_trylock (&lock) ) return -EBUSY;
Should this be:
--- fs/devfs/base.c.old Thu Oct 11 09:23:24 2001
+++ fs/devfs/base.c Sun Oct 28 14:59:03 2001
@@ -3227,6 +3227,11 @@
if (fs_info->devfsd_task == NULL)
{
if ( !spin_trylock (&lock) ) return -EBUSY;
+ if (fs_info->devfsd_task != NULL) {
+ /* We lost race ... */
+ spin_unlock (&lock);
+ return -EBUSY;
+ }
fs_info->devfsd_task = current;
spin_unlock (&lock);
fs_info->devfsd_file = file;
--
/"\ | Kari
\ / ASCII Ribbon Campaign | Hurtta
X Against HTML Mail |
/ \ |
next reply other threads:[~2001-10-28 12:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-28 12:03 Kari Hurtta [this message]
2001-10-29 5:22 ` Richard Gooch
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=200110281203.f9SC3soW005371@leija.fmi.fi \
--to=hurtta@leija.mh.fmi.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=rgooch@atnf.csiro.au \
/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
all inboxes | Powered by JetHome®