Commit f95c4018 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Remove all the make_bad_inode() calls. This should only be called

      from read inode and new inode code paths.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent a0646a1f
...@@ -32,6 +32,8 @@ ToDo/Notes: ...@@ -32,6 +32,8 @@ ToDo/Notes:
unused, invalid mft records which are the same in both $MFT and unused, invalid mft records which are the same in both $MFT and
$MFTMirr. $MFTMirr.
- Add support for sparse files which have a compression unit of 0. - Add support for sparse files which have a compression unit of 0.
- Remove all the make_bad_inode() calls. This should only be called
from read inode and new inode code paths.
2.1.26 - Minor bug fixes and updates. 2.1.26 - Minor bug fixes and updates.
......
...@@ -1530,7 +1530,6 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -1530,7 +1530,6 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
"error %i.", err); "error %i.", err);
SetPageError(page); SetPageError(page);
NVolSetErrors(ni->vol); NVolSetErrors(ni->vol);
make_bad_inode(vi);
} }
unlock_page(page); unlock_page(page);
if (ctx) if (ctx)
......
...@@ -2438,16 +2438,12 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size, ...@@ -2438,16 +2438,12 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
"chkdsk to recover.", IS_ERR(m) ? "chkdsk to recover.", IS_ERR(m) ?
"restore attribute search context" : "restore attribute search context" :
"truncate attribute runlist"); "truncate attribute runlist");
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
} else if (mp_rebuilt) { } else if (mp_rebuilt) {
if (ntfs_attr_record_resize(m, a, attr_len)) { if (ntfs_attr_record_resize(m, a, attr_len)) {
ntfs_error(vol->sb, "Failed to restore attribute " ntfs_error(vol->sb, "Failed to restore attribute "
"record in error code path. Run " "record in error code path. Run "
"chkdsk to recover."); "chkdsk to recover.");
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
} else /* if (success) */ { } else /* if (success) */ {
if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(
...@@ -2460,8 +2456,6 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size, ...@@ -2460,8 +2456,6 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
"mapping pairs array in error " "mapping pairs array in error "
"code path. Run chkdsk to " "code path. Run chkdsk to "
"recover."); "recover.");
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
} }
flush_dcache_mft_record_page(ctx->ntfs_ino); flush_dcache_mft_record_page(ctx->ntfs_ino);
......
...@@ -1207,8 +1207,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages, ...@@ -1207,8 +1207,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
"attribute runlist in error code " "attribute runlist in error code "
"path. Run chkdsk to recover the " "path. Run chkdsk to recover the "
"lost cluster."); "lost cluster.");
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
} else /* if (success) */ { } else /* if (success) */ {
status.runlist_merged = 0; status.runlist_merged = 0;
...@@ -1239,8 +1237,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages, ...@@ -1239,8 +1237,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
ntfs_error(vol->sb, "Failed to restore attribute " ntfs_error(vol->sb, "Failed to restore attribute "
"record in error code path. Run " "record in error code path. Run "
"chkdsk to recover."); "chkdsk to recover.");
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
} else /* if (success) */ { } else /* if (success) */ {
if (ntfs_mapping_pairs_build(vol, (u8*)a + if (ntfs_mapping_pairs_build(vol, (u8*)a +
...@@ -1253,8 +1249,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages, ...@@ -1253,8 +1249,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
"mapping pairs array in error " "mapping pairs array in error "
"code path. Run chkdsk to " "code path. Run chkdsk to "
"recover."); "recover.");
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
} }
flush_dcache_mft_record_page(ctx->ntfs_ino); flush_dcache_mft_record_page(ctx->ntfs_ino);
...@@ -1623,11 +1617,8 @@ static inline int ntfs_commit_pages_after_non_resident_write( ...@@ -1623,11 +1617,8 @@ static inline int ntfs_commit_pages_after_non_resident_write(
unmap_mft_record(base_ni); unmap_mft_record(base_ni);
ntfs_error(vi->i_sb, "Failed to update initialized_size/i_size (error " ntfs_error(vi->i_sb, "Failed to update initialized_size/i_size (error "
"code %i).", err); "code %i).", err);
if (err != -ENOMEM) { if (err != -ENOMEM)
NVolSetErrors(ni->vol); NVolSetErrors(ni->vol);
make_bad_inode(VFS_I(base_ni));
make_bad_inode(vi);
}
return err; return err;
} }
...@@ -1802,8 +1793,6 @@ static int ntfs_commit_pages_after_write(struct page **pages, ...@@ -1802,8 +1793,6 @@ static int ntfs_commit_pages_after_write(struct page **pages,
ntfs_error(vi->i_sb, "Resident attribute commit write failed " ntfs_error(vi->i_sb, "Resident attribute commit write failed "
"with error %i.", err); "with error %i.", err);
NVolSetErrors(ni->vol); NVolSetErrors(ni->vol);
make_bad_inode(VFS_I(base_ni));
make_bad_inode(vi);
} }
if (ctx) if (ctx)
ntfs_attr_put_search_ctx(ctx); ntfs_attr_put_search_ctx(ctx);
......
...@@ -93,6 +93,7 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni) ...@@ -93,6 +93,7 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni)
"Run chkdsk.", ni->mft_no); "Run chkdsk.", ni->mft_no);
ntfs_unmap_page(page); ntfs_unmap_page(page);
page = ERR_PTR(-EIO); page = ERR_PTR(-EIO);
NVolSetErrors(vol);
} }
err_out: err_out:
ni->page = NULL; ni->page = NULL;
......
...@@ -97,10 +97,7 @@ extern int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync); ...@@ -97,10 +97,7 @@ extern int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync);
* uptodate. * uptodate.
* *
* On success, clean the mft record and return 0. On error, leave the mft * On success, clean the mft record and return 0. On error, leave the mft
* record dirty and return -errno. The caller should call make_bad_inode() on * record dirty and return -errno.
* the base inode to ensure no more access happens to this inode. We do not do
* it here as the caller may want to finish writing other extent mft records
* first to minimize on-disk metadata inconsistencies.
*/ */
static inline int write_mft_record(ntfs_inode *ni, MFT_RECORD *m, int sync) static inline int write_mft_record(ntfs_inode *ni, MFT_RECORD *m, int sync)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment