public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Clements <Paul.Clements@SteelEye.com>
To: Bernd Schubert <bernd.schubert@pci.uni-heidelberg.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [2.4.21]: nbd ksymoops-report
Date: Thu, 07 Aug 2003 13:34:49 -0400	[thread overview]
Message-ID: <3F328DB9.4EF38D9A@SteelEye.com> (raw)
In-Reply-To: Pine.LNX.4.10.10308071245130.13289-100000@clements.sc.steeleye.com

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

Paul Clements wrote:
> 
> On Thu, 7 Aug 2003, Bernd Schubert wrote:
> 
> > every time when nbd-client disconnects a nbd-device the decoded oops
> > from below will happen.
> > This only happens after we upgraded from 2.4.20 to 2.4.21,
> > so I guess the backported update from 2.5.50 causes this.

[snip]
 
> This corresponds to the following source:
> 
> lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN);
> 
> Somehow, lo->sock is NULL here. The only way I see that this could

Alright, looking back over the nbd-client source I now see what's going
on. You're calling "nbd-client -d" to manually disconnect?


> Would you be willing to test a patch against 2.4.21?

If you're willing to test the attached patch, I'd be grateful. Otherwise
I'll test it in the next few days and forward on to Marcelo...


Thanks,
Paul

[-- Attachment #2: nbd_sock_null_race_fix_2_4_21.diff --]
[-- Type: text/x-diff, Size: 1099 bytes --]

--- linux-2.4.21-PRISTINE/drivers/block/nbd.c	2003-06-13 10:51:32.000000000 -0400
+++ linux-2.4.21/drivers/block/nbd.c	2003-08-07 13:24:48.000000000 -0400
@@ -428,23 +428,24 @@ static int nbd_ioctl(struct inode *inode
                 return 0 ;
  
 	case NBD_CLEAR_SOCK:
+		error = 0;
+		down(&lo->tx_lock);
+		lo->sock = NULL;
+		up(&lo->tx_lock);
+		spin_lock(&lo->queue_lock);
+		file = lo->file;
+		lo->file = NULL;
+		spin_unlock(&lo->queue_lock);
 		nbd_clear_que(lo);
 		spin_lock(&lo->queue_lock);
 		if (!list_empty(&lo->queue_head)) {
-			spin_unlock(&lo->queue_lock);
-			printk(KERN_ERR "nbd: Some requests are in progress -> can not turn off.\n");
-			return -EBUSY;
+			printk(KERN_ERR "nbd: disconnect: some requests are in progress -> please try again.\n");
+			error = -EBUSY;
 		}
-		file = lo->file;
-		if (!file) {
-			spin_unlock(&lo->queue_lock);
-			return -EINVAL;
-		}
-		lo->file = NULL;
-		lo->sock = NULL;
 		spin_unlock(&lo->queue_lock);
-		fput(file);
-		return 0;
+		if (file)
+			fput(file);
+		return error;
 	case NBD_SET_SOCK:
 		if (lo->file)
 			return -EBUSY;

  reply	other threads:[~2003-08-07 17:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-07 14:04 [2.4.21]: nbd ksymoops-report Bernd Schubert
2003-08-07 14:46 ` Lou Langholtz
2003-08-07 16:53 ` Paul Clements
2003-08-07 17:34   ` Paul Clements [this message]
2003-08-07 18:40     ` Bernd Schubert
2003-08-07 18:45       ` Paul Clements
2003-08-07 22:25     ` Paul Clements
2003-08-08 13:10       ` Bernd Schubert
2003-08-07 17:40   ` Lou Langholtz

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=3F328DB9.4EF38D9A@SteelEye.com \
    --to=paul.clements@steeleye.com \
    --cc=bernd.schubert@pci.uni-heidelberg.de \
    --cc=linux-kernel@vger.kernel.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