From owner-freebsd-current@FreeBSD.ORG Tue Apr 3 04:56:33 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA79E16A402 for ; Tue, 3 Apr 2007 04:56:33 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from mh1.centtech.com (moat3.centtech.com [64.129.166.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9550413C4AE for ; Tue, 3 Apr 2007 04:56:31 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from [192.168.42.21] (andersonbox1.centtech.com [192.168.42.21]) by mh1.centtech.com (8.13.8/8.13.8) with ESMTP id l334uSfq011304 for ; Mon, 2 Apr 2007 23:56:28 -0500 (CDT) (envelope-from anderson@freebsd.org) Message-ID: <4611DE78.7050405@freebsd.org> Date: Mon, 02 Apr 2007 23:56:24 -0500 From: Eric Anderson User-Agent: Thunderbird 1.5.0.10 (X11/20070320) MIME-Version: 1.0 To: freebsd-current@freebsd.org References: <460FDEF2.2060203@centtech.com> <20070401180125.GE25661@garage.freebsd.pl> <46119C4B.3020200@centtech.com> In-Reply-To: <46119C4B.3020200@centtech.com> Content-Type: multipart/mixed; boundary="------------040408000408040400050209" X-Virus-Scanned: ClamAV 0.88.4/3003/Mon Apr 2 22:15:48 2007 on mh1.centtech.com X-Virus-Status: Clean X-Spam-Status: No, score=-2.4 required=8.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.6 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on mh1.centtech.com Subject: Re: geom_journal panic: wrong offset 500107860990 for sectorsize 512 - RESOLVED X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2007 04:56:33 -0000 This is a multi-part message in MIME format. --------------040408000408040400050209 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 04/02/07 19:14, Eric Anderson wrote: > On 04/01/07 13:01, Pawel Jakub Dawidek wrote: >> On Sun, Apr 01, 2007 at 11:33:54AM -0500, Eric Anderson wrote: >>> After running: >>> >>> gjournal load >>> gjournal label -s 4G /dev/mirror/data >>> >>> I got this panic, and now every time I load geom_journal.ko, the system panics this same way. >>> >>> GEOM_JOURNAL: Journal 4239489025: mirror/data contains data. >>> GEOM_JOURNAL: Journal 4239489025: mirror/data contains journal. >>> GEOM_JOURNAL: Journal mirror/data clean. >>> panic: wrong offset 500107860990 for sectorsize 512 >>> >>> I have a crash dump to look at if needed. >>> Looks something like this: >>> #8 0xc06e0f13 in kdb_enter (msg=0x12
) at cpufunc.h:60 >>> #9 0xc06c2334 in panic (fmt=0xc0943b8b "wrong offset %jd for sectorsize %u") at /usr/src/sys/kern/kern_shutdown.c:547 >>> #10 0xc0685316 in g_io_request (bp=0xc2edaad4, cp=0xc2485140) at /usr/src/sys/geom/geom_io.c:356 >>> #11 0xc0685aae in g_write_data (cp=0xc2485140, offset=Unhandled dwarf expression opcode 0x93) at /usr/src/sys/geom/geom_io.c:643 >>> >>> >>> This is running -CURRENT's latest snapshot (from March). >> Could you give me full backtrace? I don't see who calls g_write_data() >> exactly. >> > > > This has been resolved. Turns out, that you should not use size > modifiers like 'G' or 'M' when using the -s option to gjournal. Thanks > Pawel for the help!! > > Eric > > Here is a patch that adds that functionality. Can be found here: http://www.googlebit.com/freebsd/patches/gjournal_size_expression.patch and attached. WARNING: This patch could explode, cause bodily harm, etc. Well, maybe not.. but you get the point. :) Eric --------------040408000408040400050209 Content-Type: text/x-patch; name="gjournal_size_expression.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gjournal_size_expression.patch" Index: class/journal/geom_journal.c =================================================================== RCS file: /alt/ncvs/src/sbin/geom/class/journal/geom_journal.c,v retrieving revision 1.2 diff -u -r1.2 geom_journal.c --- class/journal/geom_journal.c 1 Nov 2006 09:22:33 -0000 1.2 +++ class/journal/geom_journal.c 3 Apr 2007 04:49:28 -0000 @@ -66,7 +66,7 @@ { 'c', "checksum", NULL, G_TYPE_BOOL }, { 'f', "force", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, - { 's', "jsize", &default_jsize, G_TYPE_NUMBER }, + { 's', "jsize", &default_jsize, G_TYPE_STRING }, G_OPT_SENTINEL }, "[-cfhv] [-s jsize] dataprov [jprov]" @@ -174,7 +174,7 @@ } data = gctl_get_ascii(req, "arg0"); - jsize = gctl_get_intmax(req, "jsize"); + jsize = gctl_get_numexpr(req, "jsize"); journal = NULL; switch (nargs) { case 1: Index: misc/subr.c =================================================================== RCS file: /alt/ncvs/src/sbin/geom/misc/subr.c,v retrieving revision 1.7 diff -u -r1.7 subr.c --- misc/subr.c 25 Jan 2007 11:35:27 -0000 1.7 +++ misc/subr.c 3 Apr 2007 04:50:44 -0000 @@ -377,6 +377,70 @@ return (*p); } +/* + * Convert an expression of the following forms to a uintmax_t. + * 1) A positive decimal number. + * 2) A positive decimal number followed by a 'b' or 'B' (mult by 512). + * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10). + * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20). + * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30). + * 5) A positive decimal number followed by a 'w' or 'W' (mult by sizeof int). + */ +intmax_t +gctl_get_numexpr(struct gctl_req *req, const char *pfmt, ...) +{ + const char *val; + va_list ap; + uintmax_t num, mult, prevnum; + char *expr; + + va_start(ap, pfmt); + val = gctl_get_param(req, 0, pfmt, ap); + + num = strtouq(val, &expr, 0); + + if (expr == val) /* No valid digits. */ + printf("illegal numeric value\n"); + + mult = 0; + switch (*expr) { + case 'B': + case 'b': + mult = 512; + break; + case 'K': + case 'k': + mult = 1 << 10; + break; + case 'M': + case 'm': + mult = 1 << 20; + break; + case 'G': + case 'g': + mult = 1 << 30; + break; + case 'W': + case 'w': + mult = sizeof(int); + break; + default: + ; + } + + if (mult != 0) { + prevnum = num; + num *= mult; + /* Check for overflow. */ + if (num / mult != prevnum) + printf("overflow in argument\n"); + expr++; + } + + va_end(ap); + return (num); +} + const char * gctl_get_ascii(struct gctl_req *req, const char *pfmt, ...) { Index: misc/subr.h =================================================================== RCS file: /alt/ncvs/src/sbin/geom/misc/subr.h,v retrieving revision 1.8 diff -u -r1.8 subr.h --- misc/subr.h 25 Jan 2007 11:35:27 -0000 1.8 +++ misc/subr.h 3 Apr 2007 04:21:36 -0000 @@ -44,6 +44,7 @@ void gctl_error(struct gctl_req *req, const char *error, ...) __printflike(2, 3); int gctl_get_int(struct gctl_req *req, const char *pfmt, ...) __printflike(2, 3); intmax_t gctl_get_intmax(struct gctl_req *req, const char *pfmt, ...) __printflike(2, 3); +intmax_t gctl_get_numexpr(struct gctl_req *req, const char *pfmt, ...) __printflike(2, 3); const char *gctl_get_ascii(struct gctl_req *req, const char *pfmt, ...) __printflike(2, 3); int gctl_change_param(struct gctl_req *req, const char *name, int len, const void *value); --------------040408000408040400050209--