Commit 6e4b0d5692cd27d3c9be893a9f5939a9cafbb09f
Committed by
Mark Fasheh
1 parent
5c2c9d383e
Exists in
master
and in
7 other branches
[PATCH] Copy i_flags to ocfs2 inode flags on write
Propagate flags such as S_APPEND, S_IMMUTABLE, etc. from i_flags into ocfs2-specific ip_attr. Hence, when someone sets these flags via a different interface than ioctl, they are stored correctly. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Showing 3 changed files with 22 additions and 0 deletions Side-by-side Diff
fs/ocfs2/inode.c
... | ... | @@ -89,6 +89,25 @@ |
89 | 89 | inode->i_flags |= S_DIRSYNC; |
90 | 90 | } |
91 | 91 | |
92 | +/* Propagate flags from i_flags to OCFS2_I(inode)->ip_attr */ | |
93 | +void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi) | |
94 | +{ | |
95 | + unsigned int flags = oi->vfs_inode.i_flags; | |
96 | + | |
97 | + oi->ip_attr &= ~(OCFS2_SYNC_FL|OCFS2_APPEND_FL| | |
98 | + OCFS2_IMMUTABLE_FL|OCFS2_NOATIME_FL|OCFS2_DIRSYNC_FL); | |
99 | + if (flags & S_SYNC) | |
100 | + oi->ip_attr |= OCFS2_SYNC_FL; | |
101 | + if (flags & S_APPEND) | |
102 | + oi->ip_attr |= OCFS2_APPEND_FL; | |
103 | + if (flags & S_IMMUTABLE) | |
104 | + oi->ip_attr |= OCFS2_IMMUTABLE_FL; | |
105 | + if (flags & S_NOATIME) | |
106 | + oi->ip_attr |= OCFS2_NOATIME_FL; | |
107 | + if (flags & S_DIRSYNC) | |
108 | + oi->ip_attr |= OCFS2_DIRSYNC_FL; | |
109 | +} | |
110 | + | |
92 | 111 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags) |
93 | 112 | { |
94 | 113 | struct inode *inode = NULL; |
... | ... | @@ -1199,6 +1218,7 @@ |
1199 | 1218 | |
1200 | 1219 | spin_lock(&OCFS2_I(inode)->ip_lock); |
1201 | 1220 | fe->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters); |
1221 | + ocfs2_get_inode_flags(OCFS2_I(inode)); | |
1202 | 1222 | fe->i_attr = cpu_to_le32(OCFS2_I(inode)->ip_attr); |
1203 | 1223 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
1204 | 1224 |
fs/ocfs2/inode.h
... | ... | @@ -141,6 +141,7 @@ |
141 | 141 | int ocfs2_aio_write(struct file *file, struct kiocb *req, struct iocb *iocb); |
142 | 142 | |
143 | 143 | void ocfs2_set_inode_flags(struct inode *inode); |
144 | +void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi); | |
144 | 145 | |
145 | 146 | static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode) |
146 | 147 | { |