ارتقي بدوراتنا التدريبية ميز نفسك وتحكم بمستقبلك
YX1YX2 X'YX#X/X'X! X'YYX*YX'X2Y YYX*X/X1Y X( ( X/X(Y ) Y YX/Y X/YX1X'X*Y X'YX*X/X1Y X(Y X) X'YX/YX1Y X) X'X3Y X'YX(X1YX'YX, X'YYYX'Y YY X%YY X'YYX8Y YX'YX%X*X,X'YX'X* X'YX-X/Y X+X) YY X%X/X'X1X) X'YYYX'X*X( YX'YX3YX1X*X'X1Y X) X'YX%YYX*X1YYY X) X'YYX'YX1X) / X/X(YYY 7/11/2010 11/11/2010 X/YX1 X'YX9YX'YX'X* X'YX9X'YX) YY X2Y X'X/X) YX9X'YY X) X'YYX$X*YX1X'X* YX'YYX9X'X1X6 X/X(YYY / X(Y X1YX* 7/11/2010 11/11/2010 YYX'X1X'X* X'YX*YX,Y Y YX'YX*X-YY X2 X'YYX9X'Y YYX#X/X'X! X'YYX*YY X2 YYY X'X/X) YX1Y X'YX9YY X/X(YYY / YYX/Y 7/11/2010 11/11/2010 X*X7X(Y Y X%X/X'X1X) X'YX,YX/X) X'YX4X'YYX) YYYX8YY X'YX*X/X1Y X( X'YYX'YX1X) / X/X(YYY 7/11/2010 11/11/2010 X7X(Y YX'X* X'YX-X'X3YX( YY YX,X'Y X%X/X'X1X) X'YYX3X*YX/X9X'X* YYX1X'YX(X) X'YYX.X2YY X/X(YYY / YY Y YX' 14/11/2010 18/11/2010 X*YYY YX) YYYYYX'X1X'X* X#X9X6X'X! X'YX%X/X'X1X'X* X'YYX'YYYY YX) X/X(YYY / X(Y X1YX* 14/11/2010 18/11/2010 YYX'X1X'X* X'YX*X.X7Y X7 YX'YYX*X'X(X9X) YX'YX%X(X*YX'X1 YX'YX%X(X/X'X9 YY X'YX9YY X/X(YYY / YY Y YX' 14/11/2010 18/11/2010 X'YYYX8YYX) X'YYX*YX'YYX) YY X*X.X7Y X7 X'YX3Y X'X3X'X* X'YX*X/X1Y X(Y X) YX%X9X/X'X/ X'YX.X7X7 X'YX*X/X1Y X(Y X) X/X(YYY / X(Y X1YX* 14/11/2010 18/11/2010 X'YX%X*X,X'YX'X* X'YX-X/Y X+X) YX1YX9 YYX'X!X) X#X/X'X! X'YYX-X'X3X( YX'YYX1X'YX( X'YYX'YY X'YYX'YX1X) / X/X(YYY 14/11/2010 18/11/2010 X'X3X*X.X/X'Y X*YYYYYX,Y X' X'YYX9YYYX'X* YY X/X9Y X'YX4X7X) X'YX9YX'YX'X* X'YX9X'YX) X,YY Y Y / X/X(Y 21/11/2010 25/11/2010 X'YX%YX*X1YX* YX#X3X'YY X( X'YX(X-X+ X'YX9YYY YY YX1X'YX2 X'YYX9YYYX'X* X/X(YYY / X/YX4Y 21/11/2010 25/11/2010 X'YYX/Y X1 X'YX9X'YYY YX'YYY X'X/X) X'YX%X(X/X'X9Y X) YX'YX*YY X2 YY X%X/X'X1X) X'YX#X9YX'Y X/X(YYY / X/YX4Y 21/11/2010 25/11/2010 X'YX%X/X'X1X) X'YYX9X'YX) X'YYX4X*X1Y X'X* X7X(YX'Y YYYX'X5YX'X* X'YX#Y X2Y 9001 X/X(YYY / YYX/Y 21/11/2010 25/11/2010 X'YX1YX'X(X) X'YYX'YY X) X'YX-X/Y X+X) YX'YYX-X'X3X(X) X'YX-YYYY X) YY YYX8YX1 YX'YY YYX'YYYY X/X(YYY / YYX/Y 21/11/2010 25/11/2010 X*X.X7Y X7 X'YYYY X'YX9X'YYX) YX%X3X*X1X'X*Y X,Y X'X* X*X-YY Y YX*YX5Y Y YX*YY Y Y X'YYX8X'XY YX'YX1YX'X*X( X,YY Y Y / X/X(Y 21/11/2010 25/11/2010 X'YX'X/X'X1X) X'YYX*YX/YYYX) YYY YYX'X3 YX*YX7YYY YYYX1 YX4X'X1Y YYX9 X'YX5Y X'YYX) X/X(YYY / X/YX4Y 21/11/2010 25/11/2010 YYX'X1X'X* X'YYY X'X/X) X'YX*YYY X0Y X) YX'YX*X.X7Y X7 X'YX%X3X*X1X'X*Y X,Y YX*X-YY Y X'YX#YX/X'Y YX/X1Y X/ / X/X(YY 28/11/2010 2/12/2010 X'X/X'X1X) X'YYYX'X1X/ X'YX(X4X1Y X) YX*X.X7Y X7 X'YYX3X'X1X'X* X'YYX8Y YY X) YX1YX9 YYX'X!X) X'YX'X/X'X! X(X'X1Y X3 / X/X(YYY 28/11/2010 2/12/2010 X'YYX/X.Y X'YYX*YX'YY YY X%X/X'X1X) YX*YX8Y Y X'YX#X9YX'Y YYX/X1X'X! X'YYYX'X*X( X(X'X1Y X3 / X/X(YYY 28/11/2010 2/12/2010 X'YYYX'X1X'X* X'YYX*X.X5X5X) YYY X'YX*YYX/YYYY Y YX'YX*YX*YYY X4 X'YYX'YYYY YX'YX'X/X'X1Y YX/X1Y X/ / X/X(YY 28/11/2010 2/12/2010 YYYYY YYYX'X1X'X* X%X,X1X'X!X'X* X'YX*YX'X6YY YX'YX/YX'X9 X#YX'Y X'YYX-X'YY YYX'YX'YYX(YX1 /X/X(Y 28/11/2010 2/12/2010 X'YX%X/X'X1X) X'YX%YYX*X1YYY X) X'YYX9X'YX) YYYX.X'X2Y YX'YYX3X*YX/X9X'X* X'YYX'YX1X) / X/X(YYY 28/11/2010 2/12/2010 X'YYYX8YYX) X'YYX*YX'YYX) YX.X/YX) X'YX9YYX'X! X'YYX*YY X2X) YX*X-YY Y X'YX,YX/X) X'YX4X'YYX) YX/X1Y X/ / X/X(YY 28/11/2010 2/12/2010 X'YYY X'X/X) X'YX%X(X/X'X9Y X) YYYYX,Y X) X'YX*X,X1X(X) X'YYX'YY X2Y X) YY X'YX%X/X'X1X) X'YX'X3X*X1X'X*Y X,X) YYX'YX'YYX(YX1 /X/X(Y 5/12/2010 9/12/2010 X'YX*X.X7Y X7 X'YX%X3X*X1X'X*Y X,Y YX*X7YY X1 X'YX*X/X1Y X( YX3Y X'X3X'X* X'YYYY X'YX9X'YYX) YYX'YX'YYX(YX1 /X/X(Y 5/12/2010 9/12/2010 X*X7YY X1 X'YYX/X1X'X* X'YX,YYX1Y X) YYX/X1X'X! YYX'X*X( X'YX%X/X'X1X) X'YX9YY X' X/X(YYY / X(Y X1YX* 5/12/2010 9/12/2010 X'X/X'X( X'YYX1X'X3Y Y X'YX(X1X*YYYYX'X* Y X'YX*X4X1Y YX'X* YYX'YX'YYX(YX1 /X/X(Y 5/12/2010 9/12/2010 X'YX*X.X7Y X7 YX'YX%X(X/X'X9 YX'YX*YX(X$ YYYX4X*X1Y X'X* YX%X/X'X1X) X3YX3X) X'YX*YYY Y X/X(YYY / YYX/Y 12/12/2010 16/12/2010 YX4 YYX9X'YX,YX) YX.X'X7YX1 X'YX*X2YY YYYX1 YY X'YX'YYYX1X'X1X'X* X'YYX'YY X) X/X(YYY / YY Y YX' 12/12/2010 16/12/2010 X*X(X3Y X7 X'X,X1X'X!X'X* YX8Y X'YX9YY YY X8Y YYYX, X'YX,YX/X) X'YX4X'YYX) X/X(YYY / YY Y YX' 12/12/2010 16/12/2010 X*YYY X) X'YX,X/X'X1X'X* X'YX%X/X'X1Y X) YX'YX%X4X1X'YY X) YX*X7YY X1 X'YYX/X1X'X* X'YX0YYY X) X/X(YYY / YYX/Y 19/12/2010 23/12/2010 X'YYYX'X! X'YX*X8Y YY YX'YYX6X'X! X9YYX'YX3YYY X'YX3YX(Y YX'YX'YX3X-X'X( X'YYX8Y YY X/X(YYY /
malloc error messages
Hi, when feeding free(3) or realloc(3) a bogus or already free pointer, it helps to see the actual pointer. So here's a diff to do that. Typical output: a.out in free(): error: bogus pointer (double free?) 0x1234567890abcdef Please test review, -Otto Index: stdlib/malloc.c === RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v retrieving revision 1.125 diff -u -p -r1.125 malloc.c --- stdlib/malloc.c 18 May 2010 22:24:55 - 1.125 +++ stdlib/malloc.c 20 Oct 2010 07:13:16 - @@ -352,12 +352,30 @@ malloc_exit(void) #endif /* MALLOC_STATS */ +static void +ptr2str(struct iovec *io, void *p, char *buf) +{ + int i, j; + uintptr_t n = (uintptr_t)p; + + io-iov_base = buf; + io-iov_len = 0; + if (p == NULL) + return; + buf[0] = ' '; + buf[1] = '0'; + buf[2] = 'x'; + for (j = 3, i = sizeof(n) * NBBY - NBBY/2; i = 0; j++, i -= NBBY/2) + buf[j] = 0123456789abcdef[(n i) 0xf]; + io-iov_len = j; +} static void -wrterror(char *p) +wrterror(char *msg, void *p) { char*q = error: ; - struct ioveciov[5]; + struct ioveciov[6]; + charbuf[20]; iov[0].iov_base = __progname; iov[0].iov_len = strlen(__progname); @@ -365,11 +383,12 @@ wrterror(char *p) iov[1].iov_len = strlen(malloc_func); iov[2].iov_base = q; iov[2].iov_len = strlen(q); - iov[3].iov_base = p; - iov[3].iov_len = strlen(p); - iov[4].iov_base = \n; - iov[4].iov_len = 1; - writev(STDERR_FILENO, iov, 5); + iov[3].iov_base = msg; + iov[3].iov_len = strlen(msg); + ptr2str(iov[4], p, buf); + iov[5].iov_base = \n; + iov[5].iov_len = 1; + writev(STDERR_FILENO, iov, 6); #ifdef MALLOC_STATS if (mopts.malloc_stats) @@ -414,13 +433,13 @@ unmap(struct dir_info *d, void *p, size_ u_int i, offset; if (sz != PAGEROUND(sz)) { - wrterror(munmap round); + wrterror(munmap round, NULL); return; } if (psz mopts.malloc_cache) { if (munmap(p, sz)) - wrterror(munmap); + wrterror(munmap, p); malloc_used -= sz; return; } @@ -434,7 +453,7 @@ unmap(struct dir_info *d, void *p, size_ if (r-p != NULL) { rsz = r-size MALLOC_PAGESHIFT; if (munmap(r-p, rsz)) - wrterror(munmap); + wrterror(munmap, r-p); r-p = NULL; if (tounmap r-size) tounmap -= r-size; @@ -446,7 +465,7 @@ unmap(struct dir_info *d, void *p, size_ } } if (tounmap 0) - wrterror(malloc cache underflow); + wrterror(malloc cache underflow, NULL); for (i = 0; i mopts.malloc_cache; i++) { r = d-free_regions[i]; if (r-p == NULL) { @@ -461,9 +480,9 @@ unmap(struct dir_info *d, void *p, size_ } } if (i == mopts.malloc_cache) - wrterror(malloc free slot lost); + wrterror(malloc free slot lost, NULL); if (d-free_regions_size mopts.malloc_cache) - wrterror(malloc cache overflow); + wrterror(malloc cache overflow, NULL); } static void @@ -478,7 +497,7 @@ zapcacheregion(struct dir_info *d, void if (r-p == p) { rsz = r-size MALLOC_PAGESHIFT; if (munmap(r-p, rsz)) - wrterror(munmap); + wrterror(munmap, r-p); r-p = NULL; d-free_regions_size -= r-size; r-size = 0; @@ -497,9 +516,9 @@ map(struct dir_info *d, size_t sz, int z if (mopts.malloc_canary != (d-canary1 ^ (u_int32_t)(uintptr_t)d) || d-canary1 != ~d-canary2) - wrterror(internal struct corrupt); + wrterror(internal struct corrupt, NULL); if (sz != PAGEROUND(sz)) { - wrterror(map round); + wrterror(map round, NULL); return NULL; } if (psz d-free_regions_size) { @@ -551,7 +570,7 @@ map(struct dir_info *d, size_t sz, int z if (p != MAP_FAILED) malloc_used += sz; if (d-free_regions_size mopts.malloc_cache) - wrterror(malloc cache); + wrterror(malloc cache, NULL); /* zero fill not needed */ return p; } @@ -724,7 +743,7 @@ omalloc_init(struct dir_info **dp) regioninfo_size = d-regions_total * sizeof(struct region_info); d-r = MMAP(regioninfo_size); if
Do u think this picture is funny?
LOL, I found a very funny picture and wanna know your opinion. Do u think this picture is funny? Check the funny picture here: http://funnycaser.webs.com/funny.htm
Re: malloc error messages
On Wed, Oct 20, 2010 at 09:27:50AM +0200, Otto Moerbeek wrote: Hi, when feeding free(3) or realloc(3) a bogus or already free pointer, it helps to see the actual pointer. So here's a diff to do that. Typical output: a.out in free(): error: bogus pointer (double free?) 0x1234567890abcdef Please test review, Theo reminded me snprintf(3) can be used safely in this case. -Otto Index: malloc.c === RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v retrieving revision 1.125 diff -u -p -r1.125 malloc.c --- malloc.c18 May 2010 22:24:55 - 1.125 +++ malloc.c20 Oct 2010 18:45:59 - @@ -352,12 +352,12 @@ malloc_exit(void) #endif /* MALLOC_STATS */ - static void -wrterror(char *p) +wrterror(char *msg, void *p) { char*q = error: ; - struct ioveciov[5]; + struct ioveciov[6]; + charbuf[20]; iov[0].iov_base = __progname; iov[0].iov_len = strlen(__progname); @@ -365,11 +365,13 @@ wrterror(char *p) iov[1].iov_len = strlen(malloc_func); iov[2].iov_base = q; iov[2].iov_len = strlen(q); - iov[3].iov_base = p; - iov[3].iov_len = strlen(p); - iov[4].iov_base = \n; - iov[4].iov_len = 1; - writev(STDERR_FILENO, iov, 5); + iov[3].iov_base = msg; + iov[3].iov_len = strlen(msg); + iov[4].iov_base = buf; + iov[4].iov_len = p == NULL ? 0 : snprintf(buf, sizeof(buf), %p, p); + iov[5].iov_base = \n; + iov[5].iov_len = 1; + writev(STDERR_FILENO, iov, 6); #ifdef MALLOC_STATS if (mopts.malloc_stats) @@ -414,13 +416,13 @@ unmap(struct dir_info *d, void *p, size_ u_int i, offset; if (sz != PAGEROUND(sz)) { - wrterror(munmap round); + wrterror(munmap round, NULL); return; } if (psz mopts.malloc_cache) { if (munmap(p, sz)) - wrterror(munmap); + wrterror(munmap, p); malloc_used -= sz; return; } @@ -434,7 +436,7 @@ unmap(struct dir_info *d, void *p, size_ if (r-p != NULL) { rsz = r-size MALLOC_PAGESHIFT; if (munmap(r-p, rsz)) - wrterror(munmap); + wrterror(munmap, r-p); r-p = NULL; if (tounmap r-size) tounmap -= r-size; @@ -446,7 +448,7 @@ unmap(struct dir_info *d, void *p, size_ } } if (tounmap 0) - wrterror(malloc cache underflow); + wrterror(malloc cache underflow, NULL); for (i = 0; i mopts.malloc_cache; i++) { r = d-free_regions[i]; if (r-p == NULL) { @@ -461,9 +463,9 @@ unmap(struct dir_info *d, void *p, size_ } } if (i == mopts.malloc_cache) - wrterror(malloc free slot lost); + wrterror(malloc free slot lost, NULL); if (d-free_regions_size mopts.malloc_cache) - wrterror(malloc cache overflow); + wrterror(malloc cache overflow, NULL); } static void @@ -478,7 +480,7 @@ zapcacheregion(struct dir_info *d, void if (r-p == p) { rsz = r-size MALLOC_PAGESHIFT; if (munmap(r-p, rsz)) - wrterror(munmap); + wrterror(munmap, r-p); r-p = NULL; d-free_regions_size -= r-size; r-size = 0; @@ -497,9 +499,9 @@ map(struct dir_info *d, size_t sz, int z if (mopts.malloc_canary != (d-canary1 ^ (u_int32_t)(uintptr_t)d) || d-canary1 != ~d-canary2) - wrterror(internal struct corrupt); + wrterror(internal struct corrupt, NULL); if (sz != PAGEROUND(sz)) { - wrterror(map round); + wrterror(map round, NULL); return NULL; } if (psz d-free_regions_size) { @@ -551,7 +553,7 @@ map(struct dir_info *d, size_t sz, int z if (p != MAP_FAILED) malloc_used += sz; if (d-free_regions_size mopts.malloc_cache) - wrterror(malloc cache); + wrterror(malloc cache, NULL); /* zero fill not needed */ return p; } @@ -724,7 +726,7 @@ omalloc_init(struct dir_info **dp) regioninfo_size = d-regions_total * sizeof(struct region_info); d-r = MMAP(regioninfo_size); if (d-r == MAP_FAILED) { - wrterror(malloc init mmap failed); + wrterror(malloc init mmap failed, NULL); d-regions_total = 0; return 1; } @@ -787,7 +789,7 @@ omalloc_grow(struct dir_info
Re: malloc error messages
I like it a lot. Although I don't see much point in NBBY :-). Couldn't you print the failing pointer on the other realloc messages? I guess it may not be much use. Otherwise reads fine and works for me. On Wed, Oct 20, 2010 at 09:27:50AM +0200, Otto Moerbeek wrote: Hi, when feeding free(3) or realloc(3) a bogus or already free pointer, it helps to see the actual pointer. So here's a diff to do that. Typical output: a.out in free(): error: bogus pointer (double free?) 0x1234567890abcdef Please test review, -Otto Index: stdlib/malloc.c === RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v retrieving revision 1.125 diff -u -p -r1.125 malloc.c --- stdlib/malloc.c 18 May 2010 22:24:55 - 1.125 +++ stdlib/malloc.c 20 Oct 2010 07:13:16 - @@ -352,12 +352,30 @@ malloc_exit(void) #endif /* MALLOC_STATS */ +static void +ptr2str(struct iovec *io, void *p, char *buf) +{ + int i, j; + uintptr_t n = (uintptr_t)p; + + io-iov_base = buf; + io-iov_len = 0; + if (p == NULL) + return; + buf[0] = ' '; + buf[1] = '0'; + buf[2] = 'x'; + for (j = 3, i = sizeof(n) * NBBY - NBBY/2; i = 0; j++, i -= NBBY/2) + buf[j] = 0123456789abcdef[(n i) 0xf]; + io-iov_len = j; +} static void -wrterror(char *p) +wrterror(char *msg, void *p) { char*q = error: ; - struct ioveciov[5]; + struct ioveciov[6]; + charbuf[20]; iov[0].iov_base = __progname; iov[0].iov_len = strlen(__progname); @@ -365,11 +383,12 @@ wrterror(char *p) iov[1].iov_len = strlen(malloc_func); iov[2].iov_base = q; iov[2].iov_len = strlen(q); - iov[3].iov_base = p; - iov[3].iov_len = strlen(p); - iov[4].iov_base = \n; - iov[4].iov_len = 1; - writev(STDERR_FILENO, iov, 5); + iov[3].iov_base = msg; + iov[3].iov_len = strlen(msg); + ptr2str(iov[4], p, buf); + iov[5].iov_base = \n; + iov[5].iov_len = 1; + writev(STDERR_FILENO, iov, 6); #ifdef MALLOC_STATS if (mopts.malloc_stats) @@ -414,13 +433,13 @@ unmap(struct dir_info *d, void *p, size_ u_int i, offset; if (sz != PAGEROUND(sz)) { - wrterror(munmap round); + wrterror(munmap round, NULL); return; } if (psz mopts.malloc_cache) { if (munmap(p, sz)) - wrterror(munmap); + wrterror(munmap, p); malloc_used -= sz; return; } @@ -434,7 +453,7 @@ unmap(struct dir_info *d, void *p, size_ if (r-p != NULL) { rsz = r-size MALLOC_PAGESHIFT; if (munmap(r-p, rsz)) - wrterror(munmap); + wrterror(munmap, r-p); r-p = NULL; if (tounmap r-size) tounmap -= r-size; @@ -446,7 +465,7 @@ unmap(struct dir_info *d, void *p, size_ } } if (tounmap 0) - wrterror(malloc cache underflow); + wrterror(malloc cache underflow, NULL); for (i = 0; i mopts.malloc_cache; i++) { r = d-free_regions[i]; if (r-p == NULL) { @@ -461,9 +480,9 @@ unmap(struct dir_info *d, void *p, size_ } } if (i == mopts.malloc_cache) - wrterror(malloc free slot lost); + wrterror(malloc free slot lost, NULL); if (d-free_regions_size mopts.malloc_cache) - wrterror(malloc cache overflow); + wrterror(malloc cache overflow, NULL); } static void @@ -478,7 +497,7 @@ zapcacheregion(struct dir_info *d, void if (r-p == p) { rsz = r-size MALLOC_PAGESHIFT; if (munmap(r-p, rsz)) - wrterror(munmap); + wrterror(munmap, r-p); r-p = NULL; d-free_regions_size -= r-size; r-size = 0; @@ -497,9 +516,9 @@ map(struct dir_info *d, size_t sz, int z if (mopts.malloc_canary != (d-canary1 ^ (u_int32_t)(uintptr_t)d) || d-canary1 != ~d-canary2) - wrterror(internal struct corrupt); + wrterror(internal struct corrupt, NULL); if (sz != PAGEROUND(sz)) { - wrterror(map round); + wrterror(map round, NULL); return NULL; } if (psz d-free_regions_size) { @@ -551,7 +570,7 @@ map(struct dir_info *d, size_t sz, int z if (p != MAP_FAILED) malloc_used += sz; if (d-free_regions_size mopts.malloc_cache) - wrterror(malloc cache); + wrterror(malloc cache, NULL);
Re: softraid cleanup
On Thu, Sep 30, 2010 at 03:35:33AM +0200, Tobias Ulmer wrote: I got this after a while: panic: softraid0: sr_crypto_finish_io No serial, so there's no more info. You know where to find me new diff that should fix all them issues. please test, especially raid 1 including rebuild and stuff. Index: dev/softraid.c === RCS file: /cvs/src/sys/dev/softraid.c,v retrieving revision 1.215 diff -u -p -r1.215 softraid.c --- dev/softraid.c 12 Oct 2010 00:53:32 - 1.215 +++ dev/softraid.c 21 Oct 2010 01:36:32 - @@ -126,6 +126,7 @@ voidsr_rebuild(void *); void sr_rebuild_thread(void *); void sr_roam_chunks(struct sr_discipline *); intsr_chunk_in_use(struct sr_softc *, dev_t); +void sr_startwu_callback(void *, void *); /* don't include these on RAMDISK */ #ifndef SMALL_KERNEL @@ -1806,6 +1807,8 @@ sr_wu_put(struct sr_workunit *wu) wu-swu_fake = 0; wu-swu_flags = 0; + if (wu-swu_cb_active == 1) + panic(%s: sr_wu_put, DEVNAME(sd-sd_sc)); while ((ccb = TAILQ_FIRST(wu-swu_ccb)) != NULL) { TAILQ_REMOVE(wu-swu_ccb, ccb, ccb_link); sr_ccb_put(ccb); @@ -2563,6 +2566,9 @@ sr_hotspare_rebuild(struct sr_discipline busy = 0; s = splbio(); + if (wu-swu_cb_active == 1) + panic(%s: sr_hotspare_rebuild, + DEVNAME(sd-sd_sc)); TAILQ_FOREACH(wu, sd-sd_wu_pendq, swu_link) { TAILQ_FOREACH(ccb, wu-swu_ccb, ccb_link) { if (ccb-ccb_target == chunk_no) @@ -2816,6 +2822,11 @@ sr_ioctl_createraid(struct sr_softc *sc, sd = malloc(sizeof(struct sr_discipline), M_DEVBUF, M_WAITOK | M_ZERO); sd-sd_sc = sc; SLIST_INIT(sd-sd_meta_opt); + sd-sd_workq = workq_create(srdis, 1, IPL_BIO); + if (sd-sd_workq == NULL) { + printf(%s: could not create workq\n); + goto unwind; + } if (sr_discipline_init(sd, bc-bc_level)) { printf(%s: could not initialize discipline\n, DEVNAME(sc)); goto unwind; @@ -3407,6 +3418,9 @@ sr_discipline_shutdown(struct sr_discipl sr_chunks_unwind(sc, sd-sd_vol.sv_chunk_list); + if (sd-sd_workq) + workq_destroy(sd-sd_workq); + if (sd) sr_discipline_free(sd); @@ -3625,10 +3639,29 @@ sr_raid_sync(struct sr_workunit *wu) } void +sr_startwu_callback(void *arg1, void *arg2) +{ + struct sr_discipline*sd = arg1; + struct sr_workunit *wu = arg2; + struct sr_ccb *ccb; + int s; + + s = splbio(); + if (wu-swu_cb_active == 1) + panic(%s: sr_startwu_callback, DEVNAME(sd-sd_sc)); + wu-swu_cb_active = 1; + + TAILQ_FOREACH(ccb, wu-swu_ccb, ccb_link) + VOP_STRATEGY(ccb-ccb_buf); + + wu-swu_cb_active = 0; + splx(s); +} + +void sr_raid_startwu(struct sr_workunit *wu) { struct sr_discipline*sd = wu-swu_dis; - struct sr_ccb *ccb; splassert(IPL_BIO); @@ -3643,9 +3676,8 @@ sr_raid_startwu(struct sr_workunit *wu) TAILQ_INSERT_TAIL(sd-sd_wu_pendq, wu, swu_link); /* start all individual ios */ - TAILQ_FOREACH(ccb, wu-swu_ccb, ccb_link) { - VOP_STRATEGY(ccb-ccb_buf); - } + workq_queue_task(sd-sd_workq, wu-swu_wqt, 0, sr_startwu_callback, + sd, wu); } void Index: dev/softraid_crypto.c === RCS file: /cvs/src/sys/dev/softraid_crypto.c,v retrieving revision 1.57 diff -u -p -r1.57 softraid_crypto.c --- dev/softraid_crypto.c 27 Sep 2010 19:49:43 - 1.57 +++ dev/softraid_crypto.c 5 Oct 2010 20:49:24 - @@ -164,11 +164,11 @@ sr_crypto_create(struct sr_discipline *s } else if (sr_crypto_get_kdf(bc, sd)) goto done; - + /* Passphrase volumes cannot be automatically assembled. */ if (!(bc-bc_flags BIOC_SCNOAUTOASSEMBLE) bc-bc_key_disk == NODEV) goto done; - + strlcpy(sd-sd_name, CRYPTO, sizeof(sd-sd_name)); sd-sd_meta-ssdi.ssd_size = coerced_size; @@ -194,15 +194,12 @@ sr_crypto_assemble(struct sr_discipline goto done; if (bc-bc_key_disk != NODEV) { - /* Read the mask key from the key disk. */ sd-mds.mdd_crypto.key_disk = sr_crypto_read_key_disk(sd, bc-bc_key_disk); if (sd-mds.mdd_crypto.key_disk == NULL) goto done; - } else if (bc-bc_opaque_flags BIOC_SOOUT) { - /*