瀏覽代碼

NTFS: Fix ntfs_attr_make_non_resident() to update the vfs inode i_blocks
which is zero for a resident attribute but should no longer be zero
once the attribute is non-resident as it then has real clusters
allocated.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

Anton Altaparmakov 19 年之前
父節點
當前提交
2a6fc4e1b0
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 4 0
      fs/ntfs/ChangeLog
  2. 3 1
      fs/ntfs/attrib.c

+ 4 - 0
fs/ntfs/ChangeLog

@@ -43,6 +43,10 @@ ToDo/Notes:
 	  reason we cannot simply read the size from the vfs inode i_size is
 	  reason we cannot simply read the size from the vfs inode i_size is
 	  that this is not necessarily uptodate.  This happens when
 	  that this is not necessarily uptodate.  This happens when
 	  ntfs_attr_make_non_resident() is called in the ->truncate call path.
 	  ntfs_attr_make_non_resident() is called in the ->truncate call path.
+	- Fix ntfs_attr_make_non_resident() to update the vfs inode i_blocks
+	  which is zero for a resident attribute but should no longer be zero
+	  once the attribute is non-resident as it then has real clusters
+	  allocated.
 
 
 2.1.24 - Lots of bug fixes and support more clean journal states.
 2.1.24 - Lots of bug fixes and support more clean journal states.
 
 

+ 3 - 1
fs/ntfs/attrib.c

@@ -1719,7 +1719,9 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size)
 				ffs(ni->itype.compressed.block_size) - 1;
 				ffs(ni->itype.compressed.block_size) - 1;
 		ni->itype.compressed.block_clusters = 1U <<
 		ni->itype.compressed.block_clusters = 1U <<
 				a->data.non_resident.compression_unit;
 				a->data.non_resident.compression_unit;
-	}
+		vi->i_blocks = ni->itype.compressed.size >> 9;
+	} else
+		vi->i_blocks = ni->allocated_size >> 9;
 	write_unlock_irqrestore(&ni->size_lock, flags);
 	write_unlock_irqrestore(&ni->size_lock, flags);
 	/*
 	/*
 	 * This needs to be last since the address space operations ->readpage
 	 * This needs to be last since the address space operations ->readpage