BjoKaSH / maczfs-archive

Legacy MacZFS - Archived here due Google-code shutdown. Automatically exported from code.google.com/p/maczfs -- Do Not Use! Use https://openzfsonosx.org/
Other
1 stars 0 forks source link

ZFS sub-file systems show up with the same name in the Finder #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a zpool. (GPT + slices)
2. Create a zfs sub-filesystem under that zpool.
3. Look at the mounted volume list in the Finder.

What is the expected output? What do you see instead?
Expected: ZFS sub-filesystems should display with appropriate names.
Instead: The sub-filesystems have exactly the same name as the zpool when 
displayed in the Finder.

What version of the product are you using? On what operating system?
MacZFS 74.0.1
Mac OS X 10.5.8 PPC

Please provide any additional information below.

Attached is test source code.
This code demonstrates that on Mac OS X 10.5.8 PPC, zfs sub-filesystems 
enumerated using Carbon show a volume name that matches the zpool parent.

---
$ zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
splish                   846G   980G   444K  /Volumes/splish
splish/bootbackup-base   846G   980G   846G  /Volumes/splish/bootbackup-base
splish/zfstest          88.2K   980G  88.2K  /Volumes/splish/zfstest

$ cc -o fslist fslist.c -framework CoreFoundation -framework IOKit -framework 
Carbon
$ ./fslist

Enumerating disks by getfsstat/getmntinfo
f_fstypename: hfs   f_mntfromname: /dev/disk1s10
f_fstypename: devfs f_mntfromname: devfs
f_fstypename: fdesc f_mntfromname: fdesc
f_fstypename: autofs    f_mntfromname: map -hosts
f_fstypename: autofs    f_mntfromname: map auto_home
f_fstypename: hfs   f_mntfromname: /dev/disk2s10
f_fstypename: hfs   f_mntfromname: /dev/disk3s3
f_fstypename: hfs   f_mntfromname: /dev/disk0s3
f_fstypename: zfs   f_mntfromname: splish
f_fstypename: zfs   f_mntfromname: splish/bootbackup-base
f_fstypename: zfs   f_mntfromname: splish/zfstest
f_fstypename: hfs   f_mntfromname: /dev/disk8

Enumerating disks by FSGetVolumeInfo
volRefNum: 1    CStringVolName: FastBoot
volRefNum: 2    CStringVolName: Raptor1
volRefNum: 3    CStringVolName: TBackup
volRefNum: 4    CStringVolName: BootBackup
volRefNum: 5    CStringVolName: splish
volRefNum: 6    CStringVolName: splish
volRefNum: 7    CStringVolName: splish
volRefNum: 8    CStringVolName: tempmonhfs

Original issue reported on code.google.com by sbyt...@gmail.com on 29 Mar 2011 at 2:40

Attachments:

GoogleCodeExporter commented 9 years ago
I noticed this also happens on OS version 10.6.7 (Intel). Directory names 
inside Finder appear ok, but the sidebar is where I see it. The problem also 
effects the Dock, where the shortcut folders on the far right call it by the 
vpool name instead of the filesystem name.

Original comment by druro...@gmail.com on 25 Apr 2011 at 7:53

GoogleCodeExporter commented 9 years ago
same on Lion with 74.1.0.

Original comment by jt...@imperial.ac.uk on 7 Aug 2011 at 11:17

GoogleCodeExporter commented 9 years ago
Diff that apparently fixes this:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/usr/src/uts/common/fs/zfs/zfs_vfsops.c 
b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
index 2d63527..3ff144b 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
@@ -1560,7 +1560,14 @@ zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp)
    if (VFSATTR_IS_ACTIVE(fsap, f_vol_name)) {
        spa_t *spa = dmu_objset_spa(zfsvfs->z_os);
        spa_config_enter(spa, RW_READER, FTAG);
-       strlcpy(fsap->f_vol_name, spa_name(spa), MAXPATHLEN);
+       //strlcpy(fsap->f_vol_name, spa_name(spa), MAXPATHLEN);
+       char *volname = strrchr(vfs_statfs(zfsvfs->z_vfs)->f_mntonname, '/');
+       if (volname && (*(&volname[1]) != '\0')) {
+           strlcpy(fsap->f_vol_name, &volname[1], MAXPATHLEN);
+       } else {
+           strlcpy(fsap->f_vol_name, vfs_statfs(zfsvfs->z_vfs)->f_mntfromname,
+                   MAXPATHLEN);
+       }
        spa_config_exit(spa, FTAG);
        VFSATTR_SET_SUPPORTED(fsap, f_vol_name);
    }

Original comment by alex.ble...@gmail.com on 4 Nov 2013 at 1:48

GoogleCodeExporter commented 9 years ago
Thanks Alex, I'll try to test this weekend and put it into the next 74.3.2. 

It is good to have you back on board!

Original comment by googlelogin@bjoern-kahl.de on 22 Nov 2013 at 9:41

GoogleCodeExporter commented 9 years ago

Original comment by googlelogin@bjoern-kahl.de on 28 Jul 2015 at 9:59