From 4b25a37e2093146c1f9aa436b832b7d4ef880ca4 Mon Sep 17 00:00:00 2001 From: Evgeniy Dushistov Date: Fri, 16 Mar 2007 13:38:09 -0800 Subject: [PATCH] ufs: zeroize the rest of block in truncate This patch fix behaviour in such test scenario: lseek(fd, BIG_OFFSET) write(fd, buf, sizeof(buf)) truncate(BIG_OFFSET) truncate(BIG_OFFSET + sizeof(buf)) read(fd, buf...) Because of if file big enough(BIG_OFFSET) we start allocate space by block, ordinary block size > page size, so we should zeroize the rest of block in truncate(except last framgnet, about which VFS should care), to not get garbage, when we extend file. Also patch corrects conversion from pointer to block to physical block number, this helps in case of not common used UFS types. And add to debug output inode number. Signed-off-by: Evgeniy Dushistov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/ufs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fs/ufs/inode.c') diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 366618dd698d..013d7afe7cde 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -212,7 +212,7 @@ repeat: brelse (result); goto repeat; } else { - *phys = tmp + blockoff; + *phys = uspi->s_sbbase + tmp + blockoff; return NULL; } } @@ -282,9 +282,9 @@ repeat: } if (!phys) { - result = sb_getblk(sb, tmp + blockoff); + result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); } else { - *phys = tmp + blockoff; + *phys = uspi->s_sbbase + tmp + blockoff; result = NULL; *err = 0; *new = 1; @@ -368,7 +368,7 @@ repeat: brelse (result); goto repeat; } else { - *phys = tmp + blockoff; + *phys = uspi->s_sbbase + tmp + blockoff; goto out; } } @@ -389,9 +389,9 @@ repeat: if (!phys) { - result = sb_getblk(sb, tmp + blockoff); + result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); } else { - *phys = tmp + blockoff; + *phys = uspi->s_sbbase + tmp + blockoff; *new = 1; } -- cgit v1.2.3