Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2006 07:49:41 -0500
From:      Michael Butler <imb@protected-networks.net>
To:        GreenX FreeBSD <freebsd@azimut-tour.ru>
Cc:        freebsd-stable@freebsd.org, greenx@azimutprint.ru, sos@freebsd.org
Subject:   Re: panic: kmem_malloc
Message-ID:  <43D62265.8020401@protected-networks.net>
In-Reply-To: <43D5BBA3.8070606@azimut-tour.ru>
References:  <43D09224.2050304@azimut-tour.ru> <43D4EDDA.8060901@protected-networks.net> <43D5BBA3.8070606@azimut-tour.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070406000806020509060002
Content-Type: text/plain; charset=KOI8-R; format=flowed
Content-Transfer-Encoding: 7bit

GreenX FreeBSD wrote:

> #sysctl -a | grep ^ata
> ata_composit:    192,        0,  22663,    617,    65421
> ata_request:     200,        0,  45326,   1015,   468333

Right - this is a symptom of a memory leak in the ATA raid driver ..

> But, I little cvsup system.
> #uname -a
> FreeBSD crom.azimutprint.ru 6.0-STABLE FreeBSD 6.0-STABLE #0: Mon Jan 23 
> 11:18:32 MSK 2006     -skip-

  .. which has not been merged from current. It should look like ..

ITEM            SIZE     LIMIT     USED    FREE  REQUESTS
  [ .. ]
ata_composit:    196,        0,      0,    320,  2039342
ata_request:     200,        0,      0,    437,  9260705
                                    ^^^^

Use the attached patch until the fix is merged into 6.x,

Michael Butler, CISSP
Security Consultant
www.protected-networks.net

--------------070406000806020509060002
Content-Type: text/plain;
 name="ata-raid-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ata-raid-patch"

*** /usr/src/sys/dev/ata/ata-all.h.orig	Sun Nov 27 14:17:57 2005
--- /usr/src/sys/dev/ata/ata-all.h	Sun Nov 27 14:22:05 2005
***************
*** 331,336 ****
--- 331,337 ----
      u_int32_t           wr_depend;              /* write depends on subdisks */
      u_int32_t           wr_done;                /* done write subdisks */
      struct ata_request  *request[32];           /* size must match maps above */
+     long		count;			/* count required of this composite */
      caddr_t             data_1;     
      caddr_t             data_2;     
  };
*** ata-raid.c.orig	Mon Nov 28 18:02:01 2005
--- ata-raid.c	Mon Nov 28 22:52:53 2005
***************
*** 410,415 ****
--- 410,416 ----
  				mtx_init(&composite->lock,
  					 "ATA PseudoRAID rebuild lock",
  					 NULL, MTX_DEF);
+ 				composite->count = request->bytecount;
  				composite->rd_needed |= (1 << drv);
  				composite->wr_depend |= (1 << drv);
  				composite->wr_needed |= (1 << this);
***************
*** 468,473 ****
--- 469,475 ----
  				mtx_init(&composite->lock,
  					 "ATA PseudoRAID mirror lock",
  					 NULL, MTX_DEF);
+ 				composite->count = request->bytecount;
  				composite->wr_needed |= (1 << drv);
  				composite->wr_needed |= (1 << this);
  				composite->request[drv] = request;
***************
*** 607,613 ****
  			/* good data, update how far we've gotten */
  			else {
  			    bp->bio_resid -= request->donecount;
! 			    if (bp->bio_resid == 0) {
  				if (composite->wr_done & (1 << mirror))
  				    finished = 1;
  			    }
--- 609,616 ----
  			/* good data, update how far we've gotten */
  			else {
  			    bp->bio_resid -= request->donecount;
! 			    composite->count -= request->donecount;
! 			    if (composite->count == 0) {
  				if (composite->wr_done & (1 << mirror))
  				    finished = 1;
  			    }
***************
*** 621,627 ****
  				printf("DOH! rebuild failed\n"); /* XXX SOS */
  				rdp->rebuild_lba = blk;
  			    }
! 			    if (bp->bio_resid == 0)
  				finished = 1;
  			}
  		    }
--- 624,630 ----
  				printf("DOH! rebuild failed\n"); /* XXX SOS */
  				rdp->rebuild_lba = blk;
  			    }
! 			    if (composite->count == 0)
  				finished = 1;
  			}
  		    }
***************
*** 658,667 ****
  			    }
  			    bp->bio_resid -=
  				composite->request[mirror]->donecount;
  			}
! 			else
  			    bp->bio_resid -= request->donecount;
! 			if (bp->bio_resid == 0)
  			    finished = 1;
  		    }
  		    mtx_unlock(&composite->lock);
--- 661,674 ----
  			    }
  			    bp->bio_resid -=
  				composite->request[mirror]->donecount;
+ 			    composite->count -=
+ 				composite->request[mirror]->donecount;
  			}
! 			else {
  			    bp->bio_resid -= request->donecount;
! 			    composite->count -= request->donecount;
! 			}
! 			if (composite->count == 0)
  			    finished = 1;
  		    }
  		    mtx_unlock(&composite->lock);
***************
*** 723,729 ****
  	    rdp->status &= ~AR_S_REBUILDING;
  	    ata_raid_config_changed(rdp, 1);
  	}
! 	biodone(bp);
      }
  		 
      if (composite) {
--- 730,738 ----
  	    rdp->status &= ~AR_S_REBUILDING;
  	    ata_raid_config_changed(rdp, 1);
  	}
! 	/* cover the case of a series of composites which are only partly complete */
! 	if (bp->bio_resid == 0)
! 	    biodone(bp);
      }
  		 
      if (composite) {

--------------070406000806020509060002--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43D62265.8020401>