openzfsonosx / zfs

OpenZFS on OS X
https://openzfsonosx.org/
Other
824 stars 72 forks source link

/etc/zfs/zsysctl.conf isn't loaded correctly at startup (Catalina, MacBook Pro 2018) #781

Open feiyax opened 3 years ago

feiyax commented 3 years ago

With ARC limits specified in /etc/zfs/zsysctl.conf, it appears that they are not loaded at start up correctly. Inspected with sysctl kstat | grep arc_max, the values are 0 after start up.

My system is a MacBook Pro 15-inch 2018 model, running the Catalina 10.15.7 (the latest). ZFS version is 1.9.4-0 (also the latest release.)

My /etc/zfs/zsysctl.conf has the following definition. (I read the Memory utilization wiki page)

kstat.zfs.darwin.tunable.zfs_arc_max=1073741824
kstat.zfs.darwin.tunable.zfs_arc_meta_limit=0x30000000

The log file is empty on my system: /private/var/log/org.openzfsonosx.zconfigd.log

The error log file has the following

$ cat /private/var/log/org.openzfsonosx.zconfigd.err 
Looking for service matching net_lundman_zfs_zvol
Starting the run loop
Found match
Running /usr/local/bin/zsysctl -f /etc/zfs/zsysctl.conf
top level name kstat in kstat.zfs.darwin.tunable.zfs_arc_max is invalid
Looking for service matching net_lundman_zfs_zvol
Starting the run loop
Found match
Running /usr/local/bin/zsysctl -f /etc/zfs/zsysctl.conf
top level name kstat in kstat.zfs.darwin.tunable.zfs_arc_max is invalid
Looking for service matching net_lundman_zfs_zvol
Starting the run loop
Found match
Running /usr/local/bin/zsysctl -f /etc/zfs/zsysctl.conf
top level name kstat in kstat.zfs.darwin.tunable.zfs_arc_max is invalid
top level name kstat in kstat.zfs.darwin.tunable.zfs_arc_meta_limit is invalid

I manually replayed the call /usr/local/bin/zsysctl -f /etc/zfs/zsysctl.conf since the above error shows it. It went through ok. Console logs below.

$ sudo /usr/local/bin/zsysctl -f /etc/zfs/zsysctl.conf
Password:
kstat.zfs.darwin.tunable.zfs_arc_max: 0 -> 1073741824
kstat.zfs.darwin.tunable.zfs_arc_meta_limit: 0 -> 805306368

Now it confuses me why isn't that file loaded correctly at start up. I'd appreciate any help on how to troubleshoot this issue. Thanks!

(I was suspecting a race condition somewhere such that it got called too early, but i don't know how to investigate that)