aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/nilfs.h
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-01-19 12:09:53 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-03-08 00:58:29 -0500
commitb253a3e4f2b8eed69b804952ef926df0ac788595 (patch)
treefc111c5401f15cd5421fc73372d3f4589716af4f /fs/nilfs2/nilfs.h
parent32f4aeb31583a85c1e9a5d6d485055c090cebbfb (diff)
nilfs2: tighten restrictions on inode flags
Nilfs has few rectrictions on which flags may be set on which inodes like ext2/3/4 filesystems used to be. 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. This introduces a flags masking function like those of extN and uses it during inode creation. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/nilfs.h')
-rw-r--r--fs/nilfs2/nilfs.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index 777e8fd04304..3e3acb1fdd2f 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -212,6 +212,23 @@ static inline int nilfs_init_acl(struct inode *inode, struct inode *dir)
212 212
213#define NILFS_ATIME_DISABLE 213#define NILFS_ATIME_DISABLE
214 214
215/* Flags that should be inherited by new inodes from their parent. */
216#define NILFS_FL_INHERITED \
217 (FS_SECRM_FL | FS_UNRM_FL | FS_COMPR_FL | FS_SYNC_FL | \
218 FS_IMMUTABLE_FL | FS_APPEND_FL | FS_NODUMP_FL | FS_NOATIME_FL |\
219 FS_COMPRBLK_FL | FS_NOCOMP_FL | FS_NOTAIL_FL | FS_DIRSYNC_FL)
220
221/* Mask out flags that are inappropriate for the given type of inode. */
222static inline __u32 nilfs_mask_flags(umode_t mode, __u32 flags)
223{
224 if (S_ISDIR(mode))
225 return flags;
226 else if (S_ISREG(mode))
227 return flags & ~(FS_DIRSYNC_FL | FS_TOPDIR_FL);
228 else
229 return flags & (FS_NODUMP_FL | FS_NOATIME_FL);
230}
231
215/* dir.c */ 232/* dir.c */
216extern int nilfs_add_link(struct dentry *, struct inode *); 233extern int nilfs_add_link(struct dentry *, struct inode *);
217extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *); 234extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *);