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

udf: Ignore [ug]id=ignore mount options

Currently uid=ignore and gid=ignore make no sense without uid=<number>
and gid=<number> respectively as they result in all files having invalid
uid / gid which then doesn't allow even root to modify files and thus
causes confusion. And since commit ca76d2d8031f "UDF: fix UID and GID
mount option ignorance" (from over 10 years ago) uid=<number> overrides
all uids on disk as uid=ignore does. So just silently ignore uid=ignore
mount option.

Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>

Jan Kara 70260e44 7b78fd02

+8 -18
-2
fs/udf/inode.c
··· 1402 1402 read_lock(&sbi->s_cred_lock); 1403 1403 i_uid_write(inode, le32_to_cpu(fe->uid)); 1404 1404 if (!uid_valid(inode->i_uid) || 1405 - UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) || 1406 1405 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET)) 1407 1406 inode->i_uid = UDF_SB(inode->i_sb)->s_uid; 1408 1407 1409 1408 i_gid_write(inode, le32_to_cpu(fe->gid)); 1410 1409 if (!gid_valid(inode->i_gid) || 1411 - UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) || 1412 1410 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET)) 1413 1411 inode->i_gid = UDF_SB(inode->i_sb)->s_gid; 1414 1412
+2 -8
fs/udf/super.c
··· 348 348 seq_puts(seq, ",shortad"); 349 349 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_FORGET)) 350 350 seq_puts(seq, ",uid=forget"); 351 - if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_IGNORE)) 352 - seq_puts(seq, ",uid=ignore"); 353 351 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_FORGET)) 354 352 seq_puts(seq, ",gid=forget"); 355 - if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE)) 356 - seq_puts(seq, ",gid=ignore"); 357 353 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET)) 358 354 seq_printf(seq, ",uid=%u", from_kuid(&init_user_ns, sbi->s_uid)); 359 355 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) ··· 605 609 uopt->flags |= (1 << UDF_FLAG_NLS_MAP); 606 610 break; 607 611 #endif 608 - case Opt_uignore: 609 - uopt->flags |= (1 << UDF_FLAG_UID_IGNORE); 610 - break; 611 612 case Opt_uforget: 612 613 uopt->flags |= (1 << UDF_FLAG_UID_FORGET); 613 614 break; 615 + case Opt_uignore: 614 616 case Opt_gignore: 615 - uopt->flags |= (1 << UDF_FLAG_GID_IGNORE); 617 + /* These options are superseeded by uid=<number> */ 616 618 break; 617 619 case Opt_gforget: 618 620 uopt->flags |= (1 << UDF_FLAG_GID_FORGET);
+6 -8
fs/udf/udf_sb.h
··· 23 23 #define UDF_FLAG_NLS_MAP 9 24 24 #define UDF_FLAG_UTF8 10 25 25 #define UDF_FLAG_UID_FORGET 11 /* save -1 for uid to disk */ 26 - #define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */ 27 - #define UDF_FLAG_GID_FORGET 13 28 - #define UDF_FLAG_GID_IGNORE 14 29 - #define UDF_FLAG_UID_SET 15 30 - #define UDF_FLAG_GID_SET 16 31 - #define UDF_FLAG_SESSION_SET 17 32 - #define UDF_FLAG_LASTBLOCK_SET 18 33 - #define UDF_FLAG_BLOCKSIZE_SET 19 26 + #define UDF_FLAG_GID_FORGET 12 27 + #define UDF_FLAG_UID_SET 13 28 + #define UDF_FLAG_GID_SET 14 29 + #define UDF_FLAG_SESSION_SET 15 30 + #define UDF_FLAG_LASTBLOCK_SET 16 31 + #define UDF_FLAG_BLOCKSIZE_SET 17 34 32 35 33 #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 36 34 #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002