From owner-freebsd-current Sun Oct 13 9: 4:59 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CA8D37B406 for ; Sun, 13 Oct 2002 09:04:56 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id CABE243E4A for ; Sun, 13 Oct 2002 09:04:55 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id g9DG4qIw006601; Sun, 13 Oct 2002 18:04:52 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: "Peter Edwards" Cc: current@FreeBSD.ORG Subject: Re: Bug unmounting readonly NTFS partitions uncovered by GEOM In-Reply-To: Your message of "Sun, 13 Oct 2002 16:50:22 BST." <20021013155228.8D64443E7B@mx1.FreeBSD.org> Date: Sun, 13 Oct 2002 18:04:52 +0200 Message-ID: <6600.1034525092@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG done. In message <20021013155228.8D64443E7B@mx1.FreeBSD.org>, "Peter Edwards" writes: >ntfs_unmount has had this bug since v 1.1: there's a "ronly" variable that >should be used to detect if the mount is read-only and affect the flags >passed to the VOP_CLOSE of the device vnode accordingly. It's never set to >anything other than zero, but the matching VOP_OPEN in ntfs_mount() gets >it right. > >GEOM notices the mismatch between the VOP_OPEN and VOP_CLOSE on the device, >and panics in g_access_rel() when unmounting a read-only mounted NTFS >partition. > >Does someone want to commit the obvious patch? > > >petere@celery$ cvs -R diff -u sys/fs/ntfs >cvs diff: Diffing sys/fs/ntfs >Index: sys/fs/ntfs/ntfs_vfsops.c >=================================================================== >RCS file: /usr/FreeBSD-CVS/src/sys/fs/ntfs/ntfs_vfsops.c,v >retrieving revision 1.47 >diff -u -r1.47 ntfs_vfsops.c >--- sys/fs/ntfs/ntfs_vfsops.c 27 Sep 2002 18:27:06 -0000 1.47 >+++ sys/fs/ntfs/ntfs_vfsops.c 13 Oct 2002 15:30:01 -0000 >@@ -508,6 +508,7 @@ > > vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, td, 0, 0); > >+ ronly = (mp->mnt_flag & MNT_RDONLY) != 0; > error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE, > NOCRED, td); > >-- >Peter Edwards > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-current" in the body of the message > -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message