Do not recreate rm watcher if already exists
ChromeOS apparently might send 2 mount events for the same path without unmount event in between. Apparently this cause trouble in the map assignment: map[x] = CreateWatcher(x) Because there, the operation order is: 1. A new watcher is created 2. The old watcher is removed And the old watcher is associated with the same underlying filesystem inotify object with the newly created watcher, causing problem. Therefore, the assignment to the map entry should only happen when there were no old entry. This should solve the crash that happen only when 2 mount events for the same path happens without unmount event in between. When there is no such repeated mount events, this CL is not needed, which explain the random occurrence of the crash that is fixed by this CL. BUG=b:169910596 TEST=Login multiple times and observe no crash. Change-Id: Ibfc2ae15a367aa3ef4b2544fcd4ad570d0ee977f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451930 Commit-Queue: Risan <risan@chromium.org> Reviewed-by:Ryo Hashimoto <hashimoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#814561}
Showing
Please register or sign in to comment