Commit 7606ce32 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Fix a stupid bug where I forgot to actually do the attribute lookup

      and then went and used the looked up attribute...  Ooops.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent b779e3a0
...@@ -2287,6 +2287,7 @@ void ntfs_truncate(struct inode *vi) ...@@ -2287,6 +2287,7 @@ void ntfs_truncate(struct inode *vi)
ntfs_inode *ni = NTFS_I(vi); ntfs_inode *ni = NTFS_I(vi);
ntfs_attr_search_ctx *ctx; ntfs_attr_search_ctx *ctx;
MFT_RECORD *m; MFT_RECORD *m;
int err;
m = map_mft_record(ni); m = map_mft_record(ni);
if (IS_ERR(m)) { if (IS_ERR(m)) {
...@@ -2303,6 +2304,24 @@ void ntfs_truncate(struct inode *vi) ...@@ -2303,6 +2304,24 @@ void ntfs_truncate(struct inode *vi)
// FIXME: We can't report an error code upstream. So what do // FIXME: We can't report an error code upstream. So what do
// we do?!? make_bad_inode() seems a bit harsh... // we do?!? make_bad_inode() seems a bit harsh...
unmap_mft_record(ni); unmap_mft_record(ni);
return;
}
err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len,
CASE_SENSITIVE, 0, NULL, 0, ctx);
if (unlikely(err)) {
if (err == -ENOENT) {
ntfs_error(vi->i_sb, "Open attribute is missing from "
"mft record. Inode 0x%lx is corrupt. "
"Run chkdsk.", vi->i_ino);
make_bad_inode(vi);
} else {
ntfs_error(vi->i_sb, "Failed to lookup attribute in "
"inode 0x%lx (error code %d).",
vi->i_ino, err);
// FIXME: We can't report an error code upstream. So
// what do we do?!? make_bad_inode() seems a bit
// harsh...
}
goto out; goto out;
} }
/* If the size has not changed there is nothing to do. */ /* If the size has not changed there is nothing to do. */
......
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