Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inotify.go: Fix bug where inotify returns IN_ATTRIB against an open fd when deleted #101

Merged
merged 1 commit into from
Nov 25, 2016

Conversation

TerraTech
Copy link
Contributor

@TerraTech TerraTech commented Sep 9, 2016

While investigating why deleting a log file, then recreating and writing to it, tail would not ReOpen the log file.

As a test:

echo foo > test.log
tail -f test.log &
inotifywait -m test.log &
rm test.log (at this point, inotify issues an IN_ATTRIB on an open fd)
echo bar > test.log  (tail does not reopen)
kill $(pidof tail)  (now inotify will issue an IN_DELETE_SELF as the fd is closed and the inode is able to be purged from the filesystem)

The patch I'm submitting tests for this case and fallsthrough into the fsnotify.Remove code, which appears to handle it correctly.

Please look it over and let me know if this was the correct way to fix the problem.

As an aside, I'm also using this patch: #99 (Tailing stop bug fix)

@alertedsnake
Copy link

Any update on when this can be merged? Seems like this project has become abandonware...

@TerraTech
Copy link
Contributor Author

@mook-as is this project still active?

@Nino-K
Copy link
Contributor

Nino-K commented Nov 25, 2016

@TerraTech Thanks for your contribution.

@Nino-K Nino-K merged commit 915e5fe into hpcloud:master Nov 25, 2016
@xuzixx xuzixx mentioned this pull request Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants