aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_icache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_icache.c')
-rw-r--r--fs/xfs/xfs_icache.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 30eafad7cf19..bf2d60749278 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -63,6 +63,9 @@ xfs_inode_alloc(
63 return NULL; 63 return NULL;
64 } 64 }
65 65
66 /* VFS doesn't initialise i_mode! */
67 VFS_I(ip)->i_mode = 0;
68
66 XFS_STATS_INC(mp, vn_active); 69 XFS_STATS_INC(mp, vn_active);
67 ASSERT(atomic_read(&ip->i_pincount) == 0); 70 ASSERT(atomic_read(&ip->i_pincount) == 0);
68 ASSERT(!spin_is_locked(&ip->i_flags_lock)); 71 ASSERT(!spin_is_locked(&ip->i_flags_lock));
@@ -98,7 +101,7 @@ void
98xfs_inode_free( 101xfs_inode_free(
99 struct xfs_inode *ip) 102 struct xfs_inode *ip)
100{ 103{
101 switch (ip->i_d.di_mode & S_IFMT) { 104 switch (VFS_I(ip)->i_mode & S_IFMT) {
102 case S_IFREG: 105 case S_IFREG:
103 case S_IFDIR: 106 case S_IFDIR:
104 case S_IFLNK: 107 case S_IFLNK:
@@ -151,12 +154,14 @@ xfs_reinit_inode(
151 uint32_t nlink = inode->i_nlink; 154 uint32_t nlink = inode->i_nlink;
152 uint32_t generation = inode->i_generation; 155 uint32_t generation = inode->i_generation;
153 uint64_t version = inode->i_version; 156 uint64_t version = inode->i_version;
157 umode_t mode = inode->i_mode;
154 158
155 error = inode_init_always(mp->m_super, inode); 159 error = inode_init_always(mp->m_super, inode);
156 160
157 set_nlink(inode, nlink); 161 set_nlink(inode, nlink);
158 inode->i_generation = generation; 162 inode->i_generation = generation;
159 inode->i_version = version; 163 inode->i_version = version;
164 inode->i_mode = mode;
160 return error; 165 return error;
161} 166}
162 167
@@ -211,7 +216,7 @@ xfs_iget_cache_hit(
211 /* 216 /*
212 * If lookup is racing with unlink return an error immediately. 217 * If lookup is racing with unlink return an error immediately.
213 */ 218 */
214 if (ip->i_d.di_mode == 0 && !(flags & XFS_IGET_CREATE)) { 219 if (VFS_I(ip)->i_mode == 0 && !(flags & XFS_IGET_CREATE)) {
215 error = -ENOENT; 220 error = -ENOENT;
216 goto out_error; 221 goto out_error;
217 } 222 }
@@ -321,7 +326,7 @@ xfs_iget_cache_miss(
321 326
322 trace_xfs_iget_miss(ip); 327 trace_xfs_iget_miss(ip);
323 328
324 if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) { 329 if ((VFS_I(ip)->i_mode == 0) && !(flags & XFS_IGET_CREATE)) {
325 error = -ENOENT; 330 error = -ENOENT;
326 goto out_destroy; 331 goto out_destroy;
327 } 332 }
@@ -470,7 +475,7 @@ again:
470 * If we have a real type for an on-disk inode, we can setup the inode 475 * If we have a real type for an on-disk inode, we can setup the inode
471 * now. If it's a new inode being created, xfs_ialloc will handle it. 476 * now. If it's a new inode being created, xfs_ialloc will handle it.
472 */ 477 */
473 if (xfs_iflags_test(ip, XFS_INEW) && ip->i_d.di_mode != 0) 478 if (xfs_iflags_test(ip, XFS_INEW) && VFS_I(ip)->i_mode != 0)
474 xfs_setup_existing_inode(ip); 479 xfs_setup_existing_inode(ip);
475 return 0; 480 return 0;
476 481