Apply the umask in VFS optionally

From: Andreas Gruenbacher (agruen@suse.de)
Date: Fri Aug 02 2002 - 14:05:00 EST


Hi all,

The umask(2) is usually applied to the mode parameters to open(2), mkdir(2),
creat(2) and mknod(2) in the VFS. With POSIX Access Control Lists the umask
must only be applied in some situations, and must have no effect in others.
Currently there is no way for a file system to find out the original mode
parameter passed to the system calls.

There are two ways to solve this problem, namely, to (1) move the code that
applies the umask into the file systems, or to (2) apply the umask in the VFS
optionally only. Option (1) is intrusive on existing file systems, and might
introduce bugs, while (2) slightly complicates the VFS, but leaves file
systems unaffected.

I believe that (2) is the more reasonable choice in this case, so I propose
this patch, which adds the MS_NOUMASK mount option. The flag is set by the
file system, if the file system does not want the VFS to apply the umask,
after which the file system itself is responsible for applying the umask
where appropriate.

Finally, I have a question related to this. We had a bug with kernel tasks,
which don't have a umask associated with them (nfsd in particular). Should
kernel tasks that create files be required to have a valid fs_struct (which
includes the umask), or should this be special cased in file systems?

Regards,
Andreas.

------------------------------------------------------------------
 Andreas Gruenbacher SuSE Linux AG
 mailto:agruen@suse.de Deutschherrnstr. 15-19
 http://www.suse.de/ D-90429 Nuernberg, Germany



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Aug 07 2002 - 22:00:20 EST