Hello Mark,
this is an old post, but I fell across this issue again and found an easy way to reproduce the problem.
In the meantime, I am using lessfs-1.5.13, but the issue is still the same.
The problem can be reproduced by moving a directory one level up:
machine:/mnt/lessfs/test # ls -la
total 1
drwxr-xr-x 2 root root 4096 Nov 19 22:05 .
drwxr-xr-x 6 root root 4096 Nov 19 22:05 ..
starting with 2 links -ok
creating subdirs:
machine:/mnt/lessfs/test # mkdir sub
machine:/mnt/lessfs/test # ls -la
total 2
drwxr-xr-x 3 root root 4096 Nov 19 22:05 .
drwxr-xr-x 6 root root 4096 Nov 19 22:05 ..
drwxr-xr-x 2 root root 4096 Nov 19 22:05 sub
machine:/mnt/lessfs/test # cd sub
machine:/mnt/lessfs/test/sub # mkdir sub1
machine:/mnt/lessfs/test/sub # mkdir sub2
machine:/mnt/lessfs/test/sub # ls -la
total 2
drwxr-xr-x 4 root root 4096 Nov 19 22:06 .
drwxr-xr-x 3 root root 4096 Nov 19 22:05 ..
drwxr-xr-x 2 root root 4096 Nov 19 22:06 sub1
drwxr-xr-x 2 root root 4096 Nov 19 22:06 sub2
ok - the link count is 4 - which is okay for .
now we move one subdir up:
machine:/mnt/lessfs/test/sub # mv sub1 ..
machine:/mnt/lessfs/test/sub # ls -la
total 2
drwxr-xr-x 4 root root 4096 Nov 19 22:06 .
drwxr-xr-x 3 root root 4096 Nov 19 22:05 ..
drwxr-xr-x 2 root root 4096 Nov 19 22:06 sub2
As you can see, the link count of . is not decreasing, it stays at 4.
Also, the link count for .. is not increasing by one, as it should be.
As I am still having stability problems with remote (watchdir-based) replication, I am trying to get all inconsistencies out in the first place.
The problem can be solved by copying the contents of the folder to outside of lessfs (used /tmp) and then copying them back in. Then the hard link count is corrected.
Would be great if you could look into this. I would be gladly doing preliminary patch testing.
Best Regards,
Hajo