useradd: skip btrfs subvolume creation for system users#1619
useradd: skip btrfs subvolume creation for system users#1619silverhadch wants to merge 3 commits into
Conversation
|
The code seems good to me. Do we need to document that BTRFS configuration is ignored for system users? Also, I think the commit message should document why we don't want BTRFS subvolumes for system users. |
Subvolumes for non intercative users are wasteful as they multiply metadata operations and generate unneccesary filesystem objects for operations, a system user who doesnt generate snapshot worthy data, wont use. But I dont think its worth documenting as this is simply sane design. This BTRFS Backend never mattered to system users as the BTRFS Backend orginally released only supported interactive subvol creation. There is no usage for subvols (aka wasting metadata) for system users with state home dirs. |
Please copy this into the commit message.
This is still useful information for someone like me that has never used BTRFS and doesn't know anything about it other than the fact that it's a file system. :) I'd like to have it at least in the commit message. I don't care too much about the manual page. |
efd0339 to
f9906f3
Compare
Done. Documented in the commit message. |
f9906f3 to
2176bd2
Compare
hallyn
left a comment
There was a problem hiding this comment.
It seems to me this should be optional, no?
I don't think everyone would agree that every user under UID_MIN does not benefit from subvolumes.
How so? Why should a System User need to waste resources? |
|
I think this should be optional rather than hardcoded. Following the Unix philosophy of "mechanism, not policy," we should default the behavior to off (no subvolumes for system users). This addresses the performance concerns while providing a configuration toggle for edge cases or environments that still need it. My two cents |
|
Yup I'd be fine with making it the default to not create the subvolume for system users. |
|
@silverhadch do you mind making the change to make this non-default? |
Sure once I finish the Security fix then I will piçk up this PR again. |
|
On Wed, Jul 08, 2026 at 10:07:32PM -0700, Hadi Chokr wrote:
silverhadch left a comment (shadow-maint/shadow#1619)
> @silverhadch do you mind making the change to make this non-default?
Sure once I finish the Security fix then I will piçk up this PR again.
Awesome, thanks.
|
2176bd2 to
5a500aa
Compare
Gate subvolume creation on UID_MIN <= UID <= UID_MAX to exclude system users regardless of their home path. System users hold no snapshot-worthy data, so subvolumes for them just waste metadata and add filesystem objects nobody uses. The BTRFS backend was always aimed at interactive users anyway. However you can set BTRFS_SUBVOLUME_SYSTEM=yes in /etc/default/useradd to get the old behavior back. Has no effect unless subvolume creation is enabled in the first place. Document the new variable in useradd(8). Fixes: c1d36a8 (2019-05-04; "Add support for btrfs subvolumes for user homes") Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
Some minimal container images do not ship /etc/default, so writing /etc/default/useradd directly fails. Add a Shadow role helper that creates the directory when missing and writes the file. Both are reverted on teardown. Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
Check that a system user created with --btrfs-subvolume-home gets a plain home directory by default, and a subvolume when BTRFS_SUBVOLUME_SYSTEM=yes is set in /etc/default/useradd. Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
8ce8dca to
4532b9c
Compare
|
I abstain about this patch set. I'll say that the quality of the source code meets my expectations. I don't have an opinion on the feature itself. |
Who should I ask a review from? |
|
Gate subvolume creation on user_id >= UID_MIN to exclude system users regardless of their home path.
Fixes: c1d36a8 (2019-05-04; "Add support for btrfs subvolumes for user homes")