fix for per-mount i/o counting in ffs

Bruce Evans brde at optusnet.com.au
Mon May 16 21:26:19 UTC 2016


Counting of i/o's in g_vfs_strategy() requires the fs to initialize
devvp->v_rdev->si_mountpt to non-null.  This seems to be done correctly
in ext2fs and msdosfs, but in ffs it is not done for ro mounts, or for
rw mounts that started as ro.  The bug is most obvious for the root
file system since it always starts as ro.

The patch fixes 2 unrelated style bugs in comments.

X Index: ffs_vfsops.c
X ===================================================================
X --- ffs_vfsops.c	(revision 299263)
X +++ ffs_vfsops.c	(working copy)
X @@ -512,7 +512,7 @@
X  		 * We need the name for the mount point (also used for
X  		 * "last mounted on") copied in. If an error occurs,
X  		 * the mount point is discarded by the upper level code.
X -		 * Note that vfs_mount() populates f_mntonname for us.
X +		 * Note that vfs_mount_alloc() populates f_mntonname for us.
X  		 */
X  		if ((error = ffs_mountfs(devvp, mp, td)) != 0) {
X  			vrele(devvp);
X @@ -1049,8 +1049,6 @@
X  			ffs_flushfiles(mp, FORCECLOSE, td);
X  			goto out;
X  		}
X -		if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
X -			devvp->v_rdev->si_mountpt = mp;
X  		if (fs->fs_snapinum[0] != 0)
X  			ffs_snapshot_mount(mp);
X  		fs->fs_fmod = 1;
X @@ -1057,8 +1055,10 @@
X  		fs->fs_clean = 0;
X  		(void) ffs_sbupdate(ump, MNT_WAIT, 0);
X  	}
X +	if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
X +		devvp->v_rdev->si_mountpt = mp;
X  	/*
X -	 * Initialize filesystem stat information in mount struct.
X +	 * Initialize filesystem state information in mount struct.
X  	 */
X  	MNT_ILOCK(mp);
X  	mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |

Bruce


More information about the freebsd-fs mailing list