On Thu, Sep 01, 2011 at 11:38:42PM +0200, Francois Tigeot wrote:
> 
> The initial name of the mount point can only be known from the
> nullfs_mount function; if this patch is not applied, VOP_STATFS will
> never be able to return the correct values.

New patch attached.

-- 
Francois Tigeot
>From 8648f8f4f2e0a2797f8230d70c3046808fcd40d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Tigeot?= <[email protected]>
Date: Sun, 14 Aug 2011 15:13:30 +0200
Subject: [PATCH] Fix a bug in nullfs_mount() and nullfs_statfs()

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

Reply via email to