Commit graph

195 commits

Author SHA1 Message Date
Olga Kornievskaia
2676e35ed0 [driver] cosmetic changes 2012-06-01 11:35:47 -04:00
Olga Kornievskaia
54551655d0 [symlink] fixing getea for symlinktargetname on regular file
cygwin does geteas for regular files and asks for nfssymlinktargetname for
which we were doing an upcall and failing nfs41_readlink() with err_invalid.

instead check that it's not a symlink in the driver and reply as we used to
with 0 eavaluelenth
2012-06-01 11:35:37 -04:00
Olga Kornievskaia
192a502785 [acl] incorrectly checking args for setacl
in getacl, the output goes into the userbuffer and thus can't be null.

in setacl, the input comes from setsecurity.securitydescriptor not
userbuffer.
2012-06-01 11:35:35 -04:00
Olga Kornievskaia
70ab983f15 [driver] simplifying upcalldowncall_entry structure
pulling out frequently used pvoid buf, ulong buf_len, and ulonglong changetime
out of individual unions.
2012-06-01 11:35:34 -04:00
Olga Kornievskaia
8e4e36a549 [driver] cleanup code
i meant to separate this commit into two but started doing code
changes after the "1st" commit. it'll be too much work to undo.

so...

1. most of the changes are cosmetic changes that cleanuped some line.
2. code changes: remove filename from individual unions since we have
a global one in the upcalldowncall_entry already.
2012-06-01 11:35:32 -04:00
Casey Bodley
43af1e00b7 symlink: optimization for symlinks in cygwin
when cygwin attempts to open a file for DELETE access, assume that it means to open the link itself.  this avoids making the first open upcall to set up the reparse, only to see RxPrepareToReparseSymbolicLink() return ReparseRequired=FALSE

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-06-01 11:35:30 -04:00
Casey Bodley
f841d14eac symlink: retry open when ReparseRequired=false
according to msdn documentation for RxPrepareToReparseSymbolicLink(), setting ReparseRequired=FALSE means that the link itself should be opened instead of its target.  this shows up when cygwin attempts to delete or rename a symbolic link, because it doesn't open the file with the FILE_OPEN_REPARSE_POINT flag

when RxPrepareToReparseSymbolicLink() returns success but with ReparseRequired=FALSE, set the FILE_OPEN_REPARSE_POINT flag and resend the open upcall

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-06-01 11:35:29 -04:00
Casey Bodley
1a5f3cb3a1 symlink: view symlinks in cygwin
handles the query for NfsSymlinkTargetName EA by making a symlink upcall.  adds a trailing null for 'ls -l' in cygwin

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-06-01 11:35:27 -04:00
Casey Bodley
0afc5ebb4d symlink: create cygwin symlinks
when given a NfsSymlinkTargetName EA on create, marshall the unicode target name to the daemon, which issues a CREATE rpc to create the symlink

modified the driver's marshall_unicode_as_utf8() function to handle the NULL string buffer for non-symlink opens

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-06-01 11:35:25 -04:00
Olga Kornievskaia
453c0cc875 [driver] invalidate data cache on data access reopens
test cases 208, 219, 221 of fileio were failing if rdbss caching was
turned on. the reason was, on reopen of a file, rdbss had cached,
unflushed data yet so reopen had incorrect view of the file.

need to invalidate the cache even if the open didn't return a
different change attribute than the one stored in the fcb, unfortunately.
2012-06-01 11:35:24 -04:00
Casey Bodley
e3de3cf564 driver: static allocation for upcall, fcb lists
macros now expect a non-pointer argument for pList
removed unused pList argument from nfs41_Removeentry()
call to IsListEmpty(&pNetRootContext->mounts.head) changed to nfs41_IsListEmpty() which does locking

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-04 15:41:25 -04:00
Casey Bodley
2e10b99489 driver: fix for is_root_directory()
is_root_directory() was failing to take mount paths into account, causing it to ignore the cached volume attributes and make unnecessary upcalls when a mount path was specified

because the mount path is only available during nfs41_CreateVNetRoot(), its length is now saved in the new field NFS41_V_NET_ROOT_EXTENSION.MountPathLen for use in is_root_directory()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-04 15:41:19 -04:00
Casey Bodley
7a6379b198 Revert "[driver] storing fsattrs in netroot"
This reverts commit 7f338d871b.

now that each VNetRoot makes a MOUNT upcall and fetches fs attributes for its mount path, we no longer need to save fs attributes with the NetRoot

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-04 15:41:13 -04:00
Casey Bodley
f6e02ff4a0 driver: make mount upcalls for shared mounts
even if CreateVNetRoot() finds an existing compatible mount, make a MOUNT upcall and pass that session to the daemon.  the daemon can avoid creating a new root/client/seession, but still has a chance to verify the mount path with LOOKUPs and fetch fs attributes for the new VNetRoot

