zfsonfreebsd / ZoF

ZFS on FreeBSD - the official out of tree OpenZFS implementation for FreeBSD
https://freebsd.org
Other
100 stars 8 forks source link

feature@userobj_accounting doesn't take effect immediately on upgrade #148

Closed ghost closed 4 years ago

ghost commented 4 years ago

The feature works as expected when enabled by default:

buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zpool create p0 $PWD/disk0
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo touch /p0/foo
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zfs userspace -o objused p0
OBJUSED
      3

The feature works as expected when not enabled:

buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zpool destroy p0
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zpool create -d p0 $PWD/disk0
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo touch /p0/foo
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zfs userspace -o objused p0
OBJUSED
      -

The feature is enabled by upgrade:

buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zpool upgrade p0 | grep userobj_accounting
  userobj_accounting

However, the feature does not become active upon the first use:

buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo touch /p0/foo
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zfs userspace -o objused p0
OBJUSED
      -
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zpool get feature@userobj_accounting p0
NAME  PROPERTY                    VALUE                       SOURCE
p0    feature@userobj_accounting  enabled                     local
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zfs userspace -o objused p0
OBJUSED
      -

Even more strangely, the feature does activate with a second attempt:

buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo touch /p0/bar
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zfs userspace -o objused p0
OBJUSED
      4
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $ sudo zpool get feature@userobj_accounting p0
NAME  PROPERTY                    VALUE                       SOURCE
p0    feature@userobj_accounting  active                      local
buildbot-worker@FreeBSD-13_0-CURRENT-r354935:~ $

The expectation is that it should be activated by the first file.

ghost commented 4 years ago

Fixed.