mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: "Philippe Gramoullé" <philippe.gramoulle@mmania.com>
Cc: linux-kernel@vger.kernel.org, greg@kroah.com
Subject: Re: 2.5.67-mm3: Bad: scheduling while atomic with IEEE1394 then hard freeze ( lockup on CPU0)
Date: Tue, 15 Apr 2003 16:34:56 -0700	[thread overview]
Message-ID: <20030415163456.020f83c1.akpm@digeo.com> (raw)
In-Reply-To: <20030416011728.196d66ca.philippe.gramoulle@mmania.com>

Philippe Gramoullé <philippe.gramoulle@mmania.com> wrote:
>
> I'll wait for the fix and will happily try it once it's available.

Something like this...

diff -puN lib/kobject.c~kobj_lock-fix lib/kobject.c
--- 25/lib/kobject.c~kobj_lock-fix	Tue Apr 15 16:31:28 2003
+++ 25-akpm/lib/kobject.c	Tue Apr 15 16:34:33 2003
@@ -336,12 +336,14 @@ void kobject_unregister(struct kobject *
 struct kobject * kobject_get(struct kobject * kobj)
 {
 	struct kobject * ret = kobj;
-	spin_lock(&kobj_lock);
+	unsigned long flags;
+
+	spin_lock_irqsave(&kobj_lock, flags);
 	if (kobj && atomic_read(&kobj->refcount) > 0)
 		atomic_inc(&kobj->refcount);
 	else
 		ret = NULL;
-	spin_unlock(&kobj_lock);
+	spin_unlock_irqrestore(&kobj_lock, flags);
 	return ret;
 }
 
@@ -371,10 +373,15 @@ void kobject_cleanup(struct kobject * ko
 
 void kobject_put(struct kobject * kobj)
 {
-	if (!atomic_dec_and_lock(&kobj->refcount, &kobj_lock))
-		return;
-	spin_unlock(&kobj_lock);
-	kobject_cleanup(kobj);
+	unsigned long flags;
+
+	local_irq_save(flags);
+	if (atomic_dec_and_lock(&kobj->refcount, &kobj_lock)) {
+		spin_unlock_irqrestore(&kobj_lock, flags);
+		kobject_cleanup(kobj);
+	} else {
+		local_irq_restore(flags);
+	}
 }
 
 

_


  reply	other threads:[~2003-04-15 23:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-15 22:05 Philippe Gramoullé
2003-04-15 23:05 ` Andrew Morton
2003-04-15 23:17   ` Philippe Gramoullé
2003-04-15 23:34     ` Andrew Morton [this message]
2003-04-16  5:54       ` Greg KH
2003-04-16 16:58         ` Patrick Mochel
2003-04-16 23:40           ` Philippe Gramoullé
2003-04-17  3:54             ` Greg KH
2003-04-16  0:49   ` Ben Collins
2003-04-16 16:45     ` Philippe Gramoullé
2003-04-16 17:32       ` Steve Kinneberg
2003-04-16 22:30         ` Philippe Gramoullé
2003-04-16 23:35           ` Steve Kinneberg
2003-04-16 23:52             ` Philippe Gramoullé
2003-04-17  2:48           ` Dan Maas
2003-04-16 18:09       ` Ben Collins
2003-04-18 18:51   ` Florin Iucha

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=20030415163456.020f83c1.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philippe.gramoulle@mmania.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

all inboxes | Powered by JetHome®