The machine saves the file / locks when the power is turned off on the client side

Our application runs on client server A and creates a file on the server server 2008 R2 using:

CreateFile(LockFileName,
                  GENERIC_READ or GENERIC_WRITE,
                  FILE_SHARE_READ, nil,
                  CREATE_ALWAYS,
                  FILE_FLAG_WRITE_THROUGH or FILE_FLAG_DELETE_ON_CLOSE,
                  0);

The client tests the distress situation and turns off "server A" and leaves it. They report that our application running on “server B” using the same file name and the same code fragment fails (i.e. the file continues to exist) for at least 15 minutes, until, in our opinion , they will not go to the folder containing the file in Windows Explorer, after which the file will be deleted automatically.

Does anyone know how this should behave in this situation, when the creating server is gone, if the handles are released, and the file is deleted automatically? And why does a file search result in its deletion?

Interestingly, on another supposedly similar installation, the problem does not arise.

+5
source share
3 answers

[...] where the creation server was deleted, should descriptors be released and the file deleted automatically?

In the end, yes, but not right away. When starting Windows Server 2008 R2 (and thus SMBv2, note that I assume the server and client are running Windows Server 2008 R2), the client will request a strong file descriptor. According to the SMBv2 specification, section 3.3.6.2 and 3.3.7.1, the server must start a strong open junk timer (set to 16 minutes on Windows Server by default). After the timer expires, the server should check all open descriptors and close those that have not been fixed by the client.

, , , , (.. , ) .

, , - / , . oplock ( 2.2.23.1) , . ( ), oplock ( 3.3.2.1, 35 ), .

: , , UNC-. aplock break ack. Windows , .

. , , . , File Server Win Server 2008. , , (procmon ), Wireshark .

+3

, , . , - . , , . , , .

. , , . , .

, , .

, , , : - . , .

Update

Sysinternals, Microsoft , Process Explorer, . , .

Sysinternals Process Monitor, , . .

: , , .

+1

, . , Microsoft, , hnandled. , , , .

, , , . ( ) , - " ".

Does anyone know how this should behave in this situation, where is the creation server created gone if the pens are released and the file is deleted automatically?

How would the server know?

And why does a file search result in its deletion?

Perhaps this is a read that caused the update to be completed, so - at the end - it stopped a certain behavior (DELETE_ON_CLOSE).

I would hint that any access to certain elements of the file will cause this, but the tester did not do this, just updating the explorer.

0
source

All Articles