diff options
Diffstat (limited to 'fs/jfs/jfs_inode.c')
-rw-r--r-- | fs/jfs/jfs_inode.c | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 2af5efbfd06f..495df402916d 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c | |||
@@ -25,6 +25,26 @@ | |||
25 | #include "jfs_dinode.h" | 25 | #include "jfs_dinode.h" |
26 | #include "jfs_debug.h" | 26 | #include "jfs_debug.h" |
27 | 27 | ||
28 | |||
29 | void jfs_set_inode_flags(struct inode *inode) | ||
30 | { | ||
31 | unsigned int flags = JFS_IP(inode)->mode2; | ||
32 | |||
33 | inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | | ||
34 | S_NOATIME | S_DIRSYNC | S_SYNC); | ||
35 | |||
36 | if (flags & JFS_IMMUTABLE_FL) | ||
37 | inode->i_flags |= S_IMMUTABLE; | ||
38 | if (flags & JFS_APPEND_FL) | ||
39 | inode->i_flags |= S_APPEND; | ||
40 | if (flags & JFS_NOATIME_FL) | ||
41 | inode->i_flags |= S_NOATIME; | ||
42 | if (flags & JFS_DIRSYNC_FL) | ||
43 | inode->i_flags |= S_DIRSYNC; | ||
44 | if (flags & JFS_SYNC_FL) | ||
45 | inode->i_flags |= S_SYNC; | ||
46 | } | ||
47 | |||
28 | /* | 48 | /* |
29 | * NAME: ialloc() | 49 | * NAME: ialloc() |
30 | * | 50 | * |
@@ -63,6 +83,13 @@ struct inode *ialloc(struct inode *parent, umode_t mode) | |||
63 | inode->i_gid = current->fsgid; | 83 | inode->i_gid = current->fsgid; |
64 | 84 | ||
65 | /* | 85 | /* |
86 | * New inodes need to save sane values on disk when | ||
87 | * uid & gid mount options are used | ||
88 | */ | ||
89 | jfs_inode->saved_uid = inode->i_uid; | ||
90 | jfs_inode->saved_gid = inode->i_gid; | ||
91 | |||
92 | /* | ||
66 | * Allocate inode to quota. | 93 | * Allocate inode to quota. |
67 | */ | 94 | */ |
68 | if (DQUOT_ALLOC_INODE(inode)) { | 95 | if (DQUOT_ALLOC_INODE(inode)) { |
@@ -74,10 +101,20 @@ struct inode *ialloc(struct inode *parent, umode_t mode) | |||
74 | } | 101 | } |
75 | 102 | ||
76 | inode->i_mode = mode; | 103 | inode->i_mode = mode; |
77 | if (S_ISDIR(mode)) | 104 | /* inherit flags from parent */ |
78 | jfs_inode->mode2 = IDIRECTORY | mode; | 105 | jfs_inode->mode2 = JFS_IP(parent)->mode2 & JFS_FL_INHERIT; |
79 | else | 106 | |
80 | jfs_inode->mode2 = INLINEEA | ISPARSE | mode; | 107 | if (S_ISDIR(mode)) { |
108 | jfs_inode->mode2 |= IDIRECTORY; | ||
109 | jfs_inode->mode2 &= ~JFS_DIRSYNC_FL; | ||
110 | } | ||
111 | else { | ||
112 | jfs_inode->mode2 |= INLINEEA | ISPARSE; | ||
113 | if (S_ISLNK(mode)) | ||
114 | jfs_inode->mode2 &= ~(JFS_IMMUTABLE_FL|JFS_APPEND_FL); | ||
115 | } | ||
116 | jfs_inode->mode2 |= mode; | ||
117 | |||
81 | inode->i_blksize = sb->s_blocksize; | 118 | inode->i_blksize = sb->s_blocksize; |
82 | inode->i_blocks = 0; | 119 | inode->i_blocks = 0; |
83 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 120 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
@@ -98,6 +135,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode) | |||
98 | jfs_inode->atlhead = 0; | 135 | jfs_inode->atlhead = 0; |
99 | jfs_inode->atltail = 0; | 136 | jfs_inode->atltail = 0; |
100 | jfs_inode->xtlid = 0; | 137 | jfs_inode->xtlid = 0; |
138 | jfs_set_inode_flags(inode); | ||
101 | 139 | ||
102 | jfs_info("ialloc returns inode = 0x%p\n", inode); | 140 | jfs_info("ialloc returns inode = 0x%p\n", inode); |
103 | 141 | ||