]> git.ipfire.org Git - thirdparty/coreutils.git/commit
tail: handle kernel dentry unlink race
authorPádraig Brady <P@draigBrady.com>
Thu, 2 Jul 2015 07:41:25 +0000 (08:41 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 3 Oct 2015 02:03:24 +0000 (03:03 +0100)
commit3ba68f9e64fa2eb8af22d510437a0c6441feb5e0
tree54bffbe83b7b6e16b3e2cfe249ce2dbdc69f1e8d
parent00ac17889345fe48f6fa4eb2e9457319199e0fe2
tail: handle kernel dentry unlink race

Avoid the intermittent loss of "... has become inaccessible" messages.
That would cause tests/tail-2/assert.sh to fail sometimes,
mainly on uniprocessor systems.

* src/tail.c (tail_forever_inotify): Also monitor IN_DELETE
events on the directory, to avoid a dentry unlink()..open() race,
where the open() on the deleted file was seen to succeed after an,
unlink() and a subsequent IN_ATTRIB, was sent to tail.  Note an
IN_ATTRIB is sent on the monitored file to indicate the change in
number of links, and we can't just use a decrease in the number of
links to determine the file being unlinked, due to the possibility
of the file having multiple links.

Reported by Assaf Gordon and Ludovic Courtès.
Fixes http://bugs.gnu.org/21460
src/tail.c