[PATCH] udf: fix uid/gid options and add uid/gid=ignore and forget options
Fix a bug in udf where it would write uid/gid = 0 to the disk for files owned by the id given with the uid=/gid= mount options. It also adds 4 new mount options: uid/gid=forget and uid/gid=ignore. Without any options the id in core and on disk always match. Giving uid/gid=nnn specifies a default ID to be used in core when the on disk ID is -1. uid/gid=ignore forces the in core ID to allways be used no matter what the on disk ID is. uid/gid=forget forces the on disk ID to always be written out as -1. The use of these options allows you to override ownerships on a disk or disable ownwership information from being written, allowing the media to be used portably between different computers and possibly different users without permissions issues that would require root to correct. Signed-off-by: Phillip Susi <psusi@cfl.rr.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
7f709ed0e3
commit
4d6660eb36
@@ -1045,10 +1045,14 @@ 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 ) inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
|
||||
if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb,
|
||||
UDF_FLAG_UID_IGNORE))
|
||||
inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
|
||||
|
||||
inode->i_gid = le32_to_cpu(fe->gid);
|
||||
if ( inode->i_gid == -1 ) inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
|
||||
if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb,
|
||||
UDF_FLAG_GID_IGNORE))
|
||||
inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
|
||||
|
||||
inode->i_nlink = le16_to_cpu(fe->fileLinkCount);
|
||||
if (!inode->i_nlink)
|
||||
@@ -1335,10 +1339,14 @@ udf_update_inode(struct inode *inode, int do_sync)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid)
|
||||
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
|
||||
fe->uid = cpu_to_le32(-1);
|
||||
else if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid)
|
||||
fe->uid = cpu_to_le32(inode->i_uid);
|
||||
|
||||
if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid)
|
||||
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET))
|
||||
fe->gid = cpu_to_le32(-1);
|
||||
else if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid)
|
||||
fe->gid = cpu_to_le32(inode->i_gid);
|
||||
|
||||
udfperms = ((inode->i_mode & S_IRWXO) ) |
|
||||
|
Reference in New Issue
Block a user