sudo insmod nova.ko
sudo mount -t NOVA -o init,dbgmask=255 /dev/pmem0 /mnt/pmem0
sudo mkdir /mnt/pmem/dir
# assuming the executable C code is a.out
./a.out /mnt/pmem0
# the output is:
# ., 1
# .., 33
# dir, 33
# The syslog shows the inode number for the `..` file and the `dir` entry is correct.
In the above code snippet, the inode number passed to dir_emit is incorrect. It should be prev_entryc->ino rather than ino. This explains why the .. file's inode is 33 and dir's inode is still 33.
Fix
Simply modify the ino as prev_entryc->ino as the below code shows.
Issue
The inode number is incorrect when
readdir
.Reproduce
The blow C code is used to read the directory and print out the
d_ino
.Reason
https://github.com/NVSL/linux-nova/blob/976a4d1f3d5282863b23aa834e02012167be6ee2/fs/nova/dir.c#L708-L713 https://github.com/NVSL/linux-nova/blob/976a4d1f3d5282863b23aa834e02012167be6ee2/fs/nova/dir.c#L728-L731
In the above code snippet, the inode number passed to
dir_emit
is incorrect. It should beprev_entryc->ino
rather thanino
. This explains why the..
file's inode is 33 anddir
's inode is still 33.Fix
Simply modify the
ino
asprev_entryc->ino
as the below code shows.