From owner-freebsd-bugs@FreeBSD.ORG Tue Dec 6 08:30:17 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D70DB106564A for ; Tue, 6 Dec 2011 08:30:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C63D88FC15 for ; Tue, 6 Dec 2011 08:30:17 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pB68UHcY002270 for ; Tue, 6 Dec 2011 08:30:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pB68UH9o002267; Tue, 6 Dec 2011 08:30:17 GMT (envelope-from gnats) Date: Tue, 6 Dec 2011 08:30:17 GMT Message-Id: <201112060830.pB68UH9o002267@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Petr Salinger Cc: Subject: Re: kern/163076: It is not possible to read in chunks from linprocfs and procfs. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Petr Salinger List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 08:30:17 -0000 The following reply was made to PR kern/163076; it has been noted by GNATS. From: Petr Salinger To: Jaakko Heinonen Cc: Poul-Henning Kamp , bug-followup@FreeBSD.org Subject: Re: kern/163076: It is not possible to read in chunks from linprocfs and procfs. Date: Tue, 6 Dec 2011 09:38:49 +0100 (CET) >>> Yes, r222004 changed sbuf_finish() to not clear s->s_error which causes >>> the regression. I am not sure if we should blame r222004 or the pseudofs >>> code. The "dd testcase" works for us with change bellow. It also solves the original problem. I am unsure whether it is a right way, though. Petr --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -640,7 +640,7 @@ if (buflen > MAXPHYS + 1) buflen = MAXPHYS + 1; - sb = sbuf_new(sb, NULL, buflen, 0); + sb = sbuf_new(sb, NULL, MAXPHYS + 1, 0); if (sb == NULL) { error = EIO; goto ret; @@ -654,7 +654,12 @@ } sbuf_finish(sb); - error = uiomove_frombuf(sbuf_data(sb), sbuf_len(sb), uio); + + if (buflen > sbuf_len(sb)) + buflen = sbuf_len(sb); + else + buflen--; + error = uiomove_frombuf(sbuf_data(sb), buflen, uio); sbuf_delete(sb); ret: vn_lock(vn, locked | LK_RETRY);