Date: Tue, 6 May 2008 10:53:42 GMT From: KOIE Hidetaka <hide@koie.org> To: freebsd-gnats-submit@FreeBSD.org Subject: amd64/123456: /usr/bin/fstat shows error messages and hang. Message-ID: <200805061053.m46Arg8J089713@www.freebsd.org> Resent-Message-ID: <200805061100.m46B05aA072747@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 123456 >Category: amd64 >Synopsis: /usr/bin/fstat shows error messages and hang. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 06 11:00:04 UTC 2008 >Closed-Date: >Last-Modified: >Originator: KOIE Hidetaka >Release: FreeBSD 8.0-CURRENT amd64 >Organization: surigiken >Environment: System: FreeBSD guriandgura 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Mon May 5 13:17:50 JST 2008 koie@guriandgura:/usr/obj/usr/src\ /sys/GURIANDGURA amd64 >Description: fstat -v shows error message like this: can't read vnode at 0x0 for pid *** can't read znode_phys at 0x**** for pid *** unknown file type 5 for file 5 of pid *** fstat / hangs. >How-To-Repeat: >Fix: Patch for "can't read vnode at 0x0 for pid ***": vtrans() is invoked iff vp is not null. Patch for "can't read znode_phys at 0x**** for pid ***": znode_phys is void *, not int. Patch for "unknown file type 5 for file 5 of pid ***": consider other DTYPEs. Patch for hanging: sysctl "debug.sizeof.znode" returns int, not size_t. Patch attached with submission follows: diff -c -r1.65 fstat.c *** fstat.c 5 Nov 2007 23:15:02 -0000 1.65 --- fstat.c 6 May 2008 10:11:33 -0000 *************** *** 348,354 **** /* * current working directory vnode */ ! vtrans(filed.fd_cdir, CDIR, FREAD); /* * jail root, if any. */ --- 348,355 ---- /* * current working directory vnode */ ! if (filed.fd_cdir) ! vtrans(filed.fd_cdir, CDIR, FREAD); /* * jail root, if any. */ *************** *** 390,417 **** i, (void *)ofiles[i], Pid); continue; } ! if (file.f_type == DTYPE_VNODE) vtrans(file.f_vnode, i, file.f_flag); ! else if (file.f_type == DTYPE_SOCKET) { if (checkfile == 0) socktrans(file.f_data, i); ! } #ifdef DTYPE_PIPE ! else if (file.f_type == DTYPE_PIPE) { if (checkfile == 0) pipetrans(file.f_data, i, file.f_flag); ! } #endif #ifdef DTYPE_FIFO ! else if (file.f_type == DTYPE_FIFO) { if (checkfile == 0) vtrans(file.f_vnode, i, file.f_flag); ! } #endif ! else { dprintf(stderr, "unknown file type %d for file %d of pid %d\n", file.f_type, i, Pid); } } } --- 391,435 ---- i, (void *)ofiles[i], Pid); continue; } ! switch (file.f_type) { ! case DTYPE_VNODE: vtrans(file.f_vnode, i, file.f_flag); ! break; ! case DTYPE_SOCKET: if (checkfile == 0) socktrans(file.f_data, i); ! break; #ifdef DTYPE_PIPE ! case DTYPE_PIPE: if (checkfile == 0) pipetrans(file.f_data, i, file.f_flag); ! break; #endif #ifdef DTYPE_FIFO ! case DTYPE_FIFO: if (checkfile == 0) vtrans(file.f_vnode, i, file.f_flag); ! break; #endif ! #ifdef DTYPE_KQUEUE ! case DTYPE_KQUEUE: ! #endif ! #ifdef DTYPE_CRYPTO ! case DTYPE_CRYPTO: ! #endif ! #ifdef DTYPE_MQUEUE ! case DTYPE_MQUEUE: ! #endif ! #ifdef DTYPE_SHM ! case DTYPE_SHM: ! #endif ! /* not supported */ ! break; ! default: dprintf(stderr, "unknown file type %d for file %d of pid %d\n", file.f_type, i, Pid); + break; } } } diff -c -r1.2 zfs.c *** zfs.c 17 Nov 2007 23:21:38 -0000 1.2 --- zfs.c 6 May 2008 10:02:48 -0000 *************** *** 68,75 **** uint64_t *zid; void *znodeptr, *vnodeptr; char *dataptr; ! int *zphys_addr; ! size_t len, size; len = sizeof(size); if (sysctlbyname("debug.sizeof.znode", &size, &len, NULL, 0) == -1) { --- 68,76 ---- uint64_t *zid; void *znodeptr, *vnodeptr; char *dataptr; ! void *zphys_addr; ! size_t len; ! int size; len = sizeof(size); if (sysctlbyname("debug.sizeof.znode", &size, &len, NULL, 0) == -1) { *************** *** 84,90 **** /* Since we have problems including vnode.h, we'll use the wrappers. */ vnodeptr = getvnodedata(vp); ! if (!KVM_READ(vnodeptr, znodeptr, size)) { dprintf(stderr, "can't read znode at %p for pid %d\n", (void *)vnodeptr, Pid); goto bad; --- 85,91 ---- /* Since we have problems including vnode.h, we'll use the wrappers. */ vnodeptr = getvnodedata(vp); ! if (!KVM_READ(vnodeptr, znodeptr, (size_t)size)) { dprintf(stderr, "can't read znode at %p for pid %d\n", (void *)vnodeptr, Pid); goto bad; *************** *** 99,107 **** */ dataptr = znodeptr; zid = (uint64_t *)(dataptr + LOCATION_ZID); ! zphys_addr = (int *)(dataptr + LOCATION_ZPHYS(size)); ! if (!KVM_READ(*zphys_addr, &zphys, sizeof(zphys))) { dprintf(stderr, "can't read znode_phys at %p for pid %d\n", zphys_addr, Pid); goto bad; --- 100,108 ---- */ dataptr = znodeptr; zid = (uint64_t *)(dataptr + LOCATION_ZID); ! zphys_addr = *(void **)(dataptr + LOCATION_ZPHYS(size)); ! if (!KVM_READ(zphys_addr, &zphys, sizeof(zphys))) { dprintf(stderr, "can't read znode_phys at %p for pid %d\n", zphys_addr, Pid); goto bad; >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805061053.m46Arg8J089713>