--- x/fs/ext4/inode.c +++ y/fs/ext4/inode.c @@ -4573,6 +4573,7 @@ int ext4_truncate(struct inode *inode) struct ext4_inode_info *ei = EXT4_I(inode); unsigned int credits; int err = 0, err2; + static int subclass = 0; handle_t *handle; struct address_space *mapping = inode->i_mapping; @@ -4636,7 +4637,7 @@ int ext4_truncate(struct inode *inode) ext4_fc_track_inode(handle, inode); ext4_check_map_extents_env(inode); - down_write(&EXT4_I(inode)->i_data_sem); + down_write_nested(&EXT4_I(inode)->i_data_sem, subclass++); ext4_discard_preallocations(inode); if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) @@ -4645,6 +4646,7 @@ int ext4_truncate(struct inode *inode) ext4_ind_truncate(handle, inode); up_write(&ei->i_data_sem); + subclass--; if (err) goto out_stop;