Date: Mon, 30 Jun 2003 04:55:35 -0700 From: David Schultz <das@FreeBSD.ORG> To: "Tim J. Robbins" <tjr@FreeBSD.ORG> Cc: cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/fs/msdosfs msdosfs_vfsops.c Message-ID: <20030630115535.GA586@HAL9000.homeunix.com> In-Reply-To: <200306290306.h5T360Ep009734@repoman.freebsd.org> References: <200306290306.h5T360Ep009734@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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''.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030630115535.GA586>