iput() question

iput() question

Post by Ganesh Kada » Sun, 05 Sep 1993 03:51:04



Hello,
This is a question regarding SystemV UNIX kernel.

We have our own version of unix called CLIX based on the systemV 3.2 source
code from AT&T.  The problem is,
in the namei() function for cases such as LINK, UNLINK(DEL) etc.. the order in
which iput() is done on the parent directory inode and the file inode is
different than the algorithm given in the Maurice J. Bach  book "The
design of the UNIX operating system".

The bach algorithm for unlink() system call
unlink() {
        ..
        iget(parent directory of the file being linked);
        iget (file being unlinked);
        ..
        iput(parent directory inode);
        iput(file inode);

Quote:}

But the code for systemV rel 3.0, 3.1 and 3.2 has the following logic in
s5namei() for the unlink case.
s5namei-case UNLINK(DEL)() {
        ..
        iget(parent directory of the file being linked);
        iget (file being unlinked);
        ..
        iput(file inode);
        iput(parent directory inode); /* The order of iput() is swapped */

Quote:}

Because of the ordering of releasing inodes in the systemV code we ran into
synchronization problems causing machines to panic as you end up freeing the
same inode twice in some scenarios. When we changed the ordering of iput()s
to correspond to the Bach algorithms, our problems went away.

Now the questions:
1) Is systemV's ordering of iput()'s a bug in their code or did they
intentionally release the directory inode before releasing the file inode?
Have they fixed it in any subsequent release of systemV r3?

2) Could somebody with access to SVR 4 code please check up the ordering of
the iput()'s in s5namei() in the SVR 4 code?

I would appreciate any help or information.
Thanks
Ganesh
----------------------------------------------------------------------------

Ganesh Kadaba, Intergraph Corporation
Huntsville, Alabama

Office phone: (205) 730-5689

----------------------------------------------------------------------------