Bug 9366
Summary: | BFS: Directory entries stored in the last directory block are handled incorrectly. | ||
---|---|---|---|
Product: | File System | Reporter: | Dmitri Vorobiev (dmitri.vorobiev) |
Component: | Other | Assignee: | Dmitri Vorobiev (dmitri.vorobiev) |
Status: | RESOLVED CODE_FIX | ||
Severity: | high | CC: | dmitri.vorobiev |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 2.6.24-rc2 | Subsystem: | |
Regression: | --- | Bisected commit-id: |
Description
Dmitri Vorobiev
2007-11-13 07:33:09 UTC
If the root directory is full and an attempt is made to create another directory entry, the following code in the bfs_add_entry() function >>> if (block==eblock && off>=eoff) { /* Do not read/interpret the garbage in the end of eblock. */ de->ino = 0; } <<< makes the function believe that the directory entry at the offset 0 of the last block allocated for the directory is not used. This code snippet silently deletes the directory entry, which occupies the direntry slot in the beginning of the last directory block and replaces it with another one. The blocks occupied by the "unlinked" inode are thereby lost. The erroneous code was introduced in the context of the patch submitted in this LKML message: http://lkml.org/lkml/2004/5/4/205 Not only this code snippet introduces a bug, but also the intention behind it is erroneous: indeed, there can be no "garbage" directory entries, but any directory entry with nonzero `ino' field should be valid. I am working on a fix, and am planning to submit a patch. The patch proposed in the following LKML message http://lkml.org/lkml/2007/11/13/185 fixes the error reported in the context of this bug. What follows is a console session, which proves that the error is gone: >>> debian:~# mount -t bfs /dev/loop0 /mnt debian:~# cd /mnt/ debian:/mnt# for i in `seq 1 511`; do echo "$i" > $i; done -bash: 511: No space left on device debian:/mnt# cd debian:~# umount /mnt debian:~# mount -t bfs /dev/loop0 /mnt/ debian:~# cd /mnt debian:/mnt# cat 479 479 debian:/mnt# <<< Merged in -mm tree, so I am closing this bug. |