[PATCH] Fix a bug in nullfs_mount() and nullfs_statfs()

François Tigeot ftigeot at wolfpond.org
Sun Aug 14 06:13:30 PDT 2011


Most filesystems register the name of their mount point at mount time and
are able to return it later with a VFS_STATFS call. nullfs did not.
---
 sys/vfs/nullfs/null_vfsops.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sys/vfs/nullfs/null_vfsops.c b/sys/vfs/nullfs/null_vfsops.c
index 520fd1c..052be60 100644
--- a/sys/vfs/nullfs/null_vfsops.c
+++ b/sys/vfs/nullfs/null_vfsops.c
@@ -194,6 +194,12 @@ nullfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
 	NULLFSDEBUG("nullfs_mount: lower %s, alias at %s\n",
 		mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntfromname);
 
+	bzero(mp->mnt_stat.f_mntonname, MNAMELEN);
+	if (path != NULL) {
+		(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1,
+			&size);
+	}
+
 	/*
 	 * Set NCALIASED so unmount won't complain about namecache refs
 	 * still existing.
@@ -286,6 +292,7 @@ nullfs_statfs(struct mount *mp, struct statfs *sbp, struct ucred *cred)
 	if (sbp != &mp->mnt_stat) {
 		bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid));
 		bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
+		bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
 	}
 	return (0);
 }
-- 
1.7.5.4


--LQksG6bCIzRHxTLp--





More information about the Submit mailing list