jhb 4e6ab5e17b Fix some edge cases with rewinddir():
- In the unionfs case, opendir() and fdopendir() read the directory's full
  contents and cache it.  This cache is not refreshed when rewinddir() is
  called, so rewinddir() will not notice updates to a directory.  Fix this
  by splitting the code to fetch a directory's contents out of
  __opendir_common() into a new _filldir() function and call this from
  rewinddir() when operating on a unionfs directory.
- If rewinddir() is called on a directory opened with fdopendir() before
  any directory entries are fetched, rewinddir() will not adjust the seek
  location of the backing file descriptor.  If the file descriptor passed
  to fdopendir() had a non-zero offset, the rewinddir() will not rewind to
  the beginning.  Fix this by always seeking back to 0 in rewinddir().
  This means the dd_rewind hack can also be removed.

While here, add missing locking to rewinddir().

CR:   	    	https://phabric.freebsd.org/D312
Reviewed by:	jilles
MFC after:	1 week
2014-07-11 16:16:26 +00:00
..
2014-07-07 00:27:09 +00:00
2014-07-07 00:27:09 +00:00
2014-07-07 00:27:09 +00:00
2014-01-21 21:13:13 +00:00
2014-07-10 13:04:52 +00:00
2014-07-07 00:27:09 +00:00
2014-05-15 15:22:32 +00:00
2014-02-01 09:27:57 +00:00
2014-07-07 00:27:09 +00:00
2013-05-12 22:22:12 +00:00
2014-07-07 00:27:09 +00:00
2014-07-07 00:27:09 +00:00
2014-03-22 17:28:14 +00:00
2014-07-07 00:27:09 +00:00
2014-07-07 00:27:09 +00:00
2014-07-07 00:27:09 +00:00