Commit 9780eb6cfaf7d2d5ccc061eaf94e7aec6a17791e
1 parent
83cab5338f
Exists in
master
and in
7 other branches
ocfs2: correctly set i_blocks after inline dir gets expanded
We were setting i_blocks based on allocation before the extent insert, which is wrong as the value is a calculation based on ip_clusters which gets updated as a result of the insert. This patch moves the line in question to just after the call to ocfs2_insert_extent(). Without this fix, inline directories were temporarily having an i_blocks value of zero immediately after expansion to extents. Reported-and-tested-by: Tristan Ye <tristan.ye@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
fs/ocfs2/dir.c
... | ... | @@ -1300,7 +1300,6 @@ |
1300 | 1300 | di->i_size = cpu_to_le64(sb->s_blocksize); |
1301 | 1301 | di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); |
1302 | 1302 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); |
1303 | - dir->i_blocks = ocfs2_inode_sector_count(dir); | |
1304 | 1303 | |
1305 | 1304 | /* |
1306 | 1305 | * This should never fail as our extent list is empty and all |
... | ... | @@ -1312,6 +1311,12 @@ |
1312 | 1311 | mlog_errno(ret); |
1313 | 1312 | goto out_commit; |
1314 | 1313 | } |
1314 | + | |
1315 | + /* | |
1316 | + * Set i_blocks after the extent insert for the most up to | |
1317 | + * date ip_clusters value. | |
1318 | + */ | |
1319 | + dir->i_blocks = ocfs2_inode_sector_count(dir); | |
1315 | 1320 | |
1316 | 1321 | ret = ocfs2_journal_dirty(handle, di_bh); |
1317 | 1322 | if (ret) { |