[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>
Showing
- fs/ufs/balloc.c 2 additions, 46 deletionsfs/ufs/balloc.c
- fs/ufs/file.c 0 additions, 4 deletionsfs/ufs/file.c
- fs/ufs/inode.c 5 additions, 2 deletionsfs/ufs/inode.c
- fs/ufs/truncate.c 135 additions, 13 deletionsfs/ufs/truncate.c
- fs/ufs/util.c 54 additions, 0 deletionsfs/ufs/util.c
- fs/ufs/util.h 8 additions, 0 deletionsfs/ufs/util.h
- include/linux/ufs_fs.h 1 addition, 1 deletioninclude/linux/ufs_fs.h
Loading
Please register or sign in to comment