I'm using a fairly current CVS version of Fuse, and have noticed overlapping open / release calls for a file.  In other words a file is opened multiple times and receives multiple release calls.  Is this expected? 

Details:
Inside a FUSE filesystem, I have a file containing a bunch of md5 sums from 'md5sum' :

    find . -type f -exec md5sum {} \; >> sums.md5

Now, when I check the sums using 'md5sum --check sums.md5',
it has to open 'sums.md5' and then read through thousands of files and at the
very end it comes to a listing for 'sums.md5' in the file.

So at that point it has to open sums.md5, which is already open, and compute
the checksum.

For some reason I get a second open call through from FUSE at this point, and
then at the end a second release.  I stored in a list each call from fuse to
this file, and it looks like this:

request history for filename /sums2.md5:
    requested by "getattr"
    requested by "open"
    requested by "read"
    ... [ a whole lot of reads ] ...
    requested by "getattr"
    requested by "open"
    requested by "read"
    ... [ a whole lot of reads ] ...
    requested by "read"
    requested by "release"
    requested by "release"


This isn't what I expected.  Do I need to keep track of how many open() calls
were made to a file and expect that many release() calls?  I thought that
release would be called only when there were no more uses of a file.

I ran bonnie++ underneath my filesystm, and during it's threaded random seek
performance test (reads at random offsets in a file with multiple threads), I
see this at the end of a request history list:

    ...
    requested by "read"
    requested by "read"
    requested by "release"
    requested by "release"
    requested by "read"
    requested by "release"

So it appears that there may even be additional file operations after one or more of the release calls..

I've solved this in my code by counting the number of open / release calls and only dropping information when the last expected release is received.  But I thought I'd point this out in case, as it was unexpected behavior..

regards,
Valient