From a1a13da74a917a536dbe96697116c9735ca24250 Mon Sep 17 00:00:00 2001 From: uvman Date: Fri, 21 Jul 2006 23:03:59 +0000 Subject: [PATCH] Commit mft extensions right away. Don't wait for a clean unmount, or you may face data loss. --- libntfs/mft.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index bc3be080..4c266b25 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1356,8 +1356,11 @@ found_free_rec: if (mft_na->data_size > mft_na->allocated_size || mft_na->initialized_size > mft_na->data_size) NTFS_BUG("mft_na sanity checks failed"); - // BUG_ON(mft_na->initialized_size > mft_na->data_size); - // BUG_ON(mft_na->data_size > mft_na->allocated_size); + /* Sync MFT to disk now in order to minimize data-loss. */ + if (ntfs_inode_sync(mft_na->ni)) { + ntfs_log_debug("mft sync after extension failed. rolling back."); + goto undo_data_init; + } mft_rec_already_initialized: /* * We now have allocated and initialized the mft record. Need to read