ext4: tighten restrictions on inode flags
authorDuane Griffin <duaneg@dghda.com>
Tue, 2 Jun 2009 12:09:19 +0000 (08:09 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 12 Jun 2009 03:01:44 +0000 (20:01 -0700)
commit3af274c2681fad65f2fd5c0d4495f1b683100561
tree667aec7b90109ff7e26b5baad6568d08415451cd
parentaba1b58ea51c55c00afdcc6efc1cd2f4fdecf20b
ext4: tighten restrictions on inode flags

(cherry picked from commit 2dc6b0d48ca0599837df21b14bb8393d0804af57)

At the moment there are few restrictions on which flags may be set on
which inodes.  Specifically DIRSYNC may only be set on directories and
IMMUTABLE and APPEND may not be set on links.  Tighten that to disallow
TOPDIR being set on non-directories and only NODUMP and NOATIME to be set
on non-regular file, non-directories.

Introduces a flags masking function which masks flags based on mode and
use it during inode creation and when flags are set via the ioctl to
facilitate future consistency.

Signed-off-by: Duane Griffin <duaneg@dghda.com>
Acked-by: Andreas Dilger <adilger@sun.com>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/ext4.h
fs/ext4/ialloc.c
fs/ext4/ioctl.c