7164570: (fs) WatchService queues CREATE event but not DELETE event for very short lived files [sol11]

Alan Bateman Alan.Bateman at oracle.com
Tue May 1 00:54:19 PDT 2012


I need a reviewer for a small fix to the WatchService implementation 
that we use on Solaris 11.

If a file is created in a watched directory and is immediately removed 
or renamed out then one should expect to receive either zero or two 
events (two events = ENTRY_CREATE + ENTRY_DELETE, assuming that the 
directory is watched for both events). On Solaris 11 only then it's 
possible to receive an ENTRY_CREATE event without a corresponding 
ENTRY_DELETE event. This arises because the watch service implementation 
on this platform has to scan a directory when it gets a notification 
that the directory has changed. It's possible that the file is detected 
during the scan but the attempt to register it for events fails because 
it is deleted. The bug in the current code is that the ENTRY_CREATE 
event is queued when the file is detected but before we attempt to 
register it. There are two ways to fix this, we either don't post the 
ENTRY_CREATE event for this case, or we special case the ENOENT error 
and queue both an ENTRY_CREATE and ENTRY_DELETE event. I decided to go 
for the latter.

The webrev with the change is here:

http://cr.openjdk.java.net/~alanb/7164570/webrev/

Thanks,
Alan.


More information about the nio-dev mailing list