Git Product home page Git Product logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 3, 2024
I never did get to the bottom of this as my kernel debugging skills aren't up 
to what
is required yet.

Here's what I'm seeing and doing to fix it.

Open a file from a Dokan filesystem in notepad.
Wait, wait, wait, wait, wait, yep your seeing it, wait, wait.
It's open!

Shutdown the Dokan filesystem and do "dokanctl /r a" and reboot.
In DokanCompleteCleanup of sys\cleanup.c comment out the three lines:

    CcFlushCache(&fcb->SectionObjectPointers, NULL, 0, NULL);
    CcPurgeCacheSection(&fcb->SectionObjectPointers, NULL, 0, FALSE);
    CcUninitializeCacheMap(fileObject, NULL, NULL);

and recompile, copy the files to where they need to be and do "dokanctl /i a".

Restart the Dokan filesystem.
Open a file from a Dokan filesystem in notepad.
It's open!

I'm guessing these lines are down to enforcing close being called after 
cleanup. My
guess is it's a step towards Dokan filesystem implimentors not having to know 
about
windows filesystem driver cleanup/close and just having a single call.

I tried only calling these three lines only when FileCount of DokanFCB was 0, 
but
couldn't get Kernel debugging working properly.

To get kernel debugging I followed:
http://silverstr.ufies.org/lotr0/windbg-vmware.html


But I found the code:

"
DDbgPrint("  DokanFreeFCB File (%wZ) FileCount = %lu\n",
Fcb->FileName, Fcb->FileCount);

InterlockedDecrement(&Fcb->FileCount);

if (Fcb->FileCount == 0)
{

       DDbgPrint("DokanFreeFCB fcb->FileCount == 0\n");
"

was outputting:


Wed Nov 12 17:37:03.183 2008 (GMT+0):  DokanFreeFCB File () FileCount
= 2184802360
Wed Nov 12 17:37:03.183 2008 (GMT+0):
Wed Nov 12 17:37:03.183 2008 (GMT+0): DokanFreeFCB fcb->FileCount == 0

which I couldn't work out......

I would put it down to different instances and threading, but it seamed to be 
every time.

So I'm stuck.

Original comment by [email protected] on 19 Nov 2008 at 12:22

from dokan.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 3, 2024
I got unstuck. Coming back to this I don't know what my debug issue was, but
everything is working like it should so I'm not seeing any debug weirdness. 
Maybe I
was doing something silly unknowingly.

I'm not seeing fcb->FileCount ever as anything lower then 1 in 
DokanCompleteCleanup.

If you call the three cache clearing lines when fcb->FileCount is 1 then you 
are back
to really slow loads in some programs such as notepad. During the really slow 
load
(and even crash) while notepad is loading there are many of the normal
DokanCreate,DokanCleanup,DokanClose messages, but two new ones stick out:

wait notification event timeout
DokanReleaseTimeoutPendingIRP

When testing this in the virtual machine connected to windbg,  before notepad 
has
finished, it dies with:


*** Fatal System Error: 0x0000000a
                       (0x00000004,0x00000002,0x00000000,0x804F3700)

Mon Nov 24 11:58:08.283 2008 (GMT+0): Break instruction exception - code 
80000003
(first chance)

A fatal system error has occurred.
Debugger entered on first try; Bugcheck callbacks have not been invoked.



However, with the three lines just commented out, the pattern of DokanClose 
being
called after DokanCleanUp doesn't seam any different. So what purpose do these 
three
lines serve and can't they just be removed as they only seam to cause problems.


Original comment by [email protected] on 24 Nov 2008 at 12:07

from dokan.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 3, 2024
Hello,
Thank you so much for your many challenges.

> I'm not seeing fcb->FileCount ever as anything lower
> then 1 in DokanCompleteCleanup.
In my program, fcb->FileCount is decremented in FreeFCB which is called in 
DokanDispatchClose 
(create.c), so it is never reached in cleanup but in close.

BTW
> DDbgPrint("  DokanFreeFCB File (%wZ) FileCount = %lu\n",
> Fcb->FileName, Fcb->FileCount);
This code is wrong.
DDbgPrint("  DokanFreeFCB File (%wZ) FileCount = %lu\n", &Fcb->FileName, 
Fcb->FileCount);
and you should change %lu to meet the actual type of FileCount. Sorry I don't 
remember now.
In my environment, notpad can read more than 45M file and never be crashed. But 
this takes a lot of
time when you enable debug output.
Can you elaborate it a little more?

You can break the debugger, and type "!analyze -v", then you can get much 
information.

Original comment by [email protected] on 24 Nov 2008 at 2:03

from dokan.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 3, 2024
Hi,

> Thank you so much for your many challenges.

Just trying to help. Sorry if I'm not.

> In my program, fcb->FileCount is decremented in FreeFCB which is called in
> DokanDispatchClose (create.c), so it is never reached in cleanup but in close.

Ah, sorry should have seen that.

The DDbgPrint syntax is probably why it all started making sense when I tried 
again,
got it right this time. ;-)

I can't get it to crash again. It was doing it every time when I looked at this
earlier. The file is just a text file (test.txt) containing the text "test ". 
It's
still taking a long time to load (25 seconds).

Selecting properties from the explorer context menu also is taking a long time 
(56
seconds).

(Times are from VMWare player running XP Pro sp2 with 512 MB RAM. The real 
machine is
Intel(R) Core(TM)2 CPU 2.67GHz 3.37GB RAM.)

The crash might have been caused by me, so ignore that until I can reproduce it 
and
show it's not me. ;-)

But the slow load times is defenently the three cache clearing lines in
DokanCompleteCleanup. I'm not seeing an effect of them not being in other then a
speed up. What do they do? I've tried putting in CcFlushCache and 
CcPurgeCacheSection
in DokanFreeFCB for when Fcb->FileCount is 0, but again I still don't see an 
effect
other than a speed up.

Original comment by [email protected] on 24 Nov 2008 at 4:49

from dokan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.