Skip to content

Commit f95c401

Browse files
NTFS: Remove all the make_bad_inode() calls. This should only be called
from read inode and new inode code paths. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
1 parent a0646a1 commit f95c401

6 files changed

Lines changed: 5 additions & 23 deletions

File tree

‎fs/ntfs/ChangeLog‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ ToDo/Notes:
3232
unused, invalid mft records which are the same in both $MFT and
3333
$MFTMirr.
3434
- Add support for sparse files which have a compression unit of 0.
35+
- Remove all the make_bad_inode() calls. This should only be called
36+
from read inode and new inode code paths.
3537

3638
2.1.26 - Minor bug fixes and updates.
3739

‎fs/ntfs/aops.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,6 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
15301530
"error %i.", err);
15311531
SetPageError(page);
15321532
NVolSetErrors(ni->vol);
1533-
make_bad_inode(vi);
15341533
}
15351534
unlock_page(page);
15361535
if (ctx)

‎fs/ntfs/attrib.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,16 +2438,12 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
24382438
"chkdsk to recover.", IS_ERR(m) ?
24392439
"restore attribute search context" :
24402440
"truncate attribute runlist");
2441-
make_bad_inode(vi);
2442-
make_bad_inode(VFS_I(base_ni));
24432441
NVolSetErrors(vol);
24442442
} else if (mp_rebuilt) {
24452443
if (ntfs_attr_record_resize(m, a, attr_len)) {
24462444
ntfs_error(vol->sb, "Failed to restore attribute "
24472445
"record in error code path. Run "
24482446
"chkdsk to recover.");
2449-
make_bad_inode(vi);
2450-
make_bad_inode(VFS_I(base_ni));
24512447
NVolSetErrors(vol);
24522448
} else /* if (success) */ {
24532449
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,
24602456
"mapping pairs array in error "
24612457
"code path. Run chkdsk to "
24622458
"recover.");
2463-
make_bad_inode(vi);
2464-
make_bad_inode(VFS_I(base_ni));
24652459
NVolSetErrors(vol);
24662460
}
24672461
flush_dcache_mft_record_page(ctx->ntfs_ino);

‎fs/ntfs/file.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,8 +1207,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
12071207
"attribute runlist in error code "
12081208
"path. Run chkdsk to recover the "
12091209
"lost cluster.");
1210-
make_bad_inode(vi);
1211-
make_bad_inode(VFS_I(base_ni));
12121210
NVolSetErrors(vol);
12131211
} else /* if (success) */ {
12141212
status.runlist_merged = 0;
@@ -1239,8 +1237,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
12391237
ntfs_error(vol->sb, "Failed to restore attribute "
12401238
"record in error code path. Run "
12411239
"chkdsk to recover.");
1242-
make_bad_inode(vi);
1243-
make_bad_inode(VFS_I(base_ni));
12441240
NVolSetErrors(vol);
12451241
} else /* if (success) */ {
12461242
if (ntfs_mapping_pairs_build(vol, (u8*)a +
@@ -1253,8 +1249,6 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
12531249
"mapping pairs array in error "
12541250
"code path. Run chkdsk to "
12551251
"recover.");
1256-
make_bad_inode(vi);
1257-
make_bad_inode(VFS_I(base_ni));
12581252
NVolSetErrors(vol);
12591253
}
12601254
flush_dcache_mft_record_page(ctx->ntfs_ino);
@@ -1623,11 +1617,8 @@ static inline int ntfs_commit_pages_after_non_resident_write(
16231617
unmap_mft_record(base_ni);
16241618
ntfs_error(vi->i_sb, "Failed to update initialized_size/i_size (error "
16251619
"code %i).", err);
1626-
if (err != -ENOMEM) {
1620+
if (err != -ENOMEM)
16271621
NVolSetErrors(ni->vol);
1628-
make_bad_inode(VFS_I(base_ni));
1629-
make_bad_inode(vi);
1630-
}
16311622
return err;
16321623
}
16331624

@@ -1802,8 +1793,6 @@ static int ntfs_commit_pages_after_write(struct page **pages,
18021793
ntfs_error(vi->i_sb, "Resident attribute commit write failed "
18031794
"with error %i.", err);
18041795
NVolSetErrors(ni->vol);
1805-
make_bad_inode(VFS_I(base_ni));
1806-
make_bad_inode(vi);
18071796
}
18081797
if (ctx)
18091798
ntfs_attr_put_search_ctx(ctx);

‎fs/ntfs/mft.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni)
9393
"Run chkdsk.", ni->mft_no);
9494
ntfs_unmap_page(page);
9595
page = ERR_PTR(-EIO);
96+
NVolSetErrors(vol);
9697
}
9798
err_out:
9899
ni->page = NULL;

‎fs/ntfs/mft.h‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ extern int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync);
9797
* uptodate.
9898
*
9999
* On success, clean the mft record and return 0. On error, leave the mft
100-
* record dirty and return -errno. The caller should call make_bad_inode() on
101-
* the base inode to ensure no more access happens to this inode. We do not do
102-
* it here as the caller may want to finish writing other extent mft records
103-
* first to minimize on-disk metadata inconsistencies.
100+
* record dirty and return -errno.
104101
*/
105102
static inline int write_mft_record(ntfs_inode *ni, MFT_RECORD *m, int sync)
106103
{

0 commit comments

Comments
 (0)