[PATCH] ufs: truncate should allocate block for last byte
This patch fixes buggy behaviour of UFS in such kind of scenario: open(, O_TRUNC...) ftruncate(, 1024) ftruncate(, 0) Such a scenario causes ufs_panic and remount read-only. This happen because of according to specification UFS should always allocate block for last byte, and many parts of our implementation rely on this, but `ufs_truncate' doesn't care about this. To make possible return error code and to know about old size, this patch removes `truncate' from ufs inode_operations and uses `setattr' method to call ufs_truncate. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
eb28931e4a
commit
10e5dce07e
@@ -993,7 +993,7 @@ extern void ufs_panic (struct super_block *, const char *, const char *, ...) __
|
||||
extern struct inode_operations ufs_fast_symlink_inode_operations;
|
||||
|
||||
/* truncate.c */
|
||||
extern void ufs_truncate (struct inode *);
|
||||
extern int ufs_truncate (struct inode *, loff_t);
|
||||
|
||||
static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
|
||||
{
|
||||
|
Reference in New Issue
Block a user