Subject: Re: specified device does *too* match mounted device
To: None <tech-kern@netbsd.org>
From: Jed Davis <jdev@panix.com>
List: tech-kern
Date: 08/24/2006 22:27:36
--=-=-=
Jed Davis <jdev@panix.com> writes:
> This, I realize, is actually not magical; there are in fact supposed
> to be two (or N) separate vnodes. (The documentation is confusing, so
> I stared at the source and put in printf()s and looked around in ddb
> until it made sense.) Now, should ffs_mount allow updating from a
> different vnode with the same rdev? I think it should.
Attached is a patch which alters ffs_mount in that way. Opinions?
--
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l)))))) (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k))))))) '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=ffs_mnt_update_samedev.diff
Content-Description: Allow FFS remount from different devvp with same dev_t.
Index: ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.184
diff -u -p -r1.184 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c 23 Jul 2006 22:06:15 -0000 1.184
+++ ufs/ffs/ffs_vfsops.c 24 Aug 2006 04:10:25 -0000
@@ -234,8 +234,15 @@ ffs_mount(struct mount *mp, const char *
* used for our initial mount
*/
ump = VFSTOUFS(mp);
- if (devvp != ump->um_devvp)
- error = EINVAL;
+ if (devvp != ump->um_devvp) {
+ if (devvp->v_rdev != ump->um_devvp->v_rdev)
+ error = EINVAL;
+ else {
+ vrele(devvp);
+ devvp = ump->um_devvp;
+ vref(devvp);
+ }
+ }
}
} else {
if (!update) {
--=-=-=--