HAMMER VFS: record the name of the mount directory
authorFrancois Tigeot <ftigeot@wolfpond.org>
Mon, 15 Aug 2011 12:42:23 +0000 (14:42 +0200)
committerFran├žois Tigeot <ftigeot@wolfpond.org>
Tue, 13 Dec 2011 07:55:09 +0000 (08:55 +0100)
* It has to be set at mount time in mp->mnt_stat.f_mntonname.

* Contrary to most filesystems, Hammer didn't do it.

* The new code was taken from ffs_mount() and OpenBSD's vfs_rootmountalloc()

sys/vfs/hammer/hammer_vfsops.c

index 62a73c9..4b6103e 100644 (file)
@@ -792,6 +792,20 @@ hammer_vfs_mount(struct mount *mp, char *mntpt, caddr_t data,
                vflush(mp, 0, 0);
 
 done:
+       if ((mp->mnt_flag & MNT_UPDATE) == 0) {
+               /* New mount */
+
+               /* Populate info for mount point (NULL pad)*/
+               bzero(mp->mnt_stat.f_mntonname, MNAMELEN);
+               size_t size;
+               if (mntpt) {
+                       copyinstr(mntpt, mp->mnt_stat.f_mntonname,
+                                                       MNAMELEN -1, &size);
+               } else { /* Root mount */
+                       mp->mnt_stat.f_mntonname[0] = '/';
+               }
+       }
+       (void)VFS_STATFS(mp, &mp->mnt_stat, cred);
        hammer_rel_volume(rootvol, 0);
 failed:
        /*