From owner-cvs-src@FreeBSD.ORG Mon Jun 30 04:55:41 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C064D37B401; Mon, 30 Jun 2003 04:55:41 -0700 (PDT) Received: from HAL9000.homeunix.com (ip114.bella-vista.sfo.interquest.net [66.199.86.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 14EFF43F3F; Mon, 30 Jun 2003 04:55:41 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.9) with ESMTP id h5UBtZ12000777; Mon, 30 Jun 2003 04:55:35 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.9/Submit) id h5UBtZQY000776; Mon, 30 Jun 2003 04:55:35 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Mon, 30 Jun 2003 04:55:35 -0700 From: David Schultz To: "Tim J. Robbins" Message-ID: <20030630115535.GA586@HAL9000.homeunix.com> Mail-Followup-To: "Tim J. Robbins" , src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org References: <200306290306.h5T360Ep009734@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200306290306.h5T360Ep009734@repoman.freebsd.org> cc: cvs-src@FreeBSD.ORG cc: src-committers@FreeBSD.ORG cc: cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/fs/msdosfs msdosfs_vfsops.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2003 11:55:42 -0000 On Sat, Jun 28, 2003, Tim J. Robbins wrote: > Fixes lockup when creating files on msdosfs mounts that have been > mounted read-only then upgraded to read-write. The exact cause of > the lockup is not known, but it is likely to be the kernel getting > stuck in an infinite loop trying to write dirty buffers to a device > without write permission. If this is the problem I think it is, then not quite. After a failed write, msdosfs_readdir() gets into an infinite loop because bread() returns a buffer with a b_resid of 0. Partial fix: Index: sys/fs/msdosfs/msdosfs_vnops.c =================================================================== RCS file: /cvs/src/sys/fs/msdosfs/msdosfs_vnops.c,v retrieving revision 1.138 diff -u -r1.138 msdosfs_vnops.c --- sys/fs/msdosfs/msdosfs_vnops.c 15 Jun 2003 18:52:57 -0000 1.138 +++ sys/fs/msdosfs/msdosfs_vnops.c 30 Jun 2003 11:49:09 -0000 @@ -1571,6 +1571,10 @@ return (error); } n = min(n, blsize - bp->b_resid); + if (n == 0) { + brelse(bp); + return (EIO); + } /* * Convert from dos directory entries to fs-independent I call this a partial fix because instead of locking up, readdir() reports that the directory is empty, and I have't bothered to track that part down. See also kern/37035. There is a not-so-tight infinite loop for writing, where the system tries to push the failed buffer out again every 5 seconds or so, but that's really a separate issue, and a harder one to solve (unless you believe phk ;-). There was a discussion about it last October, in the thread ``Patch to allow a driver to report unrecoverable write errors to the buf layer''.