[PATCH 10/10] Re: [2.6-BK-URL] NTFS: 2.1.19 sparse annotation,cleanups and a bugfix

From: Anton Altaparmakov
Date: Fri Sep 24 2004 - 12:16:03 EST


This is patch 10/10 in the series. It contains the following ChangeSet:

<aia21@xxxxxxxxxx> (04/09/24 1.1956)
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: Anton Altaparmakov <aia21@xxxxxxxxxx>

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/

===================================================================

diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c
--- a/fs/ntfs/inode.c 2004-09-24 17:06:34 +01:00
+++ b/fs/ntfs/inode.c 2004-09-24 17:06:34 +01:00
@@ -2287,6 +2287,7 @@
ntfs_inode *ni = NTFS_I(vi);
ntfs_attr_search_ctx *ctx;
MFT_RECORD *m;
+ int err;

m = map_mft_record(ni);
if (IS_ERR(m)) {
@@ -2303,6 +2304,24 @@
// FIXME: We can't report an error code upstream. So what do
// we do?!? make_bad_inode() seems a bit harsh...
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;
}
/* If the size has not changed there is nothing to do. */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/