X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fbfs%2Fdir.c;h=4656ecc21bd7137537a51101537a4962abfa8ca6;hb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;hp=09db6f39c4061df1002a57c596eb6e337b20df21;hpb=c449269f45c2cdf53af08c8d0af37472f66539d9;p=linux-2.6.git diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 09db6f39c..4656ecc21 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c @@ -274,7 +274,7 @@ static int bfs_add_entry(struct inode * dir, const char * name, int namelen, int { struct buffer_head * bh; struct bfs_dirent * de; - int block, sblock, eblock, off; + int block, sblock, eblock, off, eoff; int i; dprintf("name=%s, namelen=%d\n", name, namelen); @@ -286,12 +286,17 @@ static int bfs_add_entry(struct inode * dir, const char * name, int namelen, int sblock = BFS_I(dir)->i_sblock; eblock = BFS_I(dir)->i_eblock; + eoff = dir->i_size % BFS_BSIZE; for (block=sblock; block<=eblock; block++) { bh = sb_bread(dir->i_sb, block); if(!bh) return -ENOSPC; for (off=0; offb_data + off); + if (block==eblock && off>=eoff) { + /* Do not read/interpret the garbage in the end of eblock. */ + de->ino = 0; + } if (!de->ino) { if ((block-sblock)*BFS_BSIZE + off >= dir->i_size) { dir->i_size += BFS_DIRENT_SIZE;