Messages in this thread Patch in this message | | | Date | Thu, 07 Aug 2003 18:25:17 -0400 | From | Paul Clements <> | Subject | Re: [2.4.21]: nbd ksymoops-report |
| |
Paul Clements wrote: > > 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]
> > 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...
OK, the previous patch didn't quite do it. The attached should work (I got a chance to test it, finally).
Thanks, Pauldiff -up linux-2.4.21-PRISTINE/drivers/block/nbd.c linux-2.4.21/drivers/block/nbd.c --- 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 18:05:39.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; @@ -491,9 +492,12 @@ static int nbd_ioctl(struct inode *inode * there should be a more generic interface rather than * calling socket ops directly here */ down(&lo->tx_lock); - printk(KERN_WARNING "nbd: shutting down socket\n"); - lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); - lo->sock = NULL; + if (lo->sock) { + printk(KERN_WARNING "nbd: shutting down socket\n"); + lo->sock->ops->shutdown(lo->sock, + SEND_SHUTDOWN|RCV_SHUTDOWN); + lo->sock = NULL; + } up(&lo->tx_lock); spin_lock(&lo->queue_lock); file = lo->file; Common subdirectories: linux-2.4.21-PRISTINE/drivers/block/paride and linux-2.4.21/drivers/block/paride | |