How to make FS display the disk block level change

It’s an ancient topic but I haven’t found any solution. I add a lowerfilter
to disk driver. I call IoInvalidateDeviceRelation and failed several srb
with SENSE_BUFFER[0]=UNIT_ATTENTION and ScsiStatus=CHECK_CONDITION. But the
disk drver simply retry, and access to the disk will fail if I fail the srb
all along. Then I pass the subsequent srb to lower driver, the disk is
accessable from explorer as nothing happened and block lever change doesn’t
appear yet.

I have tried some other approches such as
IoReportTargetDeviceChangeAsychronous and IOCTL_DISK_INTERNAL_SET_VERIFY,
but they don’t work too.

Data consistency is not so much important to my system and data update
operation(by one admin workstation) is not very frequent. My only one
purpose is to let fs know the change. It seems only fs driver can solve this
problem, dosn’t it?

You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jin Ren
Sent: Thursday, July 21, 2005 8:52 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to make FS display the disk block level change

It’s an ancient topic but I haven’t found any solution. I add a
lowerfilter to disk driver. I call IoInvalidateDeviceRelation and failed
several srb with SENSE_BUFFER[0]=UNIT_ATTENTION and
ScsiStatus=CHECK_CONDITION. But the disk drver simply retry, and access
to the disk will fail if I fail the srb all along. Then I pass the
subsequent srb to lower driver, the disk is accessable from explorer as
nothing happened and block lever change doesn’t appear yet.

I have tried some other approches such as
IoReportTargetDeviceChangeAsychronous and
IOCTL_DISK_INTERNAL_SET_VERIFY, but they don’t work too.

Data consistency is not so much important to my system and data update
operation(by one admin workstation) is not very frequent. My only one
purpose is to let fs know the change. It seems only fs driver can solve
this problem, dosn’t it?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

To build a fs driver will introduce new unpredictable problem to my system,
so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p

What is your system? I presume you’re having some other component write
directly to disk blocks and you want to update the filesystem. Why
can’t that other component write through the FS like everyone else?

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jin Ren
Sent: Thursday, July 21, 2005 9:12 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to make FS display the disk block level change

To build a fs driver will introduce new unpredictable problem to my
system, so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

It’s a SCSI Target run at application level that read write disk by sectors
using ReadFile and WriteFile.
Is it possible for the application to understand the meta-data contained in
block data sent by initiator and act as a file-transfer protocol?
How does meta-data server in SAN work?(Not in theory)

“Peter Wieland” Wrote:xxxxx@ntdev…
What is your system? I presume you’re having some other component write
directly to disk blocks and you want to update the filesystem. Why
can’t that other component write through the FS like everyone else?

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jin Ren
Sent: Thursday, July 21, 2005 9:12 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to make FS display the disk block level change

To build a fs driver will introduce new unpredictable problem to my
system, so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I can’t ensure all components access disk by the same way. For example, the
initiator write to disk by block while user on server want to write disk by
explorer. Data consistency is not in the first place in my system.

“Peter Wieland” Wrote:xxxxx@ntdev…
What is your system? I presume you’re having some other component write
directly to disk blocks and you want to update the filesystem. Why
can’t that other component write through the FS like everyone else?

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jin Ren
Sent: Thursday, July 21, 2005 9:12 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to make FS display the disk block level change

To build a fs driver will introduce new unpredictable problem to my
system, so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I can’t ensure all components access disk by the same way. For example, the
initiator write to disk by block while user on server want to write disk by
explorer. Data consistency is not in the first place in my system.

“Peter Wieland” Wrote:xxxxx@ntdev…
What is your system? I presume you’re having some other component write
directly to disk blocks and you want to update the filesystem. Why
can’t that other component write through the FS like everyone else?

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jin Ren
Sent: Thursday, July 21, 2005 9:12 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to make FS display the disk block level change

To build a fs driver will introduce new unpredictable problem to my
system, so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Jin,

As Peter said, you cannot simply make modifications to the hard disk and
expect the applications to see the change. Sometimes it’ll happen to
work, but most times it won’t. To understand why, you must consider
that Windows has a fairly advanced cache manager, which keeps data that
was read from the HDD around in memory until there’s memory pressure(*).
So, on a machine with much memory, reads of a file can happen only once
from the HDD. This makes performance much better than constantly going
to the media.

As Peter said, you need to interact with the file system. This is
highly suggested for many reasons, but let me throw in a couple
interesting (and relatively common) scenarios (which may not matter in a
closed system):

  1. Mirrored HDD. Have to change both.
  2. Striped HDD. How to change any?

I believe that, as long as you are processing at passive level, you can
open a file from a driver. If you need to use the user’s buffer, you
may need to lock it down (depending on if you know you’re in the
caller’s context), but by using the file system directly you can ensure
proper cache updates.

Perhaps you could (Echo?) tell us what problem you are trying to solve
by doing this, and then someone on the list can share a known-good
method of solving that problem?

Hth,
.

(*) Yes, this is an over-simplification.

-----Original Message-----
From: Jin Ren [mailto:ren.j@263.net]
Sent: Thursday, July 21, 2005 9:12 PM
Subject: Re: How to make FS display the disk block level change

To build a fs driver will introduce new unpredictable problem to my
system,
so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p

FSCTL_LOCK_VOLUME and FSCTL_UNLOCK_VOLUME works! But it is strange that I
can not lock the volume for the second time after a lock-unlock operation
until I close the handle and open volume again.

My system is a data sharing solution on top of iSCSI. The data writen by
client can be discarded after client shutdown. So the main problem is data
update on server which could either from an administrator client or from the
server itself. The former is at block lever and the later is at application
level.

“Henry Gabryjelski” Wrote:xxxxx@ntdev…
Jin,

As Peter said, you cannot simply make modifications to the hard disk and
expect the applications to see the change. Sometimes it’ll happen to
work, but most times it won’t. To understand why, you must consider
that Windows has a fairly advanced cache manager, which keeps data that
was read from the HDD around in memory until there’s memory pressure().
So, on a machine with much memory, reads of a file can happen only once
from the HDD. This makes performance much better than constantly going
to the media.

As Peter said, you need to interact with the file system. This is
highly suggested for many reasons, but let me throw in a couple
interesting (and relatively common) scenarios (which may not matter in a
closed system):

1) Mirrored HDD. Have to change both.
2) Striped HDD. How to change any?

I believe that, as long as you are processing at passive level, you can
open a file from a driver. If you need to use the user’s buffer, you
may need to lock it down (depending on if you know you’re in the
caller’s context), but by using the file system directly you can ensure
proper cache updates.

Perhaps you could (Echo?) tell us what problem you are trying to solve
by doing this, and then someone on the list can share a known-good
method of solving that problem?

Hth,
.

(
) Yes, this is an over-simplification.

-----Original Message-----
From: Jin Ren [mailto:ren.j@263.net]
Sent: Thursday, July 21, 2005 9:12 PM
Subject: Re: How to make FS display the disk block level change

To build a fs driver will introduce new unpredictable problem to my
system,
so what I want is to find some alternative approach.

“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?

You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.

-p

> FSCTL_LOCK_VOLUME and FSCTL_UNLOCK_VOLUME works! But it is
strange that I

can not lock the volume for the second time after a lock-unlock operation
until I close the handle and open volume again.

Yes, this is how the filesystems are implemented.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com