Commit ca76d2d8 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Linus Torvalds

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=6124Signed-off-by: default avatarCyrill 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f2912a12
...@@ -1127,13 +1127,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) ...@@ -1127,13 +1127,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
} }
inode->i_uid = le32_to_cpu(fe->uid); inode->i_uid = le32_to_cpu(fe->uid);
if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb, if (inode->i_uid == -1 ||
UDF_FLAG_UID_IGNORE)) UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) ||
UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET))
inode->i_uid = UDF_SB(inode->i_sb)->s_uid; inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
inode->i_gid = le32_to_cpu(fe->gid); inode->i_gid = le32_to_cpu(fe->gid);
if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb, if (inode->i_gid == -1 ||
UDF_FLAG_GID_IGNORE)) UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) ||
UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET))
inode->i_gid = UDF_SB(inode->i_sb)->s_gid; inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
inode->i_nlink = le16_to_cpu(fe->fileLinkCount); inode->i_nlink = le16_to_cpu(fe->fileLinkCount);
......
...@@ -366,11 +366,13 @@ static int udf_parse_options(char *options, struct udf_options *uopt) ...@@ -366,11 +366,13 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
if (match_int(args, &option)) if (match_int(args, &option))
return 0; return 0;
uopt->gid = option; uopt->gid = option;
uopt->flags |= (1 << UDF_FLAG_GID_SET);
break; break;
case Opt_uid: case Opt_uid:
if (match_int(args, &option)) if (match_int(args, &option))
return 0; return 0;
uopt->uid = option; uopt->uid = option;
uopt->flags |= (1 << UDF_FLAG_UID_SET);
break; break;
case Opt_umask: case Opt_umask:
if (match_octal(args, &option)) if (match_octal(args, &option))
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */ #define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */
#define UDF_FLAG_GID_FORGET 13 #define UDF_FLAG_GID_FORGET 13
#define UDF_FLAG_GID_IGNORE 14 #define UDF_FLAG_GID_IGNORE 14
#define UDF_FLAG_UID_SET 15
#define UDF_FLAG_GID_SET 16
#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001
#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment