MmForceSectionClosed and remote FS

Hi all,
I really need help on MmForceSectionClosed and Remote File system
during cleanup IRP this call mostly return FALSE that holds the last IRP_MJ_Close

Now since I have shadow file object design it leads to sharing violations.

is there any way we can call MmForceSectionClosed successfully.

Thanks in advance,
-Maneesh

when filter driver has received cleanup call and ref count suggest its last File object .
Why should not it be allowed to close the section that’s been mapped .
why is it different on remote FS , who’s holding that up.
because local FS it runs smooth.

Thanks in advance.
-Maneesh Anand

Assuming you are forcing the section of a file object that belongs to the underlying file system closed, I would note that the fact breaking rules doesn’t ALWAYS malfunction does not mean that something is wrong with the OS or component.

If you don’t own the file object (and hence the SOP structure), you can’t hold the right locks and you don’t have enough insight into the way that the file system works. What you’re finding is a manifestation of this reality.

If YOU want to control the cache, you need to own the SOP - the isolation model/layered file system that uses shadow file objects was created for exactly this type of case.

Tony
OSR

Thanks Tony for your response,
I realised , I did not explain the design ,
it is actually based shadow file object
in create ,I open a lower file object , store handle and Ref to lower FO
in fsContext2
create SOP and cache and mm act on my SOP
all cc and mm calls are on my SOP
most things are inspired from FastFat sample.
during IRP_MJ_CLEANUP lower handle is closed. , but holds the Ref for
pagingIO
During IRP_MJ_Close lower FO is deref

during IRP_MJ_CLEANUP I un-initialize cache and on last ref call
MmForceSectionClosed
but in case of remote FS both call fails
to un-initialize cache I chose to wait for UninitializeCompleteEvent
but for mmsection I dont see any alternative (DelayClose dosnt help)

this hold IRP_MJ_Close and since the Ref count to lower is not zero

further open to lower FO fails with file in use or sharing violations …
this problem is on remote FS only

Thanks in advance,
-Maneesh samria

On Thu, Jun 25, 2015 at 2:05 AM, Tony Mason wrote:

>


>
> Assuming you are forcing the section of a file object that belongs to the
> underlying file system closed, I would note that the fact breaking rules
> doesn’t ALWAYS malfunction does not mean that something is wrong with the
> OS or component.
>
> If you don’t own the file object (and hence the SOP structure), you can’t
> hold the right locks and you don’t have enough insight into the way that
> the file system works. What you’re finding is a manifestation of this
> reality.
>
> If YOU want to control the cache, you need to own the SOP - the isolation
> model/layered file system that uses shadow file objects was created for
> exactly this type of case.
>
> Tony
> OSR
>
>
> —
> NTFSD is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of debugging and file system seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


मनीष आनंद सामरिया
Maneesh Anand.Samria

i think you are not handling OpLock properly.?
you can’t control the cache in case of RDR or RemoteFS.
and there must be a cache coherency.

correct me if I am wrong Oplocks are implemented at server side of SMB
that means if I am getting sharing violation I would get same error on
other machine with similar setup ( access same remote path on other machine
with my driver installed)
But I am able open to it on other machine
which means that the file is locked at client side only server is allowing
it.

On Thu, Jun 25, 2015 at 1:10 PM, wrote:

> i think you are not handling OpLock properly.?
> you can’t control the cache in case of RDR or RemoteFS.
> and there must be a cache coherency.
>
> —
> NTFSD is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of debugging and file system seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


मनीष आनंद सामरिया
Maneesh Anand.Samria

As you said you own the SOP and your filter is based on layered approach.
But as tony said you don’t the fileobject do not take any action on that fileobject.
Adding that sometime flushing and purging the lower file system cache may work
but not always so try this :wink:

If used then live with it you can’t do anything other then some undocumented stuff :smiley:
but use at your own risk.

Cheers!!!

Hope its not too late to reply.
I just want to thank you all, for your valuable time and kind attention.

Regards,
Maneesh