BUG in ext2 file-system: extending a file using lseek()

Chris Rankin (rankinc@bellsouth.net)
Sun, 15 Feb 1998 23:47:40 -0500


------ =_NextPart_000_01BD3A6C.54EAE0C0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hello all,

I have been sweating blood trying to get my block quotas to agree on my
ext2 partition recently - it seems that a file-system bug is partly
responsible. I managed to produce this directory entry by extending a
file using lseek() (according to the manual, this use of lseek is
allowed):

bash$ ls -als
total 27
1 drwxr-xr-x 2 Chris users 1024 Feb 15 23:09 .
1 drwxr-xr-x 9 Chris users 1024 Feb 13 01:04 ..
1 -rw-r--r-- 1 Chris users 76 Jan 23 00:17 Hello.c
2 -rw-r--r-- 1 Chris users 1103 Feb 15 16:19 Makefile
1 -rw------- 1 Chris users 8016 Feb 15 22:40 TESTME
3 -rw-r--r-- 1 Chris users 2664 Nov 10 22:18 copy.c

The guilty party here is the file TESTME. I trust you will agree that an
8016-byte file should use more than one block on a 1024 byte-blocksize
filesystem (which I have)...

I have attached the program I used to generate this result.

Have fun with this one,
Cheers,
Chris.

------ =_NextPart_000_01BD3A6C.54EAE0C0
Content-Type: application/octet-stream; name="testseek.c"
Content-Transfer-Encoding: base64

I2luY2x1ZGUgPGZjbnRsLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8c3lzL3N0
YXQuaD4NCg0KY29uc3QgY2hhciAqY29uc3Qgc3pUZXN0RmlsZSA9ICIuL1RFU1RNRSI7DQojZGVm
aW5lIEZBSUxVUkUgIC0xDQoNCnR5cGVkZWYgc3RydWN0IHRhZ0NodW5rDQogICAgICAgIHsNCiAg
ICAgICAgICBpbnQgYTEsIGEyLCBhMywgYTQ7DQogICAgICAgIH0gQ0hVTks7DQoNCmludCBtYWlu
KCkNCnsNCiAgaW50IGZkOw0KDQogIGZkID0gb3BlbihzelRlc3RGaWxlLE9fQ1JFQVR8T19UUlVO
Q3xPX1JEV1IsU19JUlVTUnxTX0lXVVNSKTsNCiAgaWYgKGZkICE9IEZBSUxVUkUpDQogIHsNCiAg
ICBjb25zdCBDSFVOSyBzdENodW5rID0gezAsMCwwLDB9Ow0KICAgIGxzZWVrKGZkLDUwMCpzaXpl
b2YoQ0hVTkspLFNFRUtfU0VUKTsNCiAgICB3cml0ZShmZCwmc3RDaHVuayxzaXplb2Yoc3RDaHVu
aykpOw0KICAgIGNsb3NlKGZkKTsNCiAgfQ0KDQogIHJldHVybiAwOw0KfQ0KDQo=

------ =_NextPart_000_01BD3A6C.54EAE0C0--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu