• Dmitry Monakhov's avatar
    ext4: serialize truncate with owerwrite DIO workers · 1f555cfa
    Dmitry Monakhov authored
    Jan Kara have spotted interesting issue:
    There are  potential data corruption issue with  direct IO overwrites
    racing with truncate:
      dio write                      truncate_task
       ->overwrite == 1
                                     # truncate data blocks, allocate them to
                                     # other inode - bad stuff happens because
                                     # dio is still in flight.
    In order to serialize with truncate dio worker should grab extra i_dio_count
    reference before drop i_mutex.
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>