diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-05 13:59:36 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-05 13:59:36 -0600 |
commit | a3e3251f2ef27ddb33a74a679729d6d5447307b5 (patch) | |
tree | f39f5c50e139291597265c0a83339f02b4307eb3 /src/nshd/hackers_git/hackers.go | |
parent | adc8af1a3a0d9077621d2b9b5e36b33452f31947 (diff) |
inotify: Avoid most of the race conditions, get rid of Cint
There's still a condition that could be a race with fd-reuse, if one
goroutine is calling inotify.{AddWatch,RmWatch,Read}(); another
goroutine is calling inotify.Close(), and several things happen between
loadFd() running and the add_watch/rm_watch/read syscall launching:
- syscall.Close() returns
- syscall.Open() reuses the filedescriptor
A B
syscall(loadFd()) inotify.Close(); syscall.Open()
----------------------------------------------------------
loadFd()
syscall.Close()
syscall.Open()
syscall()
Given that Read() can't be allowed to block Close() from running, I'm not
sure there's a way to fix this.
Diffstat (limited to 'src/nshd/hackers_git/hackers.go')
-rw-r--r-- | src/nshd/hackers_git/hackers.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nshd/hackers_git/hackers.go b/src/nshd/hackers_git/hackers.go index 0f2dd3d..ca3974d 100644 --- a/src/nshd/hackers_git/hackers.go +++ b/src/nshd/hackers_git/hackers.go @@ -28,10 +28,10 @@ type Hackers struct { users map[int32]user in_fd *inotify.Inotify - in_wd_home inotify.Cint - in_wd_yaml inotify.Cint - in_uid2wd map[int32]inotify.Cint - in_wd2uid map[inotify.Cint]int32 + in_wd_home inotify.Wd + in_wd_yaml inotify.Wd + in_uid2wd map[int32]inotify.Wd + in_wd2uid map[inotify.Wd]int32 } var _ nslcd_systemd.Backend = &Hackers{} |