fixes a memory leak that occurs when a readdir loop doesn't complete, since the cookie was only freed on the last readdir upcall. by storing the cookie with nfs41_open_state, we can avoid passing the cookie to the driver and back, and not worry about having to free it separately
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
if the thread placing an upcall was woken up from the sleep, but have not been picked up by the daemon thread from the upcall queue, we would just cancel the upcall. thus nfsd would never see it. however, it was causing leaks in the open state. we would allocate open state but matching close would never make it to the daemon.
instead, always place an upcall to the daemon, but mark it that nobody is waiting for it if the requesting thread gets interrupted and goes away.
instead of using the netroot name, use the vnetroot name (which includes \;Y:\) so that reparse requests go to the same vnetroot. was seeing it create new vnetroots otherwise
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
returns symlink_embedded=TRUE when the symlink isn't the last component, which gets passed to RxPrepareToReparseSymbolicLink()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
added check in handle_open() to avoid calling CREATE/OPEN when we're creating a symlink:
if (args->disposition == FILE_CREATE &&
args->access_mask == (FILE_WRITE_ATTRIBUTES | SYNCHRONIZE | DELETE) &&
args->access_mode == 0 &&
args->create_opts & FILE_OPEN_REPARSE_POINT)
these are the open arguments we get from the CreateSymbolicLink() syscall. by avoiding the call to CREATE/OPEN on handle_open(), we save ourselves from having to REMOVE the file before creating the symlink
added a check to handle_symlink() in case the file was actually created on open (an application could open the file with different arguments, and send the FSCTL_SET_REPARSE_POINT manually), and removes the file first
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
driver handles FSCTL_SET_REPARSE_POINT by sending a symlink set upcall
daemon handles symlink set upcall by calling nfs41_create()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
new NFS41_SYMLINK upcall and associated data in nfs41_updowncall_entry.u.Symlink
supports both setting and querying the symlink target. if Symlink.set is TRUE, Symlink.target is marshalled into the upcall. if Symlink.set is FALSE, Symlink.target is read from the downcall
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
added nfs41_abs_path symlink to struct open_upcall_args. we can't write the symlink target back to args->path anymore, since it's a pointer into the upcall buffer
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
marshall_unicode_as_ansi() calls RtlUnicodeStringToAnsiString() to convert the string directly into the upcall buffer
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
on ERROR_REPARSE, nfs41_Create() generates an absolute path for the symlink target using the format "DeviceName+NetRootName+symlink", and calls RxPrepareToReparseSymbolicLink()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
on last_error == ERROR_REPARSE, the daemon converts args->path back to wchar and passes it down to the driver
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
caused memory leaks of nfs41_open_state. we have the FileDispositionInformation upcall for exactly this, so there's no need to complicate the close code path
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
moved the FileSystemName definition back down to the kernel, so the daemon is no longer responsible for setting it. the driver uses the string length to calculate the buffer size needed for NFS41_V_NET_ROOT_EXTENSION.FsAttrs, and copies in the FileSystemName after the first successful volume attributes upcall
Signed-off-by: Casey Bodley <cbodley@umich.edu>
adds support for mounting with 'net use' and 'Map Network Drive'
if we don't have extended attributes on mount (i.e. not using nfs_mount), don't fail! instead, use SrvName=SrvCallName and MntPt=""
updated nfs41_MountConfig_InitDefaults() to initialize SrvName and MntPt with Length=0
Signed-off-by: Casey Bodley <cbodley@umich.edu>
removed the Config field from NFS41_NETROOT_EXTENSION and NFS41_V_NET_ROOT_EXTENSION and made it local to CreateVNetRoot(), as that's the only place it's accessed and we no longer rely on storing Config.Initialized with the NET_ROOT
Signed-off-by: Casey Bodley <cbodley@umich.edu>
was previously setting pNetRootContext->session to INVALID_HANDLE_VALUE on error, and required checking for both that and NULL. since it starts initialized to NULL, keep it that way
Signed-off-by: Casey Bodley <cbodley@umich.edu>
was doing a memcpy from entry->u.QueryFile.buf to RxContext->Info.Buffer, even though we set entry->u.QueryFile.buf = RxContext->Info.Buffer
Signed-off-by: Casey Bodley <cbodley@umich.edu>