public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: FORT David <popo.enlighted@free.fr>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Alexander Viro <aviro@redhat.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Stephen Tweedie <sct@redhat.com>
Subject: [PATCH] Re: Oops on 2.4.13
Date: Fri, 2 Nov 2001 18:48:43 +0000	[thread overview]
Message-ID: <20011102184843.B6984@redhat.com> (raw)
In-Reply-To: <3BE1C260.2010507@free.fr>
In-Reply-To: <3BE1C260.2010507@free.fr>; from popo.enlighted@free.fr on Thu, Nov 01, 2001 at 04:45:04PM -0500

Hi,

On Thu, Nov 01, 2001 at 04:45:04PM -0500, FORT David wrote:

> >>EIP; c013c7e4 <cdput+4/40>   <=====
> Trace; c0149840 <clear_inode+c0/e0>
> Trace; c0148bcc <destroy_inode+2c/40>

In your case you appear to have a bit-flip in inode->i_cdev (which
contains 0x00008000).  It could be pretty much any thing causing
that... but the locking in cdput is still suspect:

	void cdput(struct char_device *cdev)
	{
		if (atomic_dec_and_test(&cdev->count)) {
			spin_lock(&cdev_lock);

lets somebody else elevate the cdev->count before we get the lock, and
we'll proceed to destroy the cdev which is now in use again.

Al already fixed this for bdput, but it looks like we need

--- linux-2.4.14-pre6/fs/char_dev.c.~1~	Tue May 22 17:35:42 2001
+++ linux-2.4.14-pre6/fs/char_dev.c	Fri Nov  2 00:49:55 2001
@@ -104,8 +104,7 @@
 
 void cdput(struct char_device *cdev)
 {
-	if (atomic_dec_and_test(&cdev->count)) {
-		spin_lock(&cdev_lock);
+	if (atomic_dec_and_lock(&cdev->count, &cdev_lock)) {
 		list_del(&cdev->hash);
 		spin_unlock(&cdev_lock);
 		destroy_cdev(cdev);

for cdput too (compiled but not tested).  I'm not 100% convinced this
is the problem you're seeing, though.

Cheers,
 Stephen


      parent reply	other threads:[~2001-11-02 18:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-01 21:45 Oops on 2.4.13 FORT David
2001-11-01 22:52 ` Keith Owens
2001-11-02  6:52   ` FORT David
2001-11-02  2:02     ` Keith Owens
2001-11-02 13:00   ` David Chow
2001-11-02  1:39     ` Keith Owens
2001-11-02 18:48 ` Stephen C. Tweedie [this message]

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=20011102184843.B6984@redhat.com \
    --to=sct@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=aviro@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=popo.enlighted@free.fr \
    --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