Subject: bug#21460: Race condition in tests/tail-2/assert.sh

From: Paul Eggert <[email-masked]>
Date: Fri, 11 Sep 2015 10:18:36 -0700

Ludovic Courtès wrote:
> I think the problem happens when ‘tail’ opens ‘foo’ right in between of
> the two notifications: ‘foo’ is still there, and so ‘tail’ doesn’t
> report anything.
>
> Does that make sense?

Yes, though if the link count is indeed zero, I'm surprised that 'tail' can open 
the file -- that sounds like a bug in the kernel.

If there is such a kernel bug and 'tail' can open a file with a link count of 
zero, that would explain why 'tail' does not immediately receive an 
IN_DELETE_SELF notification: after all, the file is open (by 'tail' itself) so 
it should not be deleted even if it has a link count of zero.  If so, it appears 
that there's another kernel bug later: when 'tail' closes the file's last file 
descriptor, the file should be deleted and an IN_DELETE_SELF notification should 
be sent to 'tail'.