Sorry for asking such a basic question, but the Nagar books says that if any
call is made that changes fields in the FCB (e.g., CcSetFileSizes) that I must
allocate the resource exclusively. Can anyone tell me exactly what code I
should use? Does this apply to any changes to fields in the File Object, too?
Thanks.
Neil
He is referring to the resources embedded in the
FSRTL_COMMON_FCB_HEADER struct. There are two of them, called the
‘MainResource’ and ‘PagingIoResource’. There are rules about when and in
what order these resources should be acquired when calling cache manager
routines are fully described in the book. Be careful, though; due to the
symbiotic nature of the VMM, the FSD, and the Cache Manager file system
driver synchroniation can be very complicated and subtle. Be sure you fully
understand the environment in which you are operating before acquiring any
synch objects (these resources or your own).
-----Original Message-----
From: Neil Weicher [mailto:xxxxx@netlib.com]
Sent: Saturday, September 16, 2000 1:09 PM
To: File Systems Developers
Subject: [ntfsd] resource locking
Sorry for asking such a basic question, but the Nagar books says that if any
call is made that changes fields in the FCB (e.g., CcSetFileSizes) that I
must
allocate the resource exclusively. Can anyone tell me exactly what code I
should use? Does this apply to any changes to fields in the File Object,
too?
Thanks.
Neil
You are currently subscribed to ntfsd as: xxxxx@ntpsoftware.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
RE: [ntfsd] resource lockingI think Rajeev nagar’s book is a good source to know more about ordering and aquiring of these two resources.
----- Original Message -----
From: Smith, Joel
To: File Systems Developers
Sent: Monday, September 18, 2000 7:16 PM
Subject: [ntfsd] RE: resource locking
He is referring to the resources embedded in the FSRTL_COMMON_FCB_HEADER struct. There are two of them, called the ‘MainResource’ and ‘PagingIoResource’. There are rules about when and in what order these resources should be acquired when calling cache manager routines are fully described in the book. Be careful, though; due to the symbiotic nature of the VMM, the FSD, and the Cache Manager file system driver synchroniation can be very complicated and subtle. Be sure you fully understand the environment in which you are operating before acquiring any synch objects (these resources or your own).
-----Original Message-----
From: Neil Weicher [mailto:xxxxx@netlib.com]
Sent: Saturday, September 16, 2000 1:09 PM
To: File Systems Developers
Subject: [ntfsd] resource locking
Sorry for asking such a basic question, but the Nagar books says that if any
call is made that changes fields in the FCB (e.g., CcSetFileSizes) that I must
allocate the resource exclusively. Can anyone tell me exactly what code I
should use? Does this apply to any changes to fields in the File Object, too?
Thanks.
Neil
You are currently subscribed to ntfsd as: xxxxx@ntpsoftware.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> Sorry for asking such a basic question, but the Nagar books says that if
any
call is made that changes fields in the FCB (e.g., CcSetFileSizes) that I
must
allocate the resource exclusively. Can anyone tell me exactly what code I
should use?
The common rules are:
- EndOfFile cannot be changed by the paging IO.
- ValidDataLength can be changed only by the top level requester - which
can be a paging write in case of the MPW thread of FlushViewOfFile (there
are ways to distinguish both of them from the Cc flushes and lazy writer).
If I understand the things correctly, Cc designers provided 2 locks - main
and paging ones - in order to improve the performance of the paging IO.
Paging IO will not change EndOfFile by definition and thus does not require
MainResource to be held.
So, PagingIoResource guards ValidDataLength, while MainResource guards both
the rest of 2 size fields and the SectionObjectPointers structure which is
also in the FCB. You must acquire the lock shared to read these values and
exclusively to change them.
BTW - usually PagingIoResource is acquired exclusively only during file
truncations, not during file size growth. See FASTFAT code for the sample.
Does this apply to any changes to fields in the File Object, too?
No. FCB locks are more low-level than file object ones.
Max