Commit a778f217 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Fix a bug in fs/ntfs/inode.c::ntfs_read_locked_index_inode() where we

      forgot to update a temporary variable so loading index inodes which
      have an index allocation attribute failed.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 2c2c8c1c
...@@ -38,6 +38,9 @@ ToDo/Notes: ...@@ -38,6 +38,9 @@ ToDo/Notes:
allowed by NTFS, i.e. 255 Unicode characters, not including the allowed by NTFS, i.e. 255 Unicode characters, not including the
terminating NULL (which is not stored on disk). terminating NULL (which is not stored on disk).
- Improve comments on file attribute flags in fs/ntfs/layout.h. - Improve comments on file attribute flags in fs/ntfs/layout.h.
- Fix a bug in fs/ntfs/inode.c::ntfs_read_locked_index_inode() where we
forgot to update a temporary variable so loading index inodes which
have an index allocation attribute failed.
2.1.26 - Minor bug fixes and updates. 2.1.26 - Minor bug fixes and updates.
......
...@@ -19,15 +19,19 @@ ...@@ -19,15 +19,19 @@
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <linux/pagemap.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/smp_lock.h> #include <linux/fs.h>
#include <linux/quotaops.h> #include <linux/mm.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include "aops.h" #include "aops.h"
#include "attrib.h" #include "attrib.h"
#include "bitmap.h"
#include "dir.h" #include "dir.h"
#include "debug.h" #include "debug.h"
#include "inode.h" #include "inode.h"
...@@ -1428,7 +1432,6 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi) ...@@ -1428,7 +1432,6 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
"Run chkdsk.", err, vi->i_ino, ni->type, ni->name_len, "Run chkdsk.", err, vi->i_ino, ni->type, ni->name_len,
base_vi->i_ino); base_vi->i_ino);
make_bad_inode(vi); make_bad_inode(vi);
make_bad_inode(base_vi);
if (err != -ENOMEM) if (err != -ENOMEM)
NVolSetErrors(vol); NVolSetErrors(vol);
return err; return err;
...@@ -1613,6 +1616,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi) ...@@ -1613,6 +1616,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
"$INDEX_ALLOCATION attribute."); "$INDEX_ALLOCATION attribute.");
goto unm_err_out; goto unm_err_out;
} }
a = ctx->attr;
if (!a->non_resident) { if (!a->non_resident) {
ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is " ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is "
"resident."); "resident.");
...@@ -2845,11 +2849,8 @@ int ntfs_truncate(struct inode *vi) ...@@ -2845,11 +2849,8 @@ int ntfs_truncate(struct inode *vi)
old_bad_out: old_bad_out:
old_size = -1; old_size = -1;
bad_out: bad_out:
if (err != -ENOMEM && err != -EOPNOTSUPP) { if (err != -ENOMEM && err != -EOPNOTSUPP)
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
}
if (err != -EOPNOTSUPP) if (err != -EOPNOTSUPP)
NInoSetTruncateFailed(ni); NInoSetTruncateFailed(ni);
else if (old_size >= 0) else if (old_size >= 0)
...@@ -2864,11 +2865,8 @@ int ntfs_truncate(struct inode *vi) ...@@ -2864,11 +2865,8 @@ int ntfs_truncate(struct inode *vi)
ntfs_debug("Failed. Returning error code %i.", err); ntfs_debug("Failed. Returning error code %i.", err);
return err; return err;
conv_err_out: conv_err_out:
if (err != -ENOMEM && err != -EOPNOTSUPP) { if (err != -ENOMEM && err != -EOPNOTSUPP)
make_bad_inode(vi);
make_bad_inode(VFS_I(base_ni));
NVolSetErrors(vol); NVolSetErrors(vol);
}
if (err != -EOPNOTSUPP) if (err != -EOPNOTSUPP)
NInoSetTruncateFailed(ni); NInoSetTruncateFailed(ni);
else else
...@@ -3116,9 +3114,7 @@ int ntfs_write_inode(struct inode *vi, int sync) ...@@ -3116,9 +3114,7 @@ int ntfs_write_inode(struct inode *vi, int sync)
"retries later."); "retries later.");
mark_inode_dirty(vi); mark_inode_dirty(vi);
} else { } else {
ntfs_error(vi->i_sb, "Failed (error code %i): Marking inode " ntfs_error(vi->i_sb, "Failed (error %i): Run chkdsk.", -err);
"as bad. You should run chkdsk.", -err);
make_bad_inode(vi);
NVolSetErrors(ni->vol); NVolSetErrors(ni->vol);
} }
return err; return err;
......
...@@ -651,10 +651,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no, ...@@ -651,10 +651,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
* fs/ntfs/aops.c::mark_ntfs_record_dirty(). * fs/ntfs/aops.c::mark_ntfs_record_dirty().
* *
* 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.
* *
* NOTE: We always perform synchronous i/o and ignore the @sync parameter. * NOTE: We always perform synchronous i/o and ignore the @sync parameter.
* However, if the mft record has a counterpart in the mft mirror and @sync is * However, if the mft record has a counterpart in the mft mirror and @sync is
......
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