Skip to content

Commit ca76d2d

Browse files
cyrillosLinus Torvalds
authored andcommitted
UDF: fix UID and GID mount option ignorance
This patch fix weird behaviour of UDF mounting procedure. To get UID changed (for now) we have to type mount -t udf -o uid=some_user,uid=ignore /dev/device /mnt/moun_point and specifying two uid at once is strange a bit. So with the patch we are able to mount without additional 'uid=ignore' option. The same for GID option is done. This patch will not break current mount scheme (with two option). Btw this does fix (I hope) the following [BUG 6124] mount of UDF fs ignores UID and GID options http://bugzilla.kernel.org/show_bug.cgi?id=6124 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Jan Kara <jack@ucw.cz> Cc: Michael <auslands-kv@gmx.de> Cc: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f2912a1 commit ca76d2d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

fs/udf/inode.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,13 +1127,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
11271127
}
11281128

11291129
inode->i_uid = le32_to_cpu(fe->uid);
1130-
if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb,
1131-
UDF_FLAG_UID_IGNORE))
1130+
if (inode->i_uid == -1 ||
1131+
UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) ||
1132+
UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET))
11321133
inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
11331134

11341135
inode->i_gid = le32_to_cpu(fe->gid);
1135-
if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb,
1136-
UDF_FLAG_GID_IGNORE))
1136+
if (inode->i_gid == -1 ||
1137+
UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) ||
1138+
UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET))
11371139
inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
11381140

11391141
inode->i_nlink = le16_to_cpu(fe->fileLinkCount);

fs/udf/super.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,13 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
366366
if (match_int(args, &option))
367367
return 0;
368368
uopt->gid = option;
369+
uopt->flags |= (1 << UDF_FLAG_GID_SET);
369370
break;
370371
case Opt_uid:
371372
if (match_int(args, &option))
372373
return 0;
373374
uopt->uid = option;
375+
uopt->flags |= (1 << UDF_FLAG_UID_SET);
374376
break;
375377
case Opt_umask:
376378
if (match_octal(args, &option))

fs/udf/udf_sb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */
2525
#define UDF_FLAG_GID_FORGET 13
2626
#define UDF_FLAG_GID_IGNORE 14
27+
#define UDF_FLAG_UID_SET 15
28+
#define UDF_FLAG_GID_SET 16
2729

2830
#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001
2931
#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002

0 commit comments

Comments
 (0)