Skip to content

Conversation

@dusan-gvozdenovic
Copy link

@dusan-gvozdenovic dusan-gvozdenovic commented Dec 1, 2025

Motivation and Context

When upgrading from an older version of ZFS which does not have project quotas to a version of OpenZFS which does, after a zpool upgrade, the feature remains enabled but not active and project operations fail with ENOTSUP, rendering it unusable until a given objset is re-opened.

This was observed with an upgrade from ZoL 0.7.1 to OpenZFS 2.3.

Fixes #17955

Description

  • On dmu_objset_open_impl(), if project quotas are present on the pool, a dnode is allocated to hold/refer to the projectused ZAP object and assigned to an in-memory objset field os_projectused_dnode.
  • os_projectused_dnode is used to decide whether project quotas are enabled for a given objset.
  • After a pool upgrade which enables project quotas, all open objsets still have os_projectused_dnode == NULL. For this reason dmu_objset_projectquota_enabled() will always be false, and actual upgrade will not happen until the objset is re-opened.

It seems like a similar issue has been happening with user quotas back in the day and the solution was to suspend and resume the affected file systems in order to re-initialize the affected object sets (see zfs_prop_set_special()zfs_ioc_userspace_upgrade()). So analogously, we suspend+resume all the pool's affected file systems to re-initialize their associated object sets when feature@project_quota is set and os_projectused_dnode is NULL.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:


error = spa_prop_set(spa, props);

if ((error == 0) && nvlist_exists(props, "feature@project_quota"))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feature@project_quota is hard coded though I am not sure if I should write a function to get the name from SPA_FEATURE_PROJECT_QUOTA just to be used here.

@dusan-gvozdenovic dusan-gvozdenovic force-pushed the projectquota-pool-upgrade branch 2 times, most recently from fcef7f1 to 63dd016 Compare December 1, 2025 17:34
@dusan-gvozdenovic dusan-gvozdenovic marked this pull request as draft December 3, 2025 11:17
@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Dec 3, 2025
@dusan-gvozdenovic dusan-gvozdenovic force-pushed the projectquota-pool-upgrade branch 2 times, most recently from 069fac4 to 6c302ac Compare December 6, 2025 10:29
@dusan-gvozdenovic dusan-gvozdenovic marked this pull request as ready for review December 6, 2025 10:30
@github-actions github-actions bot added Status: Code Review Needed Ready for review and testing and removed Status: Work in Progress Not yet ready for general review labels Dec 6, 2025
Addresses the issue of project quotas not being usable after pool
upgrade coming from an older version which does not support project
quotas to the one that does, similarly to how it was solved for user
quotas back in the day with `zfs set version=current` -- when
feature@project_quota is first enabled, re-initialize the pool's
objsets.

Signed-off-by: Dušan Gvozdenović <[email protected]>
Closes openzfs#17955
@dusan-gvozdenovic dusan-gvozdenovic force-pushed the projectquota-pool-upgrade branch from 6c302ac to 3566fc6 Compare December 6, 2025 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project quotas not usable after an older pool upgrade

1 participant