If I create a file named /home/martin/testfile.txt, open this file with less utility, delete /home/martin/testfile.txt file and restore it from file descriptor directory under the /proc/31148, where 31148 is the PID of the less utility, then lsof | grep testfile.txt
still shows testfile.txt as deleted:
martin@potato:~$ echo test > testfile.txt
martin@potato:~$ ls -li ~/testfile.txt
247 -rw-r--r-- 1 martin martin 5 24. veebr 05:02 /home/martin/testfile.txt
martin@potato:~$ xterm -hold -e "less /home/martin/testfile.txt" &
[1] 31145
martin@potato:~$ lsof | grep testfile.txt
less 31148 martin 4r REG 8,9 5 247 /home/martin/testfile.txt
martin@potato:~$ rm -v /home/martin/testfile.txt
removed `/home/martin/testfile.txt'
martin@potato:~$ lsof | grep testfile.txt
less 31148 martin 4r REG 8,9 5 247 /home/martin/testfile.txt (deleted)
martin@potato:~$ cp -v /proc/31148/fd/4 /home/martin/testfile.txt
`/proc/31148/fd/4' -> `/home/martin/testfile.txt'
martin@potato:~$ ls -li ~/testfile.txt
263 -rw-r--r-- 1 martin martin 5 24. veebr 05:04 /home/martin/testfile.txt
martin@potato:~$ cat ~/testfile.txt
test
martin@potato:~$ lsof | grep testfile.txt
less 31148 martin 4r REG 8,9 5 247 /home/martin/testfile.txt (deleted)
martin@potato:~$
Is this because testfile.txt got a new inode number? Or is there some other reason why lsof displays restored file as deleted?