Hi,
We are using Coda under Linux 2.2.13. The link count of a directory
in a Coda file system does not appear to be updated when a subdirectory
is removed. Assuming that "/" is a Coda file system, the following probe
program should be silent. When the bug is present it prints an error
message:
#include <sys/types.h>
#include <sys/stat.h>
main()
{
char *dir = "/a";
char *subdir = "/a/b";
struct stat statb;
(void)mkdir(dir, 0755);
(void)mkdir(subdir, 0755);
(void)stat(dir, &statb);
(void)rmdir(subdir);
(void)stat(dir, &statb);
if (statb.st_nlink != 2)
{
printf("bug\n");
exit(1);
}
exit(0);
}
If .../linux-2.2.13/fs/coda/dir.c:487-488 are changed from
if (de->d_inode->i_nlink)
de->d_inode->i_nlink --;
to
if (de->d_inode->i_nlink)
de->d_inode->i_nlink --;
dir->i_nlink--;
then the above probe becomes silent.
This change makes the Coda kernel code track the ext2 `template'
more closely (fs/ext2/namei.c:638) but deviate further from the
NFS code (fs/nfs/dir.c:nfs_rmdir()).
Regards,
bruce.