Skip to contentSkip to conversation

symlink has wrong sd_blocks count

DISCUSSION Nick Burrett 3 participants 6 messages Feb 18, 2003

lore
Share & tools
lore
#0 lore raw

I'm running a stock 2.4.20 kernel with the reiserfs quota patches applied.

Simply creating a symlink and then running reiserfsck shows errors like this:
/foofile 2 4 has wrong sd_blocks 8, has to be 1

I've reproduced this 100% on 100 filesystems on two servers.

bash-2.05# lvcreate -L 100M -n test vol01
lvcreate -- doing automatic backup of "vol01"
lvcreate -- logical volume "/dev/vol01/test" successfully created

bash-2.05# mkreiserfs /dev/vol01/test

<-------------mkreiserfs, 2002------------->
reiserfsprogs 3.6.2

mkreiserfs: Guessing about desired format..
mkreiserfs: Kernel 2.4.20 is running.
Format 3.6 with standard journal
Count of blocks on the device: 25600
Number of blocks consumed by mkreiserfs formatting process: 8212
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: cae72cae-5469-4e60-9b7f-7ffd662c3967
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
ALL DATA WILL BE LOST ON '/dev/vol01/test'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100% Syncing..ok
[...snipped...]

bash-2.05# reiserfsck --check /dev/vol01/test

<-------------reiserfsck, 2002------------->
reiserfsprogs 3.6.2

Will read-only check consistency of the filesystem on /dev/vol01/test Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes):Yes
###########
reiserfsck --check started at Tue Feb 18 10:47:22 2003
###########
Replaying journal..
No transactions found
Checking S+tree..ok
Comparing bitmaps..ok
Checking Semantic tree...
ok
No corruptions found
There are on the filesystem:
Leaves 1
Internal nodes 0
Directories 1
Other files 0
Data block pointers 0 (0 of them are zero)
Safe links 0
###########
reiserfsck finished at Tue Feb 18 10:47:22 2003
###########

bash-2.05# mount /dev/vol01/test /mnt
bash-2.05# cd /mnt
bash-2.05# touch bar
bash-2.05# ln -s bar foo
bash-2.05# cd /
bash-2.05# umount /mnt
bash-2.05# reiserfsck --check /dev/vol01/test

<-------------reiserfsck, 2002------------->
reiserfsprogs 3.6.2

Will read-only check consistency of the filesystem on /dev/vol01/test Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes):Yes
###########
reiserfsck --check started at Tue Feb 18 10:48:04 2003
###########
Replaying journal..
No transactions found
Checking S+tree..ok
Comparing bitmaps..ok
Checking Semantic tree...
/foofile 2 4 has wrong sd_blocks 8, has to be 1
ok
There were found 1 corruptions which can be fixed with --fix-fixable
###########
reiserfsck finished at Tue Feb 18 10:48:04 2003
###########
bash-2.05#

Signature · 2 lines
Nick Burrett
Network Engineer, Designer Servers Ltd.   http://www.dsvr.co.uk
#1 lore raw

Hello!

Quoted 5 lines · Nick Burrett

I'm running a stock 2.4.20 kernel with the reiserfs quota patches applied. Simply creating a symlink and then running reiserfsck shows errors like this:
/foofile 2 4 has wrong sd_blocks 8, has to be 1
I've reproduced this 100% on 100 filesystems on two servers.

Aha, I see.
Ignore this message for now for directories and symlinks. This is because when reiserfs calculates number of blocks file would use, in case of no quota, reiserfs code does this and can do this precisely (up to 512 bytes), but with quota patches applied, quota code takes account of blocks used. And it round everything up to blocksize, hence the difference. And reiserfsck uses only 1st variant of the code. I am not yet sure on how to deal with the issue.
Just ignore this message for now.

Bye,
Oleg

#2 lore raw
Quoted 10 lines · Oleg Drokin

Hello!

Quoted 5 lines · Nick Burrett

I'm running a stock 2.4.20 kernel with the reiserfs quota patches applied. Simply creating a symlink and then running reiserfsck shows errors like this:
/foofile 2 4 has wrong sd_blocks 8, has to be 1
I've reproduced this 100% on 100 filesystems on two servers.

Quoted 9 lines

Aha, I see.
Ignore this message for now for directories and symlinks. This is because when reiserfs calculates number of blocks file would use, in case of no quota, reiserfs code does this and can do this precisely (up to 512 bytes), but with quota patches applied, quota code takes account of blocks used. And it round everything up to blocksize, hence the difference. And reiserfsck uses only 1st variant of the code. I am not yet sure on how to deal with the issue.
Just ignore this message for now.

The quota code can have special checks for symlinks, but the sd_block accounting is somewhat complex, and I've been hesitant to make it even more so with the symlink checks.

-chris

#3 lore raw

Hello!

Quoted 14 lines · Chris Mason
Quoted 5 lines
Quoted 5 lines

I'm running a stock 2.4.20 kernel with the reiserfs quota patches applied. Simply creating a symlink and then running reiserfsck shows errors like this:
/foofile 2 4 has wrong sd_blocks 8, has to be 1
I've reproduced this 100% on 100 filesystems on two servers.

Quoted 9 lines

Aha, I see.
Ignore this message for now for directories and symlinks. This is because when reiserfs calculates number of blocks file would use, in case of no quota, reiserfs code does this and can do this precisely (up to 512 bytes), but with quota patches applied, quota code takes account of blocks used. And it round everything up to blocksize, hence the difference. And reiserfsck uses only 1st variant of the code. I am not yet sure on how to deal with the issue.
Just ignore this message for now.

Quoted 3 lines

The quota code can have special checks for symlinks, but the sd_block accounting is somewhat complex, and I've been hesitant to make it even more so with the symlink checks.

Symlinks are counted the same way as directories.
If you round up directory size to 512 bytes, same can be done with symlinks. But as I see it in quota (generic quota) code, the extra "i_bytes" are always being rounded up to blocksize. And that what's causing a problem.

Bye,
Oleg

#4 lore raw
Quoted 8 lines · Oleg Drokin
Quoted 3 lines

The quota code can have special checks for symlinks, but the sd_block accounting is somewhat complex, and I've been hesitant to make it even more so with the symlink checks.

Symlinks are counted the same way as directories.
If you round up directory size to 512 bytes, same can be done with symlinks. But as I see it in quota (generic quota) code, the extra "i_bytes" are always being rounded up to blocksize. And that what's causing a problem.

Right, it should be possible. I'm just finishing testing on the latest batch of quota code, so I'll work it in.

-chris

#5 lore raw

Hello!

Quoted 9 lines · Chris Mason
Quoted 7 lines
Quoted 3 lines

The quota code can have special checks for symlinks, but the sd_block accounting is somewhat complex, and I've been hesitant to make it even more so with the symlink checks.

Symlinks are counted the same way as directories.
If you round up directory size to 512 bytes, same can be done with symlinks. But as I see it in quota (generic quota) code, the extra "i_bytes" are always being rounded up to blocksize. And that what's causing a problem.

Right, it should be possible. I'm just finishing testing on the latest batch of quota code, so I'll work it in.

Ok, thank you.

Bye,
Oleg