when the daemon is given an existing root, handle_mount() avoids any extra reference counting on it.  while we can make multiple MOUNT upcalls on a shared mount, we'll still only send the one UNMOUNT upcall on FinalizeNetRoot()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-04 15:41:05 -04:00
Casey Bodley
b48871d807 driver: static allocation for NetRoot mounts list
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-04 15:40:42 -04:00
Olga Kornievskaia
185416b785 [driver] fixing checking open args validity
it's not allowed to ask for no_buffering and append, but it's ok
for write+append.
2012-05-03 17:37:31 -04:00
Olga Kornievskaia
840e136c69 [driver] freeing openlist if driver unloaded 2012-05-03 17:16:56 -04:00
Casey Bodley
c66771cda6 ea: QueryEaInfo support for index, restart, single
nfs41_open_state stores current ea index, and increments it for each successful entry returned.  index is set to 0 when the 'restart' argument is given.  cached directory listing is freed after the listing is complete

QueryEaInfo now sends up its output buffer size, and the daemon uses this to limit its results.  added checks for buffer overflows, which required changes to the downcall structure

updated driver error mappings for map_setea_error()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:58:42 -04:00
Casey Bodley
7b8715ce8e ea: QueryEaInfo accepts a null EaList
check_nfs41_queryea_args() will now accept EaList == NULL, unless EAs are unsupported

moved handling of cygwin EAs to new function QueryCygwinEA()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:58:29 -04:00
Casey Bodley
b2e6a60710 ea: refactor SetEaInfo for use on open
when open is given an ea buffer, pass it to new function nfs41_ea_set() after successful file creation.  matches NTFS behavior on all dispositions: sets EAs on FILE_CREATE, FILE_OVERWRITE, FILE_OVERWRITE_IF, FILE_SUPERSEDE.  does not set EAs on FILE_OPEN.  only sets EAs on FILE_OPEN_IF if file did not previously exist.  see new function create_with_ea()

nfs41_ea_set() returns nfs error codes.  uses NFS4ERR_FBIG when the EaValueLength exceeds NFS4_EASIZE (256).  this gets mapped to windows error ERROR_FILE_TOO_LARGE, which the driver now converts to STATUS_EA_TOO_LARGE

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:58:24 -04:00
Olga Kornievskaia
470d0832ee [ea] pass ea to daemonon open
if an EA buffer is given on create, map it to use space and pass
it to the daemon

removed check for FILE_WRITE_EA permission; it isn't required on ntfs

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:56:47 -04:00
Olga Kornievskaia
b9775a69e9 [driver] fixing arguments checking for acls
a null buffer for get/setacl is valid if buffer length is 0.
2012-05-02 16:17:01 -04:00
Olga Kornievskaia
2253b28ed3 [driver] fixing auth_sys session after gss session 2012-05-02 16:11:45 -04:00
Olga Kornievskaia
11a13bef0f [driver] changing structure to pointer
NFS41_MOUNT_CONFIG structure was allocated on the stack and it's over
2046bytes. Allocating it from the heap to reduce stack size.
2012-04-30 11:16:28 -04:00
Olga Kornievskaia
bcc0ed71cb [driver] finer-grained pool tagging 2012-04-26 16:20:18 -04:00
Olga Kornievskaia
1d2d21632d free upcall entry for async io 2012-04-26 16:14:10 -04:00
Casey Bodley
a0d2e12806 rename: skip upcall when same filename matches destination
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-26 16:14:02 -04:00
Olga Kornievskaia
3e334ef73a [driver] change nt_params structure to pointer 2012-04-26 16:13:24 -04:00
Olga Kornievskaia
57baa75f04 changing error code when path is too long 2012-04-26 11:06:31 -04:00
Olga Kornievskaia
7f338d871b [driver] storing fsattrs in netroot 2012-04-25 12:40:58 -04:00
Casey Bodley
2baeeb855b volume: cache volume attributes on mount
struct NFS41_V_NET_ROOT_EXTENSION now stores only the FILE_FS_ATTRIBUTE_INFORMATION (without the extra buffer space for a name).  on QueryVolumeInfo() for FileFsAttributeInformation on the root directory, the FILE_FS_ATTRIBUTE_INFORMATION is copied into the output buffer, and the name is added there.  QueryVolumeInfo() only makes upcalls when FileFsAttributeInformation queries are not for the root directory

new function is_root_directory() uses the logic from Set/GetReparsePoint() to determine whether it's operating on the root directory

moved logic from volume.c:handle_volume_attributes() to superblock.c:nfs41_superblock_fs_attributes().  the mount downcall copies the FILE_FS_ATTRIBUTE_INFORMATION buffer down to the driver.  the driver reads this buffer directly into VNetRootContext->FsAttrs

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-20 15:03:14 -04:00
Olga Kornievskaia
4c8c263b49 implement getattr for FileNetworkOpenInformation 2012-04-20 12:42:36 -04:00
Olga Kornievskaia
f4071450c0 [driver] done overide open create mode 0 w 0777
removing the check of mode 0 and then setting mode 0777. cygwin can
open for create with mode 0 which we were overriding with 0777.
2012-04-09 15:02:21 -04:00
Casey Bodley
c837631750 ea: fail non-cygwin EAs without named attr support
if non-cygwin EAs are given to Create, SetEaInfo, or QueryEaInfo and the server does not support named attributes, fail with STATUS_EAS_NOT_SUPPORTED.  also adds access checks for FILE_READ_EA and FILE_WRITE_EA

Create will accept all 3 cygwin EAs: NfsV3Attributes, NfsActOnLink, and NfsSymlinkTargetName.  it now handles NfsActOnLink by adding FILE_OPEN_REPARSE_POINT to the create options

SetEaInfo will only accept NfsV3Attributes for setting the file mode. the other two will fail with STATUS_INVALID_PARAMETER.  removed handling of NfsActOnLink in setattr.c

QueryEaInfo will accept all 3 cygwin EAs

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-09 15:01:15 -04:00
Casey Bodley
7bd70cf488 ea: defer storing mode until SetEaInfo succeeds
on SetEaInfo for NfsV3Attributes, wait to set nfs41_fcb.mode until the upcall returns successfully

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-09 15:00:57 -04:00
Olga Kornievskaia
99e127156a [driver] make default upcall timeout 50s 2012-04-03 14:40:56 -04:00
Olga Kornievskaia
41389178a3 setting archive attr based on createopts
was incorrectly using file_attributes instead of create attributes to check
if we are creating a file or a directory. it lead to creating directories
with archive set.
2012-04-02 18:39:54 -04:00
Olga Kornievskaia
9320098f0c [driver] access error code on open
returning access_denied instead of network_access_denied
2012-04-02 12:51:31 -04:00
Olga Kornievskaia
19715faf2b removing readonly file opened for write check
it causes ifstest problems
2012-04-02 12:50:48 -04:00
Olga Kornievskaia
49580a8cfe handling hidden system archive file attributes
todo: still need to mask supported attributes while doing getattrs
2012-04-02 12:49:44 -04:00
Olga Kornievskaia
dc9377ce58 adding arguments check functions to mrx functions
moving input argument checks into check_nfs41_X () functions
2012-03-29 15:47:21 -04:00
Olga Kornievskaia
60e1d87a86 removing unused Flags field in FCB context 2012-03-29 15:47:05 -04:00
Casey Bodley
092c39d9d6 driver: change error code for rename, link with RootDirectory
http://msdn.microsoft.com/en-us/library/cc232085%28v=prot.10%29.aspx : "STATUS_INVALID_PARAMETER: An invalid parameter was passed for FileName or FileNameLength, or the target file was open, or the RootDirectory field value was nonzero for a network operation."

as network filesystems are not expected to support this, return STATUS_INVALID_PARAMETER instead of STATUS_NOT_SUPPORTED

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-29 15:46:55 -04:00
Casey Bodley
e83d36544f symlink: handle errors from REMOVE
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-29 15:46:44 -04:00
Casey Bodley
829c05d6b5 driver: add checks for reparse points on volume
fail attempts to set/get reparse points when the filename is no longer than the vnetroot name (plus a \) to prevent these operations on a volume.  also adds checks for non-null buffers to pass Set/GetPointInvalidParamTest

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-29 15:46:32 -04:00
Casey Bodley
61998b5968 driver: convert strings to utf8 instead of ansi
use RtlUnicodeToUTF8N() instead of RtlUnicodeStringToAnsiString() to preserve unicode filenames; passes fileio test UnicodeOnDiskTest

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-29 11:23:49 -04:00
Olga Kornievskaia
6119fba99f adding sharing violation check for supersede
rdbss usually does sharing violation checks for us but missed this one.
2012-03-29 11:23:45 -04:00
Olga Kornievskaia
b40f685286 return not_supported for windows streams 2012-03-29 11:23:38 -04:00
Olga Kornievskaia
0020104b95 fixing handling of delete_on_close
file can be opened with a delete_on_close flag set. this file can be
opened again as long as opens specify "file_share_delete" access.
after receiving the cleanup irp, the handle enters "delete-pending"
state. opens in this state must fail with status_delete_pending.
file query for standard_info.delete_pending now should return true.

calling setattr with disposition=1 puts the file in "delete-pending"
state.

calling setattr with dispositon=0 will clear delete_on_close only
if file is in "delete-pending" state. otherwise, setattr is ignored.
2012-03-29 11:23:34 -04:00
Casey Bodley
7a8861699f driver: add checks for ifs reparse point tests
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-29 11:23:28 -04:00