In fs/minix/namei.c:minix_unlink() there is a section of code that looks
like this (with my comments):
repeat:
retval = -ENOENT;
inode = NULL;
bh = minix_find_entry(dir, dentry->d_name.name,
dentry->d_name.len, &de);
if (!bh)
goto end_unlink;
inode = dentry->d_inode;
retval = -EPERM;
if (de->inode != inode->i_ino) { /* call this ifA */
brelse(bh);
current->counter = 0;
schedule();
goto repeat;
}
if (de->inode != inode->i_ino) { /* call this ifB */
retval = -ENOENT;
goto end_unlink;
}
I don't understand this code. More specifically, how can the code inside
ifB ever be executed? If de->inode != inode->i_ino on the first
round then when we are scheduled again we would continue on "repeat"
label, call minix_find_entry() again (which may cause io so we might fall
asleep there too) and so on. To my (unarmed) eyes if de->inode is ever !=
inode->i_ino the code inside ifB will never be executed but loop until
de->inode == inode->i_ino.
Btw, it is not just an academical interest but I am implementing the
unlink() method for some other filesystem and use minix as a perfect
example of how to write a Linux fs. (ext2 is too complex to serve as a
standard). So your help would be very appreciated.
Regards,
Tigran.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/