Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Oct 2002 16:50:22 +0100
From:      "Peter Edwards" <pmedwards@eircom.net>
To:        current@freebsd.org
Subject:   Bug unmounting readonly NTFS partitions uncovered by GEOM
Message-ID:  <20021013155228.8D64443E7B@mx1.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021013155228.8D64443E7B>