MSNFS & file name

Hello!

I have a legacy file system filter which intercepts most of the IRPs.
While using MSNFS (included in Windows 2003 R2) I run into a problem.

I intercept a file open and I perform a file name query. I have
experienced two different cases:

  • Local file open: I can query and get the file name
  • Open via NFS: I query the file name but I get an empty string
    (described below)

I export a directory on the volume that is controlled by my filter
driver and mount is via NFS on another Linux machine.
When a file is opened via NFS (so the msnfsflt filter opened the file)
I filter the open and perform a filename query.
The file is opened by its file ID. In my post-open handler I build my
own IRP_MJ_QUERY_INFORMATION to query the FileAllInformation. I use a
file object that is provided by the driver below me.
The filename returned has zero file length and this is a critical case
for me since I need the file name.
I have tried to issue a completely new open and query for the filename
again in case I detect a zero file name. But I cannot get the file
name unless I open the same file on windows (?!).

I have also noticed one really strange thing.
If I open a file by file ID and query for filename (using the FileTest
tool by Ladislav Zezula) on the local machine I can get its file name.

Therefore I do not know what is the difference in my opens (from my
filter driver) and that opens that I do using the FileTest tool.

Did anyone had similar experience?

Regards,
Urban

Urban,

For traditional Unix file systems, it is impossible to return a file name on
an open by ID. The file ID refers to an inode on a Unix FS. The metadata
in the inode does not include any information about any names for the file
or what the parent directory is. NTFS is different in that it stores back
links (including parent dir id and relative name) with the file metadata.

  • Danilo

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Urban Purkat
Sent: Friday, February 02, 2007 8:29 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] MSNFS & file name

Hello!

I have a legacy file system filter which intercepts most of the IRPs.
While using MSNFS (included in Windows 2003 R2) I run into a problem.

I intercept a file open and I perform a file name query. I have experienced
two different cases:

  • Local file open: I can query and get the file name
  • Open via NFS: I query the file name but I get an empty string (described
    below)

I export a directory on the volume that is controlled by my filter driver
and mount is via NFS on another Linux machine.
When a file is opened via NFS (so the msnfsflt filter opened the file) I
filter the open and perform a filename query.
The file is opened by its file ID. In my post-open handler I build my own
IRP_MJ_QUERY_INFORMATION to query the FileAllInformation. I use a file
object that is provided by the driver below me.
The filename returned has zero file length and this is a critical case for
me since I need the file name.
I have tried to issue a completely new open and query for the filename again
in case I detect a zero file name. But I cannot get the file name unless I
open the same file on windows (?!).

I have also noticed one really strange thing.
If I open a file by file ID and query for filename (using the FileTest
tool by Ladislav Zezula) on the local machine I can get its file name.

Therefore I do not know what is the difference in my opens (from my filter
driver) and that opens that I do using the FileTest tool.

Did anyone had similar experience?

Regards,
Urban

I have been advising developers in this space for many years to NOT
expect “open by ID” to return a name. This can happen even on NTFS
under the right circumstances (they are just more difficult to
reproduce.)

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com