Skip to contentSkip to conversation

f2fs_symlink bug

f2fs-dev Chao Yu 3 participants 6 messages Aug 12, 2019 – Aug 23, 2019

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

Hi Jaegeuk,

In por_fsstress testcase, fsck reports below inconsistent status, I found one path can cause this case.

[FIX] (fsck_chk_inode_blk:1002) --> Symlink: recover 0x1425 with i_size=4096 [ASSERT] (fsck_chk_inode_blk:1030) --> ino: 0x1425 chksum:0x6983d47, but calculated one is: 0xdb284b35
[FIX] (fsck_chk_inode_blk:1036) --> ino: 0x1425 recover, i_inode_checksum= 0x6983d47 -> 0xdb284b35

- f2fs_symlink
- page_symlink failed -> f2fs_write_failed() will truncate size to zero
- f2fs_unlink failed -> symlink inode w/o data will remain in fs

Not sure, but one choice of fix is to treat symlink as fs meta like we did for directory, so that checkpoint can take care of all data/node of symlink, any thoughts?

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#1 lore raw

Ping,

Quoted 20 lines · Chao Yu

Hi Jaegeuk,

In por_fsstress testcase, fsck reports below inconsistent status, I found one path can cause this case.

[FIX] (fsck_chk_inode_blk:1002) --> Symlink: recover 0x1425 with i_size=4096 [ASSERT] (fsck_chk_inode_blk:1030) --> ino: 0x1425 chksum:0x6983d47, but calculated one is: 0xdb284b35
[FIX] (fsck_chk_inode_blk:1036) --> ino: 0x1425 recover, i_inode_checksum= 0x6983d47 -> 0xdb284b35

- f2fs_symlink
- page_symlink failed -> f2fs_write_failed() will truncate size to zero
- f2fs_unlink failed -> symlink inode w/o data will remain in fs

Not sure, but one choice of fix is to treat symlink as fs meta like we did for directory, so that checkpoint can take care of all data/node of symlink, any thoughts?

Quoted 6 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
Quoted 21 lines · Chao Yu

Ping,

Quoted 18 lines · Chao Yu

Hi Jaegeuk,

In por_fsstress testcase, fsck reports below inconsistent status, I found one path can cause this case.

[FIX] (fsck_chk_inode_blk:1002) --> Symlink: recover 0x1425 with i_size=4096 [ASSERT] (fsck_chk_inode_blk:1030) --> ino: 0x1425 chksum:0x6983d47, but calculated one is: 0xdb284b35
[FIX] (fsck_chk_inode_blk:1036) --> ino: 0x1425 recover, i_inode_checksum= 0x6983d47 -> 0xdb284b35

- f2fs_symlink
- page_symlink failed -> f2fs_write_failed() will truncate size to zero
- f2fs_unlink failed -> symlink inode w/o data will remain in fs

Not sure, but one choice of fix is to treat symlink as fs meta like we did for directory, so that checkpoint can take care of all data/node of symlink, any thoughts?

Hmm, how's the possible to get very long path name requiring another data block? If it's fitted in inline_data, it's more easy to guarantee that, right?

Quoted 8 lines
Quoted 8 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#3 lore raw
Quoted 19 lines · Jaegeuk Kim
Quoted 18 lines · Chao Yu

Ping,

Quoted 15 lines · Chao Yu

Hi Jaegeuk,

In por_fsstress testcase, fsck reports below inconsistent status, I found one path can cause this case.

[FIX] (fsck_chk_inode_blk:1002) --> Symlink: recover 0x1425 with i_size=4096 [ASSERT] (fsck_chk_inode_blk:1030) --> ino: 0x1425 chksum:0x6983d47, but calculated one is: 0xdb284b35
[FIX] (fsck_chk_inode_blk:1036) --> ino: 0x1425 recover, i_inode_checksum= 0x6983d47 -> 0xdb284b35

- f2fs_symlink
- page_symlink failed -> f2fs_write_failed() will truncate size to zero
- f2fs_unlink failed -> symlink inode w/o data will remain in fs

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Not sure, but one choice of fix is to treat symlink as fs meta like we did for directory, so that checkpoint can take care of all data/node of symlink, any thoughts?

Hmm, how's the possible to get very long path name requiring another data block?

It can with below script, which is actually existed case in fsstress.

#!/bin/bash

for (( i = 0; i < 4095; i++ )); do

        if [ $((i % 255)) -eq 0 ]
        then
                filename=$filename"/"
        else
                filename=$filename"0"
        fi

done

ln -s $filename /f2fs_mount_point/symlink

Quoted 1 line

If it's fitted in inline_data, it's more easy to guarantee that, right?

If the length of symlink is 4095, not sure inline space is enough even we can compress symlink...

Thanks,

Quoted 11 lines
Quoted 9 lines
Quoted 9 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#4 lore raw
Quoted 37 lines · Chao Yu
Quoted 19 lines · Jaegeuk Kim
Quoted 18 lines · Chao Yu

Ping,

Quoted 15 lines · Chao Yu

Hi Jaegeuk,

In por_fsstress testcase, fsck reports below inconsistent status, I found one path can cause this case.

[FIX] (fsck_chk_inode_blk:1002) --> Symlink: recover 0x1425 with i_size=4096 [ASSERT] (fsck_chk_inode_blk:1030) --> ino: 0x1425 chksum:0x6983d47, but calculated one is: 0xdb284b35
[FIX] (fsck_chk_inode_blk:1036) --> ino: 0x1425 recover, i_inode_checksum= 0x6983d47 -> 0xdb284b35

- f2fs_symlink
- page_symlink failed -> f2fs_write_failed() will truncate size to zero
- f2fs_unlink failed -> symlink inode w/o data will remain in fs

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Not sure, but one choice of fix is to treat symlink as fs meta like we did for directory, so that checkpoint can take care of all data/node of symlink, any thoughts?

Hmm, how's the possible to get very long path name requiring another data block?

It can with below script, which is actually existed case in fsstress.

#!/bin/bash

for (( i = 0; i < 4095; i++ )); do

        if [ $((i % 255)) -eq 0 ]
        then
                filename=$filename"/"
        else
                filename=$filename"0"
        fi
Quoted 8 lines

done

ln -s $filename /f2fs_mount_point/symlink

Quoted 1 line

If it's fitted in inline_data, it's more easy to guarantee that, right?

If the length of symlink is 4095, not sure inline space is enough even we can compress symlink...

I meant real usecases larger than 3.5KB. There's no posix rule to guarantee this. IOWs, it's known behavior across filesystems.

Quoted 14 lines

Thanks,

Quoted 11 lines
Quoted 9 lines
Quoted 9 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#5 lore raw
Quoted 42 lines · Jaegeuk Kim
Quoted 41 lines · Chao Yu
Quoted 19 lines · Jaegeuk Kim
Quoted 18 lines · Chao Yu

Ping,

Quoted 15 lines · Chao Yu

Hi Jaegeuk,

In por_fsstress testcase, fsck reports below inconsistent status, I found one path can cause this case.

[FIX] (fsck_chk_inode_blk:1002) --> Symlink: recover 0x1425 with i_size=4096 [ASSERT] (fsck_chk_inode_blk:1030) --> ino: 0x1425 chksum:0x6983d47, but calculated one is: 0xdb284b35
[FIX] (fsck_chk_inode_blk:1036) --> ino: 0x1425 recover, i_inode_checksum= 0x6983d47 -> 0xdb284b35

- f2fs_symlink
- page_symlink failed -> f2fs_write_failed() will truncate size to zero
- f2fs_unlink failed -> symlink inode w/o data will remain in fs

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Not sure, but one choice of fix is to treat symlink as fs meta like we did for directory, so that checkpoint can take care of all data/node of symlink, any thoughts?

Hmm, how's the possible to get very long path name requiring another data block?

It can with below script, which is actually existed case in fsstress.

#!/bin/bash

for (( i = 0; i < 4095; i++ )); do

        if [ $((i % 255)) -eq 0 ]
        then
                filename=$filename"/"
        else
                filename=$filename"0"
        fi

done

ln -s $filename /f2fs_mount_point/symlink

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

If it's fitted in inline_data, it's more easy to guarantee that, right?

If the length of symlink is 4095, not sure inline space is enough even we can compress symlink...

I meant real usecases larger than 3.5KB. There's no posix rule to guarantee this. IOWs, it's known behavior across filesystems.

Correct, it looks not a big deal that whether we truncate i_size of symlink to zero or not? how about avoiding such assert in fsck?

Thanks,

Quoted 13 lines
Quoted 13 lines

Thanks,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel