[3078] in Athena Bugs
Link count in AFS
daemon@ATHENA.MIT.EDU (John Carr)
Mon Sep 4 00:07:39 1989
To: bugs@ATHENA.MIT.EDU
Cc: vice-squad@ATHENA.MIT.EDU
Date: Mon, 04 Sep 89 00:07:15 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>
When the rename() system call is used to rename a file in AFS that has
multiple links with the destination in another directory, the link
counts of the source and destination directories are trashed. The correct
values can be restored by flushing the directories from the cache:
% ls -d . ___ achates
drwxr-xr-x 6 jfc 2048 Sep 4 00:02 .
-r--r--r-- 1 jfc 135223 Sep 3 23:53 ___
drwxrwxr-x 2 jfc 2048 Sep 3 23:59 achates
% %sa
saber
7 -> link("___","yyy");
(int) 0
8 -> rename("yyy","achates/yyy");
(int) -1
9 -> perror("");
Cross-device link
(int) 18
10 -> ^Z
Stopped
% ls -d . ___ achates
drwxr-xr-x 28 jfc 2048 Sep 4 00:03 .
-r--r--r-- 2 jfc 135223 Sep 3 23:53 ___
drwxrwxr-x184 jfc 2048 Sep 3 23:59 achates
% fs flush . achates
% ls -d . ___ achates
drwxr-xr-x 6 jfc 2048 Sep 4 00:03 .
-r--r--r-- 2 jfc 135223 Sep 3 23:53 ___
drwxrwxr-x 2 jfc 2048 Sep 3 23:59 achates
The exact numbers involved are variable but consistent (i.e. different
files and directories give different numbers, but repeating with the
same files and directories will give the same link counts).