-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
st_ino not the same when stat
When ln /mnt/a.txt /mnt/b.txt and call stat /mnt/a.txt and stat /mnt/b.txt
It should be same st_ino but is not equal.
Test Flow
echo "Hello" > /mnt/a.txtln /mnt/a.txt /mnt/b.txtstat -s /mnt/a.txtstat -s /mnt/b.txt
From hexdump -C waynefs.img
Step 1: Create and write "Hello" to /mnt/a.txt
00000000 57 41 59 4e 45 5f 46 53 00 10 00 00 00 40 00 00 |WAYNE_FS.....@..|
00000010 00 04 00 00 01 00 00 00 01 00 00 00 02 00 00 00 |................|
00000020 01 00 00 00 03 00 00 00 20 00 00 00 23 00 00 00 |........ ...#...|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001000 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00002000 ff ff ff ff 1f 00 00 00 00 00 00 00 00 00 00 00 |................|
00002010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00003000 00 40 00 00 02 00 00 00 1e 00 00 00 00 00 00 00 |.@..............|
00003010 35 bb e2 68 00 00 00 00 35 bb e2 68 00 00 00 00 |5..h....5..h....|
00003020 24 bb e2 68 00 00 00 00 23 00 00 00 00 00 00 00 |$..h....#.......|
00003030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00003080 a4 81 00 00 01 00 00 00 06 00 00 00 00 00 00 00 |................|
00003090 35 bb e2 68 00 00 00 00 35 bb e2 68 00 00 00 00 |5..h....5..h....|
000030a0 35 bb e2 68 00 00 00 00 24 00 00 00 00 00 00 00 |5..h....$.......|
000030b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00023000 1a 00 00 00 00 00 00 00 01 00 2e 00 00 00 00 02 |................|
00023010 00 2e 2e 01 00 00 00 05 00 61 2e 74 78 74 00 00 |.........a.txt..|
00023020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00024000 48 65 6c 6c 6f 0a 00 00 00 00 00 00 00 00 00 00 |Hello...........|
00024010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
Step 2: Link /mnt/b.txt to /mnt/a.txt
00000000 57 41 59 4e 45 5f 46 53 00 10 00 00 00 40 00 00 |WAYNE_FS.....@..|
00000010 00 04 00 00 01 00 00 00 01 00 00 00 02 00 00 00 |................|
00000020 01 00 00 00 03 00 00 00 20 00 00 00 23 00 00 00 |........ ...#...|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001000 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00002000 ff ff ff ff 1f 00 00 00 00 00 00 00 00 00 00 00 |................|
00002010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00003000 00 40 00 00 02 00 00 00 29 00 00 00 00 00 00 00 |.@......).......|
00003010 9a bb e2 68 00 00 00 00 9a bb e2 68 00 00 00 00 |...h.......h....|
00003020 24 bb e2 68 00 00 00 00 23 00 00 00 00 00 00 00 |$..h....#.......|
00003030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00003080 a4 81 00 00 02 00 00 00 06 00 00 00 00 00 00 00 |................|
00003090 9a bb e2 68 00 00 00 00 35 bb e2 68 00 00 00 00 |...h....5..h....|
000030a0 35 bb e2 68 00 00 00 00 24 00 00 00 00 00 00 00 |5..h....$.......|
000030b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00023000 25 00 00 00 00 00 00 00 01 00 2e 00 00 00 00 02 |%...............|
00023010 00 2e 2e 01 00 00 00 05 00 61 2e 74 78 74 01 00 |.........a.txt..|
00023020 00 00 05 00 62 2e 74 78 74 00 00 00 00 00 00 00 |....b.txt.......|
00023030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00024000 48 65 6c 6c 6f 0a 00 00 00 00 00 00 00 00 00 00 |Hello...........|
00024010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
In data block, there are only one Hello data
From Inode BMP at 0x1000, it doesn't allocate a new inode
Step 3: Check /mnt/a.txt st_ino and st_nlink
st_dev=905969719 st_ino=2 st_mode=0100644 st_nlink=2 st_uid=0 st_gid=0 st_rdev=0 st_size=6 st_atime=1759689525 st_mtime=1759689525 st_ctime=1759689626 st_birthtime=0 st_blksize=65536 st_blocks=32 st_flags=0
Step 4: Check /mnt/b.txt st_ino and st_nlink
st_dev=905969719 st_ino=3 st_mode=0100644 st_nlink=2 st_uid=0 st_gid=0 st_rdev=0 st_size=6 st_atime=1759689525 st_mtime=1759689525 st_ctime=1759689626 st_birthtime=0 st_blksize=65536 st_blocks=32 st_flags=0
Issue
The st_ino should be the same and it also the same from getattr by debug info.
But in the stat, the st_ino are not the same
I write a new data to /mnt/a.txt and check if the /mnt/b.txt is also be modified. It works, it means the inode is the same between /mnt/a.txt and /mnt/b.txt
Metadata
Metadata
Assignees
Labels
No labels