aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/inode.c
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2006-02-24 04:55:07 -0500
committerAnton Altaparmakov <aia21@cantab.net>2006-02-24 04:55:07 -0500
commit3672b638ec1d5b1020ea27986060b830f09c96c1 (patch)
treedca562635528062a8c04c416978a1133b95310fc /fs/ntfs/inode.c
parentfab8d6ddf6dee2608869005d45fe97f70e4f5bdd (diff)
NTFS: - Cope with attribute list attribute having invalid flags.
Windows copes with this and even chkdsk does not detect or fix this so we have to cope with it, too. Thanks to Pawel Kot for reporting the problem. - Miscellaneous updates to layout.h. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/inode.c')
-rw-r--r--fs/ntfs/inode.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index ea1bd3feea1b..55263b7de9c0 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -677,13 +677,28 @@ static int ntfs_read_locked_inode(struct inode *vi)
677 ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino); 677 ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino);
678 NInoSetAttrList(ni); 678 NInoSetAttrList(ni);
679 a = ctx->attr; 679 a = ctx->attr;
680 if (a->flags & ATTR_IS_ENCRYPTED || 680 if (a->flags & ATTR_COMPRESSION_MASK) {
681 a->flags & ATTR_COMPRESSION_MASK ||
682 a->flags & ATTR_IS_SPARSE) {
683 ntfs_error(vi->i_sb, "Attribute list attribute is " 681 ntfs_error(vi->i_sb, "Attribute list attribute is "
684 "compressed/encrypted/sparse."); 682 "compressed.");
685 goto unm_err_out; 683 goto unm_err_out;
686 } 684 }
685 if (a->flags & ATTR_IS_ENCRYPTED ||
686 a->flags & ATTR_IS_SPARSE) {
687 if (a->non_resident) {
688 ntfs_error(vi->i_sb, "Non-resident attribute "
689 "list attribute is encrypted/"
690 "sparse.");
691 goto unm_err_out;
692 }
693 ntfs_warning(vi->i_sb, "Resident attribute list "
694 "attribute in inode 0x%lx is marked "
695 "encrypted/sparse which is not true. "
696 "However, Windows allows this and "
697 "chkdsk does not detect or correct it "
698 "so we will just ignore the invalid "
699 "flags and pretend they are not set.",
700 vi->i_ino);
701 }
687 /* Now allocate memory for the attribute list. */ 702 /* Now allocate memory for the attribute list. */
688 ni->attr_list_size = (u32)ntfs_attr_size(a); 703 ni->attr_list_size = (u32)ntfs_attr_size(a);
689 ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); 704 ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size);
@@ -1809,19 +1824,33 @@ int ntfs_read_inode_mount(struct inode *vi)
1809 } else /* if (!err) */ { 1824 } else /* if (!err) */ {
1810 ATTR_LIST_ENTRY *al_entry, *next_al_entry; 1825 ATTR_LIST_ENTRY *al_entry, *next_al_entry;
1811 u8 *al_end; 1826 u8 *al_end;
1827 static const char *es = " Not allowed. $MFT is corrupt. "
1828 "You should run chkdsk.";
1812 1829
1813 ntfs_debug("Attribute list attribute found in $MFT."); 1830 ntfs_debug("Attribute list attribute found in $MFT.");
1814 NInoSetAttrList(ni); 1831 NInoSetAttrList(ni);
1815 a = ctx->attr; 1832 a = ctx->attr;
1816 if (a->flags & ATTR_IS_ENCRYPTED || 1833 if (a->flags & ATTR_COMPRESSION_MASK) {
1817 a->flags & ATTR_COMPRESSION_MASK ||
1818 a->flags & ATTR_IS_SPARSE) {
1819 ntfs_error(sb, "Attribute list attribute is " 1834 ntfs_error(sb, "Attribute list attribute is "
1820 "compressed/encrypted/sparse. Not " 1835 "compressed.%s", es);
1821 "allowed. $MFT is corrupt. You should "
1822 "run chkdsk.");
1823 goto put_err_out; 1836 goto put_err_out;
1824 } 1837 }
1838 if (a->flags & ATTR_IS_ENCRYPTED ||
1839 a->flags & ATTR_IS_SPARSE) {
1840 if (a->non_resident) {
1841 ntfs_error(sb, "Non-resident attribute list "
1842 "attribute is encrypted/"
1843 "sparse.%s", es);
1844 goto put_err_out;
1845 }
1846 ntfs_warning(sb, "Resident attribute list attribute "
1847 "in $MFT system file is marked "
1848 "encrypted/sparse which is not true. "
1849 "However, Windows allows this and "
1850 "chkdsk does not detect or correct it "
1851 "so we will just ignore the invalid "
1852 "flags and pretend they are not set.");
1853 }
1825 /* Now allocate memory for the attribute list. */ 1854 /* Now allocate memory for the attribute list. */
1826 ni->attr_list_size = (u32)ntfs_attr_size(a); 1855 ni->attr_list_size = (u32)ntfs_attr_size(a);
1827 ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); 1856 ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size);