NTFS: - In fs/ntfs/compress.c, use i_size_read() at the start and then use the
cached value everywhere. Cache the initialized_size in the same way
and protect the critical region where the two sizes are read using the
new size_lock of the ntfs inode.
- Add the new size_lock to the ntfs_inode structure (fs/ntfs/inode.h)
and initialize it (fs/ntfs/inode.c).
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 6d2a99c1..97c4fe9 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -34,6 +34,13 @@
- Use i_size_read() once and then use the cached value in
fs/ntfs/lcnalloc.c::ntfs_cluster_alloc().
- Use i_size_read() in fs/ntfs/file.c::ntfs_file_open().
+ - Add size_lock to the ntfs_inode structure. This is an rw spinlock
+ and it locks against access to the inode sizes. Note, ->size_lock
+ is also accessed from irq context so you must use the _irqsave and
+ _irqrestore lock and unlock functions, respectively.
+ - Use i_size_read() in fs/ntfs/compress.c at the start of the read and
+ use the cached value afterwards. Cache the initialized_size in the
+ same way and protect access to the two sizes using the size_lock.
2.1.22 - Many bug and race fixes and error handling improvements.