From: Mike Lotz [Mike.Lotz@nstor.com] Sent: Wednesday, July 28, 1999 12:37 PM To: 'Robert W. Fuller'; ntdev@atria.com Subject: RE: [ntdev] determine if a file is currently open? That sounds just like the scenario... it was a bummer for us. I don't remember what we had to do to work around it or if we just took our chances. Try to implement an HSM solution when you can't guarantee that you have the file open exclusively for write access....Can lead to data loss. Truncate the file while someone else is still writing to the file. It was not a pretty picture. -----Original Message----- From: Robert W. Fuller [mailto:rob@osr.com] Sent: Wednesday, July 28, 1999 6:49 AM To: ntdev@atria.com Subject: RE: [ntdev] determine if a file is currently open? I can see how this would happen. A thread opens the file with write access and memory maps the file for writing. The thread closes the file handle but does not unmap the file. The FSD removes the share access during IRP_MJ_CLEANUP by calling IoRemoveShareAccess, yet the file is still mapped for writing. A second thread tries to open the file with exclusive write access. The FSD checks the file sharing during IRP_MJ_CREATE by calling IoUpdateShareAccess. IoUpdateShareAccess lets the open succeed since the first thread's sharing access was removed when the first thread closed the file handle. The result is two threads may write to the same file despite the fact one of the two threads requested exclusive write access. Robert W. Fuller Consulting Associate OSR Open Systems Resources, Inc. http://www.osr.com -----Original Message----- From: Richard Hartman [mailto:rhartman@realresume.com] Sent: Tuesday, July 27, 1999 1:04 PM To: Mike Lotz; 'jkirby@storagecraft.com'; Rob Newberry; ntdev@atria.com Subject: RE: [ntdev] determine if a file is currently open? At 12:23 PM 7/27/99 -0400, Mike Lotz wrote: >I seem to remember from a previous life that even though you would think >opening exclusive would guarantee it, that if the file was already >opened Memory mapped (I am pretty sure that this was the case) the open >exclusive could open the file even though another process had the file >open using Memory mapped IO. I know there was a problem and unless it >was fixed in SP4 or SP5 it probably still exists and actually the >problem was in NT5 at the time as well. Just my .005 cents worth...... Hmm... hadn't heard that. Very interesting. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]