Skip to content

Commit 9780eb6

Browse files
author
Mark Fasheh
committed
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>
1 parent 83cab53 commit 9780eb6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎fs/ocfs2/dir.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,6 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
13001300
di->i_size = cpu_to_le64(sb->s_blocksize);
13011301
di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec);
13021302
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);
13041303

13051304
/*
13061305
* This should never fail as our extent list is empty and all
@@ -1313,6 +1312,12 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
13131312
goto out_commit;
13141313
}
13151314

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);
1320+
13161321
ret = ocfs2_journal_dirty(handle, di_bh);
13171322
if (ret) {
13181323
mlog_errno(ret);

0 commit comments

Comments
 (0)