kernel/ffs: Compare v_rdev directly when updating mounts.
authorSascha Wildner <saw@online.de>
Sun, 26 Aug 2012 09:55:37 +0000 (11:55 +0200)
committerSascha Wildner <saw@online.de>
Sun, 26 Aug 2012 10:31:39 +0000 (12:31 +0200)
Nowadays the vnode's v_rdev is always associated, so it can be used
directly to compare the devices.

Pointed-out-by: alexh
sys/vfs/ufs/ffs_vfsops.c

index 5acb98f..92c008b 100644 (file)
@@ -315,23 +315,20 @@ ffs_mount(struct mount *mp,               /* mount struct pointer */
        if (mp->mnt_flag & MNT_UPDATE) {
                /*
                 * UPDATE - make sure the resolved vnode represents the same
-                * device.  Note that devvp->v_rdev may be NULL since we 
-                * haven't opened it, so compare udev instead.
+                * device. Since devfs, devvp->v_rdev can be used directly as
+                * it is always associated as long as the vnode exists.
                 *
                 * Our current open/writecount state is associated with
                 * um_devvp, so continue using um_devvp and throw away devvp.
                 */
                if (devvp != ump->um_devvp) {
-                       if (devvp->v_umajor == ump->um_devvp->v_umajor &&
-                           devvp->v_uminor == ump->um_devvp->v_uminor) {
+                       if (devvp->v_rdev == ump->um_devvp->v_rdev) {
                                vrele(devvp);
                                devvp = ump->um_devvp;
                        } else {
-                               kprintf("cannot update mount, udev does"
-                                       " not match %08x:%08x vs %08x:%08x\n",
-                                       devvp->v_umajor, devvp->v_uminor,
-                                       ump->um_devvp->v_umajor,
-                                       ump->um_devvp->v_uminor);
+                               kprintf("cannot update mount, v_rdev does"
+                                       " not match (%p vs %p)\n",
+                                       devvp->v_rdev, ump->um_devvp->v_rdev);
                                error = EINVAL; /* needs translation */
                        }
                } else {