UDF: fix UID and GID mount option ignorance
authorCyrill Gorcunov <gorcunov@gmail.com>
Tue, 31 Jul 2007 07:39:40 +0000 (00:39 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 31 Jul 2007 22:39:43 +0000 (15:39 -0700)
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>
fs/udf/inode.c
fs/udf/super.c
fs/udf/udf_sb.h

index 0d2c41666cd28d877ce10f72e8782ecf0cbeaf81..1652b2c665bb08f1df27eb51d6029ac06fb14d64 100644 (file)
@@ -1127,13 +1127,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
        }
 
        inode->i_uid = le32_to_cpu(fe->uid);
-       if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb,
-                                                UDF_FLAG_UID_IGNORE))
+       if (inode->i_uid == -1 ||
+           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_gid = le32_to_cpu(fe->gid);
-       if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb,
-                                                UDF_FLAG_GID_IGNORE))
+       if (inode->i_gid == -1 ||
+           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_nlink = le16_to_cpu(fe->fileLinkCount);
index 7b30964665dbebd7f39002ff26d6cfd9ecd3921f..382be7be5ae34e66b6619d5c7bab8e20852edd48 100644 (file)
@@ -366,11 +366,13 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
                        if (match_int(args, &option))
                                return 0;
                        uopt->gid = option;
+                       uopt->flags |= (1 << UDF_FLAG_GID_SET);
                        break;
                case Opt_uid:
                        if (match_int(args, &option))
                                return 0;
                        uopt->uid = option;
+                       uopt->flags |= (1 << UDF_FLAG_UID_SET);
                        break;
                case Opt_umask:
                        if (match_octal(args, &option))
index 3e937d3fb8f99b12b24515943eec3b30f81815ad..3c2982017c6da50d14437391e1f985d036ffcae8 100644 (file)
@@ -24,6 +24,8 @@
 #define UDF_FLAG_UID_IGNORE     12    /* use sb uid instead of on disk uid */
 #define UDF_FLAG_GID_FORGET     13
 #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_TABLE    0x0002