Apply the umask in VFS optionally

From: Andreas Gruenbacher (
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?


 Andreas Gruenbacher SuSE Linux AG Deutschherrnstr. 15-19 D-90429 Nuernberg, Germany

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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