Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: add support for 32-bit default reserved uid and gid values

Support for specifying the default user id and group id that is
allowed to use the reserved block space was added way back when Linux
only supported 16-bit uid's and gid's. (Yeah, that long ago.) It's
not a commonly used feature, but let's add support for 32-bit user and
group id's.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Message-ID: <20250916-tune2fs-v2-2-d594dc7486f0@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

+19 -5
+15 -1
fs/ext4/ext4.h
··· 1442 1442 __le16 s_encoding; /* Filename charset encoding */ 1443 1443 __le16 s_encoding_flags; /* Filename charset encoding flags */ 1444 1444 __le32 s_orphan_file_inum; /* Inode for tracking orphan inodes */ 1445 - __le32 s_reserved[94]; /* Padding to the end of the block */ 1445 + __le16 s_def_resuid_hi; 1446 + __le16 s_def_resgid_hi; 1447 + __le32 s_reserved[93]; /* Padding to the end of the block */ 1446 1448 __le32 s_checksum; /* crc32c(superblock) */ 1447 1449 }; 1448 1450 ··· 1812 1810 return ino == EXT4_ROOT_INO || 1813 1811 (ino >= EXT4_FIRST_INO(sb) && 1814 1812 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); 1813 + } 1814 + 1815 + static inline int ext4_get_resuid(struct ext4_super_block *es) 1816 + { 1817 + return le16_to_cpu(es->s_def_resuid) | 1818 + le16_to_cpu(es->s_def_resuid_hi) << 16; 1819 + } 1820 + 1821 + static inline int ext4_get_resgid(struct ext4_super_block *es) 1822 + { 1823 + return le16_to_cpu(es->s_def_resgid) | 1824 + le16_to_cpu(es->s_def_resgid_hi) << 16; 1815 1825 } 1816 1826 1817 1827 /*
+4 -4
fs/ext4/super.c
··· 2960 2960 } 2961 2961 2962 2962 if (nodefs || !uid_eq(sbi->s_resuid, make_kuid(&init_user_ns, EXT4_DEF_RESUID)) || 2963 - le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) 2963 + ext4_get_resuid(es) != EXT4_DEF_RESUID) 2964 2964 SEQ_OPTS_PRINT("resuid=%u", 2965 2965 from_kuid_munged(&init_user_ns, sbi->s_resuid)); 2966 2966 if (nodefs || !gid_eq(sbi->s_resgid, make_kgid(&init_user_ns, EXT4_DEF_RESGID)) || 2967 - le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) 2967 + ext4_get_resgid(es) != EXT4_DEF_RESGID) 2968 2968 SEQ_OPTS_PRINT("resgid=%u", 2969 2969 from_kgid_munged(&init_user_ns, sbi->s_resgid)); 2970 2970 def_errors = nodefs ? -1 : le16_to_cpu(es->s_errors); ··· 5279 5279 5280 5280 ext4_set_def_opts(sb, es); 5281 5281 5282 - sbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid)); 5283 - sbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid)); 5282 + sbi->s_resuid = make_kuid(&init_user_ns, ext4_get_resuid(es)); 5283 + sbi->s_resgid = make_kgid(&init_user_ns, ext4_get_resuid(es)); 5284 5284 sbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ; 5285 5285 sbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME; 5286 5286 sbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;