]> git.neil.brown.name Git - history.git/commitdiff
NTFS: Minor bug fix in attribute list attribute handling that fixes the
authorAnton Altaparmakov <aia21@cantab.net>
Tue, 11 Nov 2003 17:56:57 +0000 (17:56 +0000)
committerAnton Altaparmakov <aia21@cantab.net>
Tue, 11 Nov 2003 17:56:57 +0000 (17:56 +0000)
I/O errors on "ls" of certain fragmented files found by at least two
people running Windows XP.

Documentation/filesystems/ntfs.txt
fs/ntfs/ChangeLog
fs/ntfs/Makefile
fs/ntfs/attrib.c
fs/ntfs/attrib.h

index 33e3afadad77ce1330e8d0101ce74a95a804c31e..8172fffb1667e6095ea9948e6cdb14793a4cb5c3 100644 (file)
@@ -272,6 +272,10 @@ ChangeLog
 
 Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
 
+2.1.5:
+       - Minor bug fix in attribute list attribute handling that fixes the
+         I/O errors on "ls" of certain fragmented files found by at least two
+         people running Windows XP.
 2.1.4:
        - Minor update allowing compilation with all gcc versions (well, the
          ones the kernel can be compiled with anyway).
index 27a8b478c35690ee252df68a6af35ae5ad2ad2c7..f6fcaf5cbdfb585b321d6010f7a0e776bb795c75 100644 (file)
@@ -20,6 +20,14 @@ ToDo:
          sufficient for synchronisation here. We then just need to make sure
          ntfs_readpage/writepage/truncate interoperate properly with us.
 
+2.1.5 - Fix minor bug in attribute list attribute handling.
+
+       - Fix bug in attribute list handling.  Actually it is not as much a bug
+         as too much protection in that we were not allowing attribute lists
+         which waste space on disk while Windows XP clearly allows it and in
+         fact creates such attribute lists so our driver was failing.
+       - Update NTFS documentation ready for 2.6 kernel release.
+
 2.1.4 - Reduce compiler requirements.
 
        - Remove all uses of unnamed structs and unions in the driver to make
index 5e2a43f18188bf1303fd5c131cdca47ded8f1783..b6fa3030ac3e8cc404786aecb05c837f642d8304 100644 (file)
@@ -5,7 +5,7 @@ obj-$(CONFIG_NTFS_FS) += ntfs.o
 ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o mft.o \
             mst.o namei.o super.o sysctl.o time.o unistr.o upcase.o
 
-EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.4\"
+EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.5\"
 
 ifeq ($(CONFIG_NTFS_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
index b47366fe9baa34fa74e9728600dc6cddc3a8210a..476bcf512bd9d5d81fbe524a4bd883f6d3837498 100644 (file)
@@ -1215,7 +1215,7 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
  * load_attribute_list - load an attribute list into memory
  * @vol:               ntfs volume from which to read
  * @run_list:          run list of the attribute list
- * @al:                        destination buffer
+ * @al_start:          destination buffer
  * @size:              size of the destination buffer in bytes
  * @initialized_size:  initialized size of the attribute list
  *
@@ -1227,10 +1227,11 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
  *
  * Return 0 on success or -errno on error.
  */
-int load_attribute_list(ntfs_volume *vol, run_list *run_list, u8 *al,
+int load_attribute_list(ntfs_volume *vol, run_list *run_list, u8 *al_start,
                const s64 size, const s64 initialized_size)
 {
        LCN lcn;
+       u8 *al = al_start;
        u8 *al_end = al + initialized_size;
        run_list_element *rl;
        struct buffer_head *bh;
@@ -1284,32 +1285,28 @@ int load_attribute_list(ntfs_volume *vol, run_list *run_list, u8 *al,
        }
        if (initialized_size < size) {
 initialize:
-               memset(al + initialized_size, 0, size - initialized_size);
+               memset(al_start + initialized_size, 0, size - initialized_size);
        }
 done:
        up_read(&run_list->lock);
        return err;
 do_final:
        if (al < al_end) {
-               /* Partial block. */
-               memcpy(al, bh->b_data, al_end - al);
-               brelse(bh);
                /*
-                * Skip sanity checking if initialized_size < size as it is
-                * too much trouble.
+                * Partial block.
+                *
+                * Note: The attribute list can be smaller than its allocation
+                * by multiple clusters.  This has been encountered by at least
+                * two people running Windows XP, thus we cannot do any
+                * truncation sanity checking here. (AIA)
                 */
+               memcpy(al, bh->b_data, al_end - al);
+               brelse(bh);
                if (initialized_size < size)
                        goto initialize;
-               /* If the final lcn is partial all is fine. */
-               if (((s64)(block - (lcn << vol->cluster_size_bits >>
-                               block_size_bits)) << block_size_bits >>
-                               vol->cluster_size_bits) == rl->length - 1) {
-                       if (!rl[1].length || (rl[1].lcn == LCN_RL_NOT_MAPPED
-                                       && !rl[2].length))
-                               goto done;
-               }
-       } else
-               brelse(bh);
+               goto done;
+       }
+       brelse(bh);
        /* Real overflow! */
        ntfs_error(sb, "Attribute list buffer overflow. Read attribute list "
                        "is truncated.");
index e7009a0703af0db6b467f427352f9140855ae4c6..8c36c1a44734a1ae9d3b562e799efe3885e75945 100644 (file)
@@ -87,7 +87,7 @@ BOOL lookup_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
                const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val,
                const u32 val_len, attr_search_context *ctx);
 
-extern int load_attribute_list(ntfs_volume *vol, run_list *rl, u8 *al,
+extern int load_attribute_list(ntfs_volume *vol, run_list *rl, u8 *al_start,
                const s64 size, const s64 initialized_size);
 
 static inline s64 attribute_value_length(const ATTR_RECORD *a)