ocfs2: Hold ip_lock when set/clear flags for indexed dir.

When we set/clear the dyn_features for an inode we hold the ip_lock.
So do it when we set/clear OCFS2_INDEXED_DIR_FL also.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

authored by Tao Ma and committed by Joel Becker 8ac33dc8 41b41a26

+4
+4
fs/ocfs2/dir.c
··· 2461 2462 di->i_dx_root = cpu_to_le64(dr_blkno); 2463 2464 OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL; 2465 di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); 2466 2467 ocfs2_journal_dirty(handle, di_bh); 2468 ··· 4468 goto out_commit; 4469 } 4470 4471 OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL; 4472 di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); 4473 di->i_dx_root = cpu_to_le64(0ULL); 4474 4475 ocfs2_journal_dirty(handle, di_bh);
··· 2461 2462 di->i_dx_root = cpu_to_le64(dr_blkno); 2463 2464 + spin_lock(&OCFS2_I(dir)->ip_lock); 2465 OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL; 2466 di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); 2467 + spin_unlock(&OCFS2_I(dir)->ip_lock); 2468 2469 ocfs2_journal_dirty(handle, di_bh); 2470 ··· 4466 goto out_commit; 4467 } 4468 4469 + spin_lock(&OCFS2_I(dir)->ip_lock); 4470 OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL; 4471 di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); 4472 + spin_unlock(&OCFS2_I(dir)->ip_lock); 4473 di->i_dx_root = cpu_to_le64(0ULL); 4474 4475 ocfs2_journal_dirty(handle, di_bh);