Change 1115496 on 2015/01/29 by robg@robg.ns1.likewise

	Copy //likewise/main@1115439 to //likewise/r1

Change 1113009 on 2015/01/16 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1113006 on 2015/01/16 by justing@justing_ns1_likewise
	==============
	Store SMB2 session keys in the LWIO_SRV_SESSION_2 object
	so that signatures can vary between sessions operating on
	the same connection.
	
	Change 1113005 on 2015/01/16 by justing@justing_ns1_likewise
	==============
	lwio/server/smbcommon/MakeKitBuild:
		Note lwstr.h is now a dependency.
	
	Change 1110902 on 2015/01/06 by daveb@daveb.p4work.shared.likwise.platform-new
	==============
	Changes to support smbtorture smb2.create.gentest.gentest
	
	lwbase/include/lw/security-types.h
	Define mask of valid creat access flags as specified by MS-FSA 
	section 2.1.5.1 
	
	lwio/include/lwio/io-types.h	
	Define mask of valid create attribute flas as defined in MS-FSCC 
	section 2.6.
	
	lwio/server/pvfs/attrib.c
	lwio/server/pvfs/ccb_fileinfo.c
	Move code that declared and error if a directory attribute 
	was applied against a non-directory. This code was removed from 
	PvfspSetAttributes() and added to PvfsCcbSetFileBasicInformation().
	
	The moved code was added to allow smb2.setinfo.setinfo to pass, but
	its presence in PvfspSetAttributes() caused smb2.create.gentest.gentest
	to fail.
	
	lwio/server/pvfs/create.c
	- Test for valid create attribute flags
	- Test for valid create access mask flags
	- Ignore FILE_DELETE_CHILD when maping SMB create/open flags to
	  POSIX  open flags.

Change 1112785 on 2015/01/15 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge 1112781 to //likewise/r1
	
	Correctly handle unsupported ioctls.
	
	lwio/include/lwiofsctl.h
	lwio/server/srv/protocols/smb2/ioctl.c
	- Define and add code to return STATUS_NOT_SUPPORTED for 
	  IO_FSCTL_QUERY_NETWORK_INTERFACE_INFO and 
	  IO_FSCTL_VALIDATE_NEGOTIATE_INFO in the same fashion as 
	  IO_FSCTL_PIPE_WAIT.
	
	lwio/server/smbcommon/includes.h
	- Add #include lwstr.h to get LwByteArrayToHexStr() prototype for
	  lwio/server/smbcommon/packet.c.
	
	lwio/server/smbcommon/packet.c
	- Add trace code to debug invalid packet signing.
	
	lwio/server/srv/include/srvutils.h
	- Define SRV_NF_LOG_* family of macros that do NOT require enabling
	  SRV trace filtering; NF is for No Filter.
	
	lwio/server/srv/protocols/smb2/session_setup.c	# edit
	- Use new SRV_NF_LOG_TRACE() to log session ID to help debug.

Change 1106191 on 2014/12/12 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1106190 by justing@justing_ns1_likewise on 2014/12/12 16:43:33
	==============
	Return absolute path name for FileNameInformation class requests
	in both SMB1 and SMB2.
	
	lwio/server/srv/protocols/smb1/trans2qi.c:
	lwio/server/srv/protocols/smb2/getfileinfo.c:
		Modify SrvMarshalFileName_SMB_V1/2() to treat requests
		with a NULL pTree as requests for an absolute path.
	
		Properly set pulBytesUsed in SrvMarshalFileName_SMB_V1/2().
	
		Pass a NULL pTree to SrvMarshalFileName_SMB_V1/2() unless
		we are looking for the alternate name (DOS name).

Change 1103392 on 2014/11/21 by robg@robg.ns1.likewise

	Merge //likewise/main@1098358 to //likewise/r1

Change 1086748 on 2014/08/26 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge structs.h@1085313 to R1.
	This file should have been included in merge 1086597.

Change 1086732 on 2014/08/26 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge 1086729 to R1:
	
	Further refinements to change 1086597:
	
	Change 1086597 manipulated the socket offset outside of the
	socket lock.
	
	lwio/server/transport/threadpool/srvsocket.c:
	- Use a local copy of the socket offset while processing reads.
	- Acquire the socket lock, update the offset, and call the 
	  protocol data callback

Change 1086730 on 2014/08/26 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge 1086597 to R1
	
	P2_30217: Likewise deadlock when tearing down socket
	
	When a thread receives a socket read or write error, 
	SrvSocketProcessTaskDisconnect() will eventually be executed.
	SrvSocketProcessTaskDisconnect() runs with the socket lock held and
	excutes a "send done" callback. This callback may execute 
	code that acquires a read/write state lock.
	
	Meanwhile another thread holding the read/write state lock may attempt
	to acquire the socket lock; the result is a deadlock.
	
	See P2_30217 for two stack traces showing this dead lock.
	
	The solution is for the srvsocket.c code to release the socket lock
	when executing the socket callbacks.
	
	
	lwio/server/transport/threadpool/srvsocket.c
	- Refactor SrvSocketProcessTaskWrite(), SrvSocketProcessTaskReadZct(),
	  and SrvSocketProcessTaskReadBuffer() to release the socket lock 
	  when calling the pfnConnectionData() and pfnSendDone() callbacks.
	
	- Refactor SrvSocketProcessTaskDisconnect() move the socket send
	  head to a new head, release the socket lock and execute the 
	  pfnSendDone() and pfnConnectionDone() callbacks
	
	lwbase/include/lw/list.h
	lwbase/src/list.c
	- Define a LwListMoveHead() API that moves a list head from one
	  node to another

Change 1065937 on 2014/06/03 by daveb@daveb.p4work.shared.likwise.platform.pure

	P2_29666: Core dump in HashLookup()
	Merge 1065711 to r1
	
	Missing lock around session hash table deletion.

Change 1061989 on 2014/05/14 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge recent changes from //likewise/main to //likewise/r1
	
	Merge list (4 changes):
	1060589 1061846 1061859 1061927
	
	Change 1060589 
	by daveb@daveb.p4work.shared.likwise.platform on 2014/05/08 10:54:59
	==========
	Modify the likewise base level log function to include function and
	line number in each message.
	
	likewise/main/lwsm/server/logger.c
	- Refactored LwSmLogFileLog() and LwSmSyslogLog() to call a new common
	  function LwSmLog()
	- Added LwSmLog() as the core log function; redfined the log format
	  to include at least the function and line number. Higher levels of
		  verbosity incude the file, thread ID, and log level.
	- removed multiple calls to strlen() from LwSmBasename().
	
	
	Change 1061846 
	by daveb@daveb.p4work.shared.likwise.platform on 2014/05/13 18:40:34
	==========
	SrvOplockAsyncCB_SMB_V2() can call SrvBuildOplockExecContext_SMB_V2()
	with a NULL pBreakOplockState variable.
	
	In SrvOplockAsyncCB_SMB_V2() if the SrvLeaseRecordIterNext() loop       
	does not find a suitable BreakOplockState then the loop will exit       
	with ntStatus set to STATUS_SUCCESS and pBreakOplockState set to        
	NULL. Resulting a call to SrvBuildOplockExecContext_SMB_V2() with       
	a NULL BreakOplockState.                                                
	
	Fixed by setting ntStatus = STATUS_NOT_FOUND before the iterator loop   
	
	
	Change 1061859 
	by justing@justing_ns1_likewise on 2014/05/13 21:09:12
	==========
	Fix attempt to unlock an already unlocked mutex when processing an
	oplock break with multiple orphaned handles associated with the same
	lease.
	
	lwio/server/srv/protocols/smb2/oplock.c:
		In SrvOplockAsyncCB_SMB_V2(), pass the correct "in-lock"
		boolean to SrvBuildOplockExecContext_SMB_V2().  This
		must be the boolean associated with the oplock that
		will perform the break operation on the SMB client, which
		may be different than the oplock on which the FS driver
		requested a break.
	
	
	Change 1061927 
	by justing@justing_ns1_likewise on 2014/05/14 08:21:52
	==========
	Fix regression introduced in 1061859.
	
	lwio/server/srv/protocols/smb2/oplock.c:
		In SrvOplockAsyncCB_SMB_V2(), a legacy oplock will not
		be associated with a lease.  Handle the case that the
		oplock is associated with an orphaned durable handle
		and thus must be closed.  The client for the handle is
		not currently connected and thus cannot be notified of
		the break.

Change 1061551 on 2014/05/12 by daveb@daveb.p4work.shared.likwise.platform.pure

	Fix lock recursion issues with lease records by introducing
	an iterator that allows oplocks to be operated upon without
	holding the lease record lock.
	
	Merge 1061445 from //likewise/main to //likewise/r1
	
	lwio/server/srv/elements/lease.c:
	lwio/server/srv/include/elementsapi.h:
	New iterator data structure and API.  When iterating
	on the oplocks of a lease record, the iterator retains
	a reference on the lease record and on the oplock
	returned via the "Next()" API.  All reference counts
	are dropped when the iterator is freed.
	
	lwio/server/srv/elements/lease.c:
	lwio/server/srv/include/elementsapi.h:
	lwio/server/srv/protocols/smb2/oplock.c:
	Remove methods from the base oplock type that applied
	only to SMBv2 and were introduced to get around the
	lack of a safe iterator.
	
	lwio/server/srv/elements/lease.c:
	lwio/server/srv/protocols/smb2/oplock.c:
	Use the new iterator API to move SMBv2 code that was in
	lease.c to oplock.c.
	
	lwio/server/srv/protocols/smb2/oplock.c:
	When responding to an FS lease break, properly iterate
	over the oplocks associated with a lease until an active
	open is found, and dispatch the break notification there.

Change 1061549 on 2014/05/12 by daveb@daveb.p4work.shared.likwise.platform.pure

	Simplify lease record locking scheme.
	Merge 1061444 from //likewise/main to //likewise/r1
	
	lwio/server/srv/elements/lease.c:
	lwio/server/srv/include/elementsapi.h:
	Switch the per-lease record lock from a reader-writer lock to
	a mutex.  The RW features aren't really necessary. 

Change 1061547 on 2014/05/12 by daveb@daveb.p4work.shared.likwise.platform.pure

	Fix style.  No functional changes.
	Merge 1061438 from //likewise/main to //likewise/r1
	
	
	lwio/server/srv/elements/lease.c:
	Correct leading indentation.
	
	lwio/server/srv/include/elementsapi.h:
	Structures have their curly braces on independent lines

Change 1060210 on 2014/05/07 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge 1060193 from //likewise/main to //likewise/r1
	
	Fix use after free bug in the lsass component of Likewise.
	
	- lsass/server/auth-providers/ad-open-provider/lsadm.c:
	In LsaDmConnectDomainComplete() if the pfConnectCallback() 
	 	callout ever sets pState->StatusBlock.bIsNetworkError then the
	error path blindly changes a ERROR_IO_PENDING return value to
	LW_ERROR_DOMAIN_IS_OFFLINE thereby signaling false completion of
	domain join, resulting premature dropping of pState reference
	counts, and leading to the use after free.

Change 1059931 on 2014/05/06 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1059930 on 2014/05/06 by justing@justing_ns1_likewise
	==============
	Fix use after free bug in the lsass component of Likewise.
	
	lsass/server/auth-providers/ad-open-provider/lsadm.c:
		In LsaDmConnectDomainAsyncComplete(), handle
		LsaDmConnectDomainComplete() returning ERROR_IO_PENDING.
		In this case, the call is still outstanding and we must
		wait for LsaDmConnectDomainAsyncComplete() to be called
		again before performing callback completion processing.

Change 1059896 on 2014/05/06 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1058597 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	==============
	Macro to test validity of the PVFS_FILE_ID abstraction.
	
	Change 1058607 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	
	Add the complete set of unimplemented FS info query values to
	the PVFS InfoLevelDispatchTable[] dispatch table; this allows the
	code to correctly return STATUS_NOT_IMPLEMENTED as opposed to
	       STATUS_INVALID_INFO_CLASS
	
	Change 1058618 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	==============
	PvfsQueryFileAllInfo() incorrectly duplicates the 
	SMB2_FILE_INFO_CLASS_STANDARD portion of a 
	SMB2_FILE_INFO_CLASS_ALL query. 
	
	Changed PvfsQueryFileAllInfo() to call 
	PvfsCcbQueryFileStandardInformation() to extract the 
	SMB2_FILE_INFO_CLASS_STANDARD portion of SMB2_FILE_INFO_CLASS_ALL.
	
	Change 1058624 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	==============
	If all time stamp values are zero then set SMB2_FILE_INFO_CLASS_BASIC
	operation is not suppose to modify the timestamps; the code attempted
	to manage this, but as side affect of calling utime(3) ctime is 
	updated.
	
	Changed the code to not call utime(3) if both time stamps are zero.
	
	Change 1058632 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	==============
	Ensure that the FCB always has a valid PVFS FILEID.
	If an alternate stream is the first object to be opened then the
	code did not initialize the FCB with the FILEID of the base object.
	
	Change 1058636 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	==============
	Report STATUS_INVALID_PARAMETER if a set SMB2_FILE_INFO_CLASS_BASIC
	operation attempts to set the "directory" attribute on a non-directory.
	
	Likewise did not actually set this attribute, but correctness
	expects a failure.
	
	Change 1058645 on 2014/05/01 by daveb@daveb.p4work.shared.likwise.platform
	==============
	Pad _SMB_FS_CONTROL_INFO to 48 bytes
	Pad _SMB2_FILE_STANDARD_INFORMATION to 24 bytes
	
	Zero the pads.
	
	Windows servers generate these alignments.
	Smbtorture expects these alignments.
	
	Change 1058957 on 2014/05/02 by daveb@daveb.p4work.shared.likwise.platform
	==============
	Use memset() and sizeof() to zero pad bytes.
	Hard code pad bytes.
	
	Change 1059632 on 2014/05/05 by justing@justing_ns1_likewise
	==============
	Style conformity.  No functional changes.
	
	lwio/server/pvfs/fileAccessInfo.c:
	lwio/server/pvfs/fileAllInfo.c:
	lwio/server/pvfs/fileBothDirInfo.c:
	lwio/server/pvfs/fileDirInfo.c:
	lwio/server/pvfs/fileEaInfo.c:
	lwio/server/pvfs/fileEndOfFileInfo.c:
	lwio/server/pvfs/fileFsControlInfo.c:
	lwio/server/pvfs/fileFsSizeInfo.c:
	lwio/server/pvfs/fileFsVolInfo.c:
	lwio/server/pvfs/fileFullDirInfo.c:
	lwio/server/pvfs/fileIdBothDirInfo.c:
	lwio/server/pvfs/fileIdFullDirInfo.c:
	lwio/server/pvfs/fileInternalInfo.c:
	lwio/server/pvfs/fileLinkInfo.c:
	lwio/server/pvfs/fileModeInfo.c:
	lwio/server/pvfs/fileNameInfo.c:
	lwio/server/pvfs/fileNamesInfo.c:
	lwio/server/pvfs/fileNetworkOpenInfo.c:
	lwio/server/pvfs/filePositionInfo.c:
	lwio/server/pvfs/fileRenameInfo.c:
	lwio/server/pvfs/fileStandardInfo.c:
		Curly braces are placed on their own line.
	
	lwio/server/pvfs/fileAllocationInfo.c:
	lwio/server/pvfs/fileBasicInfo.c:
	lwio/server/pvfs/fileBothDirInfo.c:
	lwio/server/pvfs/fileCompressionInfo.c:
	lwio/server/pvfs/fileDirInfo.c:
	lwio/server/pvfs/fileDispositionInfo.c:
	lwio/server/pvfs/fileEaInfo.c:
	lwio/server/pvfs/fileFsControlInfo.c:
	lwio/server/pvfs/fileFsDeviceInfo.c:
	lwio/server/pvfs/fileFsSizeInfo.c:
	lwio/server/pvfs/fileFsVolInfo.c:
	lwio/server/pvfs/fileFullDirInfo.c:
	lwio/server/pvfs/fileFullEaInfo.c:
	lwio/server/pvfs/fileIdBothDirInfo.c:
	lwio/server/pvfs/fileIdFullDirInfo.c:
	lwio/server/pvfs/fileInternalInfo.c:
	lwio/server/pvfs/fileModeInfo.c:
	lwio/server/pvfs/fileNameInfo.c:
	lwio/server/pvfs/fileNamesInfo.c:
	lwio/server/pvfs/fileStandardInfo.c:
		Remove extra lines at the end of the file.
	
	lwio/server/pvfs/fileBasicInfo.c:
		Remove stray extra space in an assignment.
	
	lwio/server/pvfs/fileFullDirInfo.c:
	lwio/server/pvfs/fileIdFullDirInfo.c:
		Fix typo in comment.
	
	Change 1059646 on 2014/05/05 by justing@justing_ns1_likewise
	==============
	Style conformity.  No functional changes.
	
	lwio/server/pvfs/close.c:
	lwio/server/pvfs/deviceio.c:
	lwio/server/pvfs/fileAccessInfo.c:
	lwio/server/pvfs/fileAllInfo.c:
	lwio/server/pvfs/fileAllocationInfo.c:
	lwio/server/pvfs/fileBasicInfo.c:
	lwio/server/pvfs/fileBothDirInfo.c:
	lwio/server/pvfs/fileDirInfo.c:
	lwio/server/pvfs/fileDispositionInfo.c:
	lwio/server/pvfs/fileEaInfo.c:
	lwio/server/pvfs/fileEndOfFileInfo.c:
	lwio/server/pvfs/fileFsAttribInfo.c:
	lwio/server/pvfs/fileFsControlInfo.c:
	lwio/server/pvfs/fileFsDeviceInfo.c:
	lwio/server/pvfs/fileFsSizeInfo.c:
	lwio/server/pvfs/fileFsVolInfo.c:
	lwio/server/pvfs/fileFullDirInfo.c:
	lwio/server/pvfs/fileIdBothDirInfo.c:
	lwio/server/pvfs/fileIdFullDirInfo.c:
	lwio/server/pvfs/fileInternalInfo.c:
	lwio/server/pvfs/fileLinkInfo.c:
	lwio/server/pvfs/fileModeInfo.c:
	lwio/server/pvfs/fileNameInfo.c:
	lwio/server/pvfs/fileNamesInfo.c:
	lwio/server/pvfs/fileNetworkOpenInfo.c:
	lwio/server/pvfs/filePositionInfo.c:
	lwio/server/pvfs/fileRenameInfo.c:
	lwio/server/pvfs/fileStandardInfo.c:
	lwio/server/pvfs/fileStreamInfo.c:
	lwio/server/pvfs/flush.c:
	lwio/server/pvfs/lock.c:
	lwio/server/pvfs/lwFilePosixDirInfo.c:
	lwio/server/pvfs/lwFilePosixInfo.c:
	lwio/server/pvfs/notify.c:
	lwio/server/pvfs/oplock.c:
	lwio/server/pvfs/querydir.c:
	lwio/server/pvfs/queryfile.c:
	lwio/server/pvfs/querysecdesc.c:
	lwio/server/pvfs/queryvol.c:
	lwio/server/pvfs/read.c:
	lwio/server/pvfs/write.c:
		Remove stray extra space in an assignment.
	
	lwio/server/pvfs/fileAccessInfo.c:
	lwio/server/pvfs/fileAllInfo.c:
	lwio/server/pvfs/fileModeInfo.c:
	lwio/server/pvfs/fileNameInfo.c:
	lwio/server/pvfs/fileStandardInfo.c:
	lwio/server/pvfs/lwFilePosixInfo.c:
		Fix typo in comment.
	
	Change 1059650 on 2014/05/05 by justing@justing_ns1_likewise
	==============
	Improve code readability.  No functional changes intended.
	
	lwio/server/pvfs/fileAccessInfo.c:
	lwio/server/pvfs/fileAllocationInfo.c:
	lwio/server/pvfs/fileBasicInfo.c:
	lwio/server/pvfs/fileBothDirInfo.c:
	lwio/server/pvfs/fileDirInfo.c:
	lwio/server/pvfs/fileEaInfo.c:
	lwio/server/pvfs/fileFsAttribInfo.c:
	lwio/server/pvfs/fileFsDeviceInfo.c:
	lwio/server/pvfs/fileFsSizeInfo.c:
	lwio/server/pvfs/fileFsVolInfo.c:
	lwio/server/pvfs/fileFullDirInfo.c:
	lwio/server/pvfs/fileIdBothDirInfo.c:
	lwio/server/pvfs/fileInternalInfo.c:
	lwio/server/pvfs/fileLinkInfo.c:
	lwio/server/pvfs/fileModeInfo.c:
	lwio/server/pvfs/fileNetworkOpenInfo.c:
	lwio/server/pvfs/filePositionInfo.c:
	lwio/server/pvfs/fileStandardInfo.c:
		Remove superfluous set of status to STATUS_SUCCESS when
		it is already STATUS_SUCCESS.
	
	Change 1059652 on 2014/05/05 by justing@justing_ns1_likewise
	==============
	Fix regression introduced in 1051300.
	
	lwio/server/pvfs/fileAllInfo.c:
		In PvfsQueryFileAllInfo(), remove unecessary setting
		of ntError to STATUS_SUCCESS.  This can clobber the
		conditional setting of ntError to STATUS_BUFFER_OVERFLOW,
		yeilding a truncated buffer to the client with the wrong
		result code.
	
	Change 1059653 on 2014/05/05 by justing@justing_ns1_likewise
	==============
	Fix regression introduced in 1051300.
	
	lwio/server/pvfs/fileNameInfo.c:
		In PvfsQueryFileNameInfo(), properly set the
		BytesTransferred field in the IRP when returning
		STATUS_BUFFER_OVERFLOW.

Change 1057427 on 2014/04/26 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1057425 on 2014/04/26 by justing@justing_ns1_likewise
	==============
	Fix access beyond the bounds of the SMB2 credit bitmap.
	
	lwio/server/srv/elements/creditor.c:
		In SrvCreditorSequenceToWindowRegion(), handle bitmap wrap
		if the sequence starts far enough into the window to exceed
		the distance between lWindowStart and lWindowBitmapSize - 1.
		This can happen when sequence numbers are consumed out of
		order.
	
		Add additional asserts.
	
		Since this module has been rewritten, assert a Spectra
		Logic copyright.

Change 1057237 on 2014/04/25 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1057235 on 2014/04/25 by justing@justing_ns1_likewise
	==============
	Restore ability to reconnect to a durable handle that has not
	yet been orphaned (other open is in the process of being closed)
	that was lost in 1054946.
	
	lwio/server/srv/elements/durable.c:
	lwio/server/srv/include/elementsapi.h:
		Rather than rely on the durable handle's oplock handle
		to determine if the handle is valid for reconnection,
		use an explicit boolean.  The oplock handle will not
		be set if an earlier open for the handle is still being
		torn down and handle orphan processing has yet to occur.

Change 1057113 on 2014/04/24 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1057110 on 2014/04/24 by justing@justing_ns1_likewise
	==============
	Fix access beyond the bounds of the SMB2 credit bitmap.
	
	Found by: valgrind
	
	lwio/server/srv/elements/creditor.c:
		In SrvCreditorOpenWindow(), skip second call to bit_nset()
		if the first call, which opened the window by setting bits
		at the end of the credit bitmap, completed the window opening
		operation.  Otherwise bit_nset() will be called with an
		end index smaller than start index, resulting in an access
		just infront of the credit bitmap array.
	
	Change 1057111 on 2014/04/24 by justing@justing_ns1_likewise
	==============
	Sort the opens sharing a lease record in the order in which they
	occurred on the wire, so lease break notification are attempted
	against opens in this same order.
	
	lwio/server/srv/elements/lease.c:
		Use LwListInsertTail() instead of LwListInsertAfter() when
		adding oplocks to a lease record.  The latter causes the
		records to be sorted in reverse order.
	
	Change 1057112 on 2014/04/24 by justing@justing_ns1_likewise
	==============
	Avoid lock recursion when closing or timing out durable handles,
	and when shutting down the durable handle module.
	
	TeamTracks: 29377, 29378
	
	lwio/server/srv/elements/durable.c:
		In situations where releasing the oplock associated with
		a durable handle may result in the oplock attempting to
		close this same durable handle, defer the release until
		the durable handle table lock is dropped so that it can
		be reaquired during the close operation.

Change 1056855 on 2014/04/23 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1056854 on 2014/04/23 by justing@justing_ns1_likewise
	==============
	Properly handle the oplock for an orphaned durable handle being
	completed with STATUS_SWITCH_TO_NEW_HANDLE.
	
	lwio/server/srv/protocols/smb2/oplock.c:
		In SrvOplockAsyncCB_SMB_V2(), remove incorrect assert
		in the STATUS_SWITCH_TO_NEW_HANDLE case that required
		the oplock to be associated with an active open file
		handle and not a durable handle.  Since a client can
		have multiple connections open, it is possible for another
		open on the same lease to take over a durable handle's
		oplock registration with the file system.
	
		Note: Additional work is still required in order to
		      handle an oplock break that is sent to a durable
		      handle when there are other active opens on the same
		      lease that could respond to a break notificication.
		      This situation is likely rare and will be addressed
		      in a future optimization to Likewise's lease support.
	
	Change 1056853 on 2014/04/23 by justing@justing_ns1_likewise
	==============
	Fix off-by-one error that could lead to credit bitmap corruption.
	
	lwio/server/srv/elements/creditor.c:
		In SrvCreditorOpenWindow(), change ">" to ">=" so that
		an open operation that wraps the window's end index to
		0 is properly handled.

Change 1056652 on 2014/04/23 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1056637 on 2014/04/22 by justing@justing_ns1_likewise
	==============
	Record the client GUID of SMB2 clients.
	
	lwio/server/srv/include/elementsapi.h:
		Add client GUID to the SRV_CLIENT_PROPERTIES structure
		contained in the SRV_CONNECTION object.
	
	lwio/server/srv/protocols/smb2/negotiate.c:
		Popluate the client GUID when processing the SMB2 negotiate
		message.
	
	Change 1056650 on 2014/04/23 by justing@justing_ns1_likewise
	==============
	Fix assertion failure in Likewise.
	
	lwio/server/srv/protocols/smb2/oplock.c:
		Allow a durable handle to be closed from the oplock
		free routine.  Oplock objects are now retained even
		after a "switch to new handle" completion so that
		any active opens for a file from the same
		client/lease-key can be used to deliver a future
		lease break.  This now means that a durable handle
		may receive, during reparenting, an oplock without
		an outstanding IRP with the durable handle holding
		the only reference.  In this case, canceling the
		oplock is a no-op and the oplock free routine will
		find that it is still associated with a durable
		handle.
	
	Change 1056651 on 2014/04/23 by justing@justing_ns1_likewise
	==============
	Allow lease tables to be shared between SMB2 connections that
	use the same client GUID.
	
	lwio/server/srv/elements/libmain.c:
		Call into the lease module so it can perform global
		initialization and shutdown.
	
	lwio/server/srv/elements/structs.h:
	lwio/server/srv/elements/lease.c:
	lwio/server/srv/include/elementsapi.h:
		Add a hash table of client lease tables, keyed by the
		client GUID received in SMB2 negotiate messages.
	
		Have connections and each lease record maintain references
		on their associated lease table so that it is only reclaimed
		once all connections are closed and durable handles have
		expired.
	
	lwio/server/srv/elements/srvconnection.c:
		Remove creation of a lease table at the time a connection
		is accepted.  The table is now associated with the connection
		the first time a lease record request is made so that the 
		client GUID is available.
	
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/oplock.c:
		Revert temporary workarounds committed in 1056546, now that
		lease tables/records can persist across connections.

Change 1056629 on 2014/04/22 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1056628 on 2014/04/22 by justing@justing_ns1_likewise
	==============
	Correct regression in handling a durable handle reconnect.
	
	lwio/server/srv/protocols/smb2/create.c:
		When reconnecting to a durable handle, the reparenting
		of the oplock already adds it to the appropriate lease
		key.  Don't attempt to add it again.

Change 1056552 on 2014/04/22 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1055591 on 2014/04/16 by justing@justing_ns1_likewise
	==============
	Replace Likewise's sequence number and credit accounting
	implementation to improve performance, reduce complexity,
	and eliminate the potential to leak credit in certain error
	scenarios.
	
	lwbase/include/MakeKitBuild:
	lwbase/include/lw/bitstring.h:
	lwio/server/srv/elements/includes.h:
		Add FreeBSD's bitstring.h, with Spectra's recent
		improvements, into the Likewise build.  It is copied
		here so that Likewise remains self contained and
		buildable on other platforms.
	
	lwio/server/srv/elements/defs.h:
		Default the per-client credit limit to 8192.  128,
		representing 8MB in flight, is much too small for
		10Gbe networks, and probably too small for even
		1Gbe.
	
		For Verde, this change has no effect since the
		registry is initialized to this value the first
		time Likewise is started.
	
	lwio/server/srv/elements/config.c:
		Given the new default credit limit, start a client's
		credit grant at 1/16th rather than 1/8th of the
		client's maximum credit limit.
	
	lwio/server/srv/elements/prototypes.h:
	lwio/server/srv/elements/creditor.c:
	lwio/server/srv/elements/srvconnection.c:
		Change SrvCreditorFree() to use the "pointer to
		pointer" idiom for releasing storage, which allows
		the caller's pointer to be NULLed.
	
	lwio/server/srv/include/elementsapi.h:
	lwio/server/srv/elements/structs.h:
	lwio/server/srv/elements/creditor.c:
		New credit tracking implementation.  Rather than
		keep independent lists of available, interim, and
		active sequence numbers, track only available credit
		in a single bitmap.
	
		The bitmap offers constant speed for credit validation,
		freeing, and allocation, and is immune to the effects
		of sequence number fragmentation.  Since the bitmap
		is allocated at the time a client connects, several
		trips through the memory allocator and O(n) list
		traversals are now removed from the request processing
		path.
	
		At the time credit is validated/consumed, allocate
		any replacement credit the client has requested and
		record this in the message processing execution
		context.  This upfront allocation removes any need
		for tracking interim and active sequence numbers
		which were previously used to prevent double reporting
		of credit.  Instead, the allocated credit is reported
		to the client in the next response issued, whether
		that be a normal response, interim response, or
		error, since all of these contexts have access to
		the execution context and can determine if any
		credit remains to be reported.
	
	lwio/server/srv/protocols/smb2/libmain.c:
	//likewise/main/lwio/server/srv/protocols/api/libmain.c	# edit
	lwio/server/srv/protocols/smb2/read.c:
		Clear the credit value from the execution context
		on successful queing of the response packet.  This
		ensures that credit returned in an interim response
		is not granted again in a final response, and that
		credit will not be lost even if errors are encountered
		during the marshalling of a response.  The error
		packet sent in the "late error case" will still
		find and report the proper credit value from the
		execution context.
	
	lwio/server/srv/protocols/api/negotiate.c:
	lwio/server/srv/protocols/include/smb2.h:
	lwio/server/srv/protocols/smb2/negotiate.c:
		Pass the execution context to the SMB negotiate
		message processing functions so that credit can be
		allocated and reported when transitioning from the
		SMB1 to the SMB2 protocol.
	
	lwio/server/srv/protocols/smb2/libmain.c:
		Simplify the credit charge validation code.
	
		Normalize pSmbRequest->CreditCharge (0 -> 1) for
		all dialects at the time of credit charge validation,
		and rely on this in all later credit related code.
	
	lwio/server/srv/protocols/smb2/notify_state.c:
	lwio/server/srv/protocols/smb2/oplock.c:
		Some commands, that are active for extended periods
		of time, re-build their execution state when they
		are finally completed.  The rebuilt execution
		states always return zero credit back to the client
		since any necessary credit was already returned in
		the interim response.
	
	lwio/server/srv/protocols/smb2/close.c:
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/echo.c:
	lwio/server/srv/protocols/smb2/error.c:
	lwio/server/srv/protocols/smb2/find.c:
	lwio/server/srv/protocols/smb2/flush.c:
	lwio/server/srv/protocols/smb2/getinfo.c:
	lwio/server/srv/protocols/smb2/getquotainfo.c:
	lwio/server/srv/protocols/smb2/getsecinfo.c:
	lwio/server/srv/protocols/smb2/ioctl.c:
	lwio/server/srv/protocols/smb2/lock.c:
	lwio/server/srv/protocols/smb2/logoff.c:
	lwio/server/srv/protocols/smb2/negotiate.c:
	lwio/server/srv/protocols/smb2/notify_request.c:
	lwio/server/srv/protocols/smb2/notify_state.c:
	lwio/server/srv/protocols/smb2/oplock.c:
	lwio/server/srv/protocols/smb2/read.c:
	lwio/server/srv/protocols/smb2/session_setup.c:
	lwio/server/srv/protocols/smb2/setinfo.c:
	lwio/server/srv/protocols/smb2/treeconnect.c:
	lwio/server/srv/protocols/smb2/treedisconnect.c:
	lwio/server/srv/protocols/smb2/wire.c:
	lwio/server/srv/protocols/smb2/write.c:
		Remove private calls to allocate credit now that
		this action is performed universally at the time
		the incoming sequence number and credit charge are
		validated.
	
	Change 1056546 on 2014/04/22 by justing@justing_ns1_likewise
	==============
	Fix regressions introduced in 1056195.
	
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/oplock.c:
		When re-parenting an oplock, also reparent the oplock's
		lease record.  Right now, lease tables are associated with
		a connection and get torn down when the connection is
		dropped.  So, the oplock cannot be referenced there when
		a file handle is orphaned.
	
		As a temporary work around for the lack of persistence for
		lease tables, use the client lease key as the file system
		key.  This ensures that, when the lease records for a new
		connection are created, the file system key used for a
		durable handle will still match.
	
	lwio/server/srv/elements/durable.c:
		When canceling the oplock owned by a durable entry, null
		out the handle so we don't try to release it again when
		the durable handle is freed.
	
	Change 1056549 on 2014/04/22 by justing@justing_ns1_likewise
	==============
	Enhance support for valgrind.  No functional changes for
	normal builds.
	
	lwio/server/iomgr/iodriver.c	# edit
		Add #ifdefs around dlclose() call that can be activated
		when using valgrind so that symbols for modules are
		available to the memcheck tool on shutdown.

Change 1056201 on 2014/04/21 by keitho@keitho.ns1.likewise.r1

	Integrate changes 1056185, 1056186, 1056188, 1056190, 1056195 from
	//likewise/main to //likewise/r1
	
	Change 1056195 on 2014/04/21 by justing@justing_ns1_likewise
	==============
	
	Correct lease upgrade behavior when upgrading a lease with
	no caching (lease state is 0), and multiple opens against a
	held lease with a subset of the already held lease caching
	types.
	
	lwio/server/srv/elements/durable.c:
	lwio/server/srv/elements/lease.c:
	lwio/server/srv/elements/srvfile.c:
	lwio/server/srv/elements/srvfile2.c:
	lwio/server/srv/include/elements_types.h:
	lwio/server/srv/include/elementsapi.h:
	lwio/server/srv/protocols/smb1/createx.c:
	lwio/server/srv/protocols/smb1/lockx.c:
	lwio/server/srv/protocols/smb1/nttransact.c:
	lwio/server/srv/protocols/smb1/openx.c:
	lwio/server/srv/protocols/smb1/oplock.c:
	lwio/server/srv/protocols/smb1/prototypes.h:
	lwio/server/srv/protocols/smb1/structs.h:
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/oplock.c:
	lwio/server/srv/protocols/smb2/prototypes.h:
	lwio/server/srv/protocols/smb2/structs.h:
		Replace the OplockBlock an element level oplock
		type SRV_OPLOCK that is shared between SMB1 and
		SMB2.  Embed this type as the first field within
		the SMB protocol specific oplock state objects.
	
		Add new function vectors to SRV_OPLOCK to get the
		FID associated with an oplock and to force an oplock
		to reassert itself as the current handler for any
		oplock breaks on a lease.
	
		Add inline wrappers for methods in the SRV_OPLOCK
		vtable to simplify clients of these APIs.
	
		The Free method for SRV_OPLOCK now unconditionally
		frees the oplock.  Reference counting is now performed
		via the explicit SrvAcquireOplock() and SrvReleaseOplock()
		APIs.
	
		Keep a SRV_OPLOCK object for all opens that reference
		a lease, not just the one currently registered with
		the file system driver.  This includes leases that don't
		request any caching.  The lease could later be upgraded and
		we may need this open in order to deliver a future break.
	
		If the oplock for a lease is cancelled, find any
		other open oplock on the lease and register this
		with the file system driver.  This ensures that
		future oplock breaks are not missed.
	
		When requesting a new open on an existing lease, don't
		bother to pass the call down to the file system driver
		if the lease is equal to or a subset of the existing lease.
		The SMB2 layer is already authorized to return the existing
		lease state.
	
	Change 1056190 on 2014/04/21 by justing@justing_ns1_likewise
	==============
	
	Fix Likewise crash due to a race between oplock setup and file
	handle close.
	
	lwio/server/pvfs/lease.c:
	lwio/server/pvfs/oplock.c:
		Remove early calls to PvfsIrpMarkPending in the oplock
		and lease grant code paths.  The SCB must be referenced
		and the IrpContext's queue type must be set prior to
		marking the Irp pending so that the IrpContext is
		fully consistent during a cancelation attempt.  The
		common code in PvfsOplockRequest() performs this setup
		and marks the Irp pending, so there is no need to
		do this in the leaf functions it calls.
	
	Change 1056188 on 2014/04/21 by justing@justing_ns1_likewise
	==============
	
	Fix crash in Likewise when upgrading READ or READ|HANDLE  leases.
	
	lwio/server/pvfs/lease.c:
		Remove overly aggressive asserts in PvfsGrant*Lease().  These
		asserts were meant to verify that a given lease holder has
		at most one outstanding oplock.  However, they incorrectly
		triggered when multiple shared leases (read or read and
		handle caching) were active on a single file.
	
		The assert was removed in the exclusive case too, since
		multiple entries can temporarily be active for the same
		client due to handle switches and cancellations.
	
	Change 1056186 on 2014/04/21 by justing@justing_ns1_likewise
	==============
	
	Correct lease upgrade behavior when attempting a read/write lease.
	
	lwio/server/pvfs/lease.c:
		Revert change 1055260.  Since leases can never be downgraded
		by the client, the only valid existing handles must be
		the same (READ|WRITE), or a subset (READ).
	
	Change 1056185 on 2014/04/21 by justing@justing_ns1_likewise
	==============
	
	Style fixes.  No functional changes.
	
	lwio/server/pvfs/lease.c:
		Correct typos in comments.

Change 1055687 on 2014/04/17 by keitho@keitho.ns1.likewise.r1

	Integrate change 1055594 from //likewise/main to //likewise/r1
	
	Change 1055594 by justing@justing_ns1_likewise on 2014/04/16 23:26:01
	==============
	
	Fix assertion failure in Likewise.
	
	TeamTrack: 29315
	
	lwio/server/srv/protocols/smb2/oplock.c:
		In SrvReparentOplockState_SMB_V2(), remove assertion
		that the fid of the current file handle and owner of
		the oplock is associated with the oplock's lease key.  
		The fid may have been previously removed due to the
		oplock switching to a new handle.

Change 1055262 on 2014/04/15 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1055260 on 2014/04/15 by justing@justing_ns1_likewise
	==============
	Fix Likewise "lease break against myself" issue.
	
	lwio/server/pvfs/lease.c:
		Perform "switch to new handle" processing for
		READ|WRITE|HANDLE caching leases as is already done
		for READ|WRITE and READ leases.

Change 1055039 on 2014/04/14 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1055038 by justing@justing_ns1_likewise on 2014/04/14 13:17:11
	==============
	Fix leak of zero-copy exec contexts.
	
	lwio/server/transport/threadpool/srvsocket.c:
		Improve on the changes from 1054929.  Background threads
		may queue new work to be sent out the socket while
		the current thread is writing.  Always invoke the completion
		callback for items queued by another thread, even if the
		queued item happens to reuse the same memory as for the
		"direct dispatch" item processed and freed earlier.

Change 1054949 on 2014/04/13 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1054929 by justing@justing_ns1_likewise on 2014/04/13 16:56:15
	==============
	Fix leak of zero-copy exec contexts.
	
	lwio/server/transport/threadpool/srvsocket.c:
		Modify SrvSocketProcessTaskWrite() to indicate if the
		passed in send item (packet) was actually sent.  Use
		this status in SrvSocketSendReplyCommon() to set the
		correct return value of either PENDING (item not yet
		sent) or SUCCESS.  The previous logic used a non-empty
		send queue to infer that the item hadn't been sent.
		Now that additional packets can be added to the queue
		during transmission, the packets still in the queue
		may have all been queued after the item being sent.
	
		The incorrect send status caused the ZCT code hold on
		to its exec contexts until receiving the "send complete"
		callback for packets that had already been sent.
	
	Change 1054943 by justing@justing_ns1_likewise on 2014/04/13 20:29:14
	==============
	Improve likewise diagnostics.
	
	lwio/server/pvfs/ccb.c:
	lwio/server/pvfs/structs.h:
		Track the number of active affinity groups in the system.
	
	Change 1054946 by justing@justing_ns1_likewise on 2014/04/13 20:43:17
	
	Correct refcount usage and assertion failures in the durable
	handle module.
	
	lwio/server/srv/elements/durable.c:
	lwio/server/srv/include/elementsapi.h:
		Modify the durable handle code so that durable handles are
		recorded in the durable handle hash table for their entire
		lifecycle.  This removes the need for an extra "in the table"
		reference count on the handle and code that assumed incorretly
		that the entry was in the table and holding a reference.
	
		During shutdown, wait for all durable handles to be freed
		and removed from the durable handle table before deleting
		the table and its associated mutex.
	
	Change 1054948 by justing@justing_ns1_likewise on 2014/04/13 20:48:29
	==============
	Close race conditions between canceling an oplock and reparenting
	it from a file to a durable handle.
	
	lwio/server/srv/protocols/smb2/structs.h:
	lwio/server/srv/protocols/smb2/oplock.c:
		When an oplock is cancelled, record that state in the
		oplock state structure.  If a reparenting attempt occurs
		after cancellation but before the durable handle is closed,
		return STATUS_USER_SESSION_DELETED to indicate that the
		oplock is no longer valid.
	
		Always close an orphaned durable handle on any completion
		of the oplock IRP from the file system layer.  The only
		operations that can occur are break or cancel and both
		indicate that the durable handle is no longer viable.

Change 1054654 on 2014/04/11 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1054653 on 2014/04/11 by justing@justing_ns1_likewise
	==============
	Fix Likewise crash on durable handle close.
	
	TeamTrack: 29303
	
	lwio/server/srv/elements/durable.c:
		Restore oplock cancelation and free processing in
		SrvFreeDurableHandle().  If a durable handle is orphaned
		and the oplock subsequently broken, the durable handle
		is the owner of the oplock and must free it.

Change 1054619 on 2014/04/11 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1054615 on 2014/04/11 by justing@justing_ns1_likewise
	==============
	Improve Likewise's file handle affinity optimization.
	
	The implementation in change set 1052381, performs both the
	file system portions of an I/O operation and its completion from
	the same worker thread.  This is the same behavior as before
	file handle affinity was added, but the grouping of related I/Os
	made the completion of one I/O stall the file system requests
	for the next I/O.  This delay introduced a latency bubble in the
	I/O stream, reducing performance.  Separate file system and
	completion processing into separate threads so that they can
	be pipelined.
	
	lwio/server/pvfs/ccb.c:
	lwio/server/pvfs/ccb_p.h:
	lwio/server/pvfs/scb.c:
	lwio/server/pvfs/write.c:
	lwio/server/pvfs/read.c:
		When completing an IRP for file system I/O on an
		affinity group, use PvfsAsyncCompleteIrpContext()
		instead of PvfsCompleteIrpContext().  This decouples
		the completion processing for the current IRP from
		the processing of the next IRP in the group.
	
		Refactor into shared code the I/O context code that
		was 99.99% identical between read and write operations.
	
		Rather than spawn specific thread for affinity group
		scheduling, use the original, global PVFS thread pool.
		This has the benefit of automatically balancing
		affinity group load across all available threads.
		To make this possible, each affinity group contains a
		thread pool work item that processes the group's queue
		of I/O.
	
		Only reap affinity groups at file (CCB) close.  This
		avoids the cost of constantly allocating and freeing
		groups as the I/O load on a file changes.  The max
		number of affinity groups per-file is capped by the
		Likewise registry entry "AffinityGroupsPerFile".  It
		defaults to "4 * numCpus".
	
		When processing an affinity group, yield every 
		"AffinityWorkItemYieldInterval" requests (default 16).
		This ensures that a continuous sequential load on a
		file does not prevent other scheduled affinity groups
		from getting a thread and executing.
	
	lwio/server/pvfs/config.c:
		Add new tunables AffinityGroupsPerFile and
		AffinityWorkItemYieldInterval.
	
		Remove tunable AffinityThreadsPerCpu since we rely on
		the global Pvfs pool.
	
	lwio/server/pvfs/config.c:
	lwio/server/pvfs/driver.c:
	lwio/server/pvfs/globals.c:
	lwio/server/pvfs/irpctx.c:
	lwio/server/pvfs/locking.c:
	lwio/server/pvfs/oplock.c:
	lwio/server/pvfs/notify.c:
	lwio/server/pvfs/scb.c:
	lwio/server/pvfs/structs.h:
		Return PVFS to having a single thread pool.
	
	Change 1054616 on 2014/04/11 by justing@justing_ns1_likewise
	==============
	Style fixes.  No functional changes.
	
	lwio/server/pvfs/listq.c:
		Remove extra newlines at end of file.

Change 1054288 on 2014/04/10 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1054284 on 2014/04/10 by justing@justing_ns1_likewise
	==============
	Fix lwio crash when breaking the oplock for an orphaned durable
	file handle.
	
	TeamTrack: 29303
	
	lwio/server/srv/elements/durable.c:
	lwio/server/srv/protocols/smb2/oplock.c:
		When a durable file handle is orphaned, the oplock
		associated with the handle persists in order to respond
		to file system layer oplock breaks.  If the oplock is
		broken, the durable handle is closed.  To support this
		behavior, a reference to the durable handle must be
		delegate to the oplock during this window.
	
		Solve the durable handle and oplock leaks addressed in
		1054003 (which removed this reference) in a different way.
		During Likewise shutdown or when the durable handle
		reap timer expires, explicitly cancel the oplock
		associated with the durable handle and manually release
		its lock on the durable handle.

Change 1054039 on 2014/04/09 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1053886 by justing@justing_ns1_likewise on 2014/04/08 21:10:24
	==============
	Correct minor protocol violations in Likewise: reserved and pad
	bytes should be set to 0.
	
	Found by: valgrind
	
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/wire.c:
		Zero pad bytes used to align payloads to mandatory
		alignment boundaries.
	
	lwio/server/srv/protocols/smb2/find.c:
		Remove unnecessary tail padding of the error reponse
		packet used to indicate the end of a directory
		enumeration.
	
		Set reserved fields to 0.
	
	lwio/server/srv/protocols/smb2/wire.c:
		Fix test for sufficient space to write pad bytes for
		alignemnt.
	
	Change 1054003 by justing@justing_ns1_likewise on 2014/04/09 13:25:05
	==============
	Fix memory leak when orphaning durable handles.
	
	lwio/server/srv/elements/durable.c:
		Make the reference counting APIs on durable handle entries
		symetrical with the addition of SrvSmb2DurableAcquireInLock().
	
		Add assertions to verify reference count invariants.
	
		Improve comments describing refcount ownership and lifecycle.
	
		When orphaning a durable handle (disassociating it from
		an active file handle), only acquire a reference count for
		the expiration timer if a timer is actually scheduled.
	
		When orphaning a durable handle, release the file handle's
		hold on the durable handle.  This leaves just the
		expiration timer's hold (if any) and the hash table's
		hold, allowing the durable handle to be reclaimed at
		shutdown or handle expiration.
	
		When reconnecting to a durable handle, acquire a reference
		count for the new file handle, now that the previous
		owner's refcount is released when the handle is orphaned.
	
	Change 1054009 by justing@justing_ns1_likewise on 2014/04/09 14:03:01
	==============
	Fix leak of the async close file state for files with durable
	handles that are orphaned.
	
	lwio/server/srv/elements/prototypes.h:
	lwio/server/srv/elements/srvasyncclose.c:
		Modify the function signature of SrvAsyncCloseFileStateExecute()
		so that it can clear the caller's async state pointer to
		convey the transfer of ownership, to the async close system,
		for this object.
	
	lwio/server/srv/elements/srvasyncclose.c:
		Remove superfluous cast.
	
	lwio/server/srv/elements/srvfile.c:
	lwio/server/srv/elements/srvfile2.c:
		When freeing a file object, always free the async
		close state if present and not already transferred
		to the async close system.
	
	Change 1054010 by justing@justing_ns1_likewise on 2014/04/09 14:05:00
	==============
	Style cleanup.  No functional changes.
	
	lwio/server/srv/elements/structs.h:
		Remove extra blank lines at end of file.
	
	Change 1054016 by justing@justing_ns1_likewise on 2014/04/09 14:19:05
	==============
	Remove redundant SrvFile2 API.
	
	lwio/server/srv/elements/srvfile2.c:
	lwio/server/srv/include/elementsapi.h:
	lwio/server/srv/protocols/smb2/oplock.c:
		The only caller of SrvFile2RemoveOplockState() performed
		additional actions to make it behave like
		SrvFile2ResetOplockState().  Replace custom code with
		a call to SrvFile2ResetOplockState().
	
	Change 1054018 by justing@justing_ns1_likewise on 2014/04/09 14:23:08
	==============
	Fix reader/writer lock use bug.
	
	lwio/server/srv/elements/srvfile2.c:
		In SrvFile2SetClosing() acquire lock for exclusive access
		since this routine modifies state.
	
	Change 1054019 by justing@justing_ns1_likewise on 2014/04/09 14:28:17
	==============
	lwio/server/srv/protocols/smb2/oplock.c:
		Remove superfluous casts.  No functional changes.
	
	Change 1054025 by justing@justing_ns1_likewise on 2014/04/09 14:42:09
	==============
	Fix memory leak of oplock state objects.
	
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/oplock.c:
	lwio/server/srv/protocols/smb2/prototypes.h:
		Make reference count API for oplock state objects symetical
		by introducing SrvReleaseOplockState_SMB_V2()'s counterpart
		SrvAcquireOplockState_SMB_V2().  Consistently use these
		APIs rather than manual InterlockedIncrement/Decrement().
		Missing cleanup when InterlockedDecrement() returned 0
		(last refcount released) in both create.c and oplock.c
		was the cause for this leak.
	
	Change 1054032 by justing@justing_ns1_likewise on 2014/04/09 14:52:23
	==============
	Style cleanups.  No functional change.
	
	lwio/server/srv/protocols/smb2/create.c:
		Remove superfluous casts.
	
	Change 1054036 by justing@justing_ns1_likewise on 2014/04/09 15:16:37
	==============
	Correctly allow the current holder of an SMB2.1 lease to
	open additional file handles to a file without issuing
	spurious lease breaks.
	
	Expose SRV_LEASE_RECORD as a publicly visible structure.
	Allow consumers of leases to find, allocate, and hold a
	reference to lease records directly.  This ensures that a
	given lease record persists across operations like create
	that can, temporarily, cause the only file handle reference
	on a lease to drop.  This avoids the accidental regeneration
	of the file system GUID for a lease when a new open by the
	current holder of a lease causes the lease FID to be replaced.
	
	TeamTrack: 28599
	
	lwio/server/srv/elements/lease.c:
		Rename Lease operations from "LeaseKey" to "LeaseRecord".
	
		Reimplement Lease table methods to properly deal with
		concurrent attempts to find, add or remove a lease.
		This is unlikely to happen with SMB 2.1 clients, but
		could occur with the multi-connection capabilities of
		SMB 3.x.
	
	lwio/server/srv/include/elements_types.h:
	lwio/server/srv/include/elementsapi.h:
		Expose SRV_LEASE_RECORD and updated lease API.
	
	lwio/server/srv/protocols/smb2/oplock.c:
	lwio/server/srv/protocols/smb2/create.c:
	lwio/server/srv/protocols/smb2/structs.h:
		Conform to the new lease API.
	
	lwio/server/srv/protocols/smb2/create.c:
		Add documentation for lease record allocation and usage
		during the SMB2 create process.
	
	lwio/server/srv/protocols/smb2/oplock.c:
		When reparenting an oplock (e.g. when a durable file handle
		is orphaned or reconnected), update the FID for the associated
		lease.  Without this, certain lease operations after a
		durable handle reconnect will fail.
	
		Remove duplicate code when processing a cancelled oplock.
		The same operations will occur as soon as the oplock's last
		reference is lost (which should be immediately after we
		process the cancel) in the oplock free routine.

Change 1052671 on 2014/04/06 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1052665 by justing@justing_ns1_likewise on 2014/04/06 15:58:02
	==============
	Fix memory leak.
	
	Found by: valgrind
	
	lwio/server/iomgr/ioipc.c:
		Restructure IopIpcCleanupFileHandle() so that the
		IO_STATUS_BLOCK is properly cleaned up for error
		codes other than STATUS_SUCCESS or STATUS_PENDING.
	
	Change 1052666 by justing@justing_ns1_likewise on 2014/04/06 15:59:49
	==============
	Fix memory leak.
	
	Found by: valgrind
	
	lwio/server/pvfs/ccb.c:
		In PvfsReleaseIoAffinityGroup(), free the request list
		structure when freeing an affinity group.
	
	Change 1052667 by justing@justing_ns1_likewise on 2014/04/06 16:02:53
	==============
	lwio/server/pvfs/create.c:
	lwio/server/pvfs/leasekey.c:
		Fix typos in comments.  No functional changes.

Change 1052592 on 2014/04/04 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1052589 by justing@justing_ns1_likewise on 2014/04/04 10:49:52
	==============
	Likewise file handle affinity tuning.
	
	lwio/server/pvfs/config.c:
		Reduce the affinity byte range from 16MB to 4MB.

Change 1052533 on 2014/04/03 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1052530 by justing@justing_ns1_likewise on 2014/04/03 15:14:06
	==============
	Allow concurrent reads and writes on a single connection.
	
	lwio/server/transport/threadpool/srvsocket.c:
		Replace SRV_SOCKET_FAKE_INTERLOCKED_EXCHANGE_32, which uses
		a mutex, with the recently added lw_atomic_swap_u32() API.
	
	lwio/server/transport/threadpool/srvsocket.c:
	lwio/server/transport/threadpool/structs.h:
		When reading or writing to a socket, set a flag to indicate
		that I/O is in progress and drop the socket lock.  This
		allows a single read and single writer to be simultaneously
		active on the socket.  It also allows async read completions
		to queue up packets for the current socket writer without
		having to block.

Change 1052387 on 2014/04/02 by justing@justing_ns1_likewise

	Merge //likewise/main to //likewise/r1:
	
	Change 1052385 by justing@justing_ns1_likewise on 2014/04/02 11:45:22
	==============
	Fix Likewise build failure in a clean environment.
	
	lwbase/include/lw/atomic_x86.h:
	lwbase/include/lw/atomic_x86_64.h:
		Use locally defined lw_compiler_membar() instead of
		FreeBSD specific __compiler_membar() in atomic ops.
		This substitution was missed in the origial implementation
		of these files.

Change 1052383 on 2014/04/02 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1049990 on 2014/03/21 by justing@justing_ns1_likewise
	==============
	Remove invalid pointer arithmetic on void pointers.
	
	lwio/server/pvfs/notify.c:
		In PvfsNotifyFormatNotifyInfo(), cast to PBYTE instead
		of PVOID when calculating start address for pad bytes.
	
	Change 1051298 on 2014/03/27 by justing@justing_ns1_likewise
	==============
	Correct minor SMB2 protocol violation.
	
	lwio/server/srv/protocols/smb2/libmain.c:
		Zero any pad bytes that occur between compound SMB2
		responses.
	
	Change 1051300 on 2014/03/27 by justing@justing_ns1_likewise
	==============
	Audit and refactor Likewise's support for querying
	FileInformation and FileSystemInformation information class
	data.
	
	TeamTrack: 29133 (Complete)
	
	lwio/include/lwio/io-types-posix.h:
	lwio/include/lwio/io-types.h:
		Use C99 style "[]" variable sized arrays at the end of
		data structures instead of giving them a a size of 1.
		This fixes several off by one errors where sizeof()
		was used without taking the non-zero size of the
		"built-in" array into account.  This also allows
		the field to be added safely to packed structures
		that omitted the field to avoid size calculation bugs.
	
		All consumers of these structures have been audited to
		adjust any code that expected the single array element
		to be present in the result of sizeof().
	
	lwio/include/lwio/io-types.h:
		Add some missing reserved fields that show up due to
		normal compiler structure padding.
	
	lwio/include/lwio/ioapi.h:
		Add a function typedef for the common function signature
		of the IoQueryFileInfo() and IoQueryVolumeInfo() APIs.
		This allows these functions to be passed as parameters
		to utility functions that are shared between the
		implementation of the SMB2 query functions for these
		info classes.
	
	lwio/server/include/smbwire.h:
	lwio/server/srv/protocols/smb2/structs.h:
		Move SMB2_FILE_BASIC_INFORMATION to structs.h where all of
		the other SMB2 specific info classes are kept.
	
	lwio/server/iomgr/ioipc.c:
	lwio/server/pvfs/fileAllInfo.c:
	lwio/server/pvfs/fileBothDirInfo.c:
	lwio/server/pvfs/fileDirInfo.c:
	lwio/server/pvfs/fileFsAttribInfo.c:
	lwio/server/pvfs/fileFsVolInfo.c:
	lwio/server/pvfs/fileFullDirInfo.c:
	lwio/server/pvfs/fileIdBothDirInfo.c:
	lwio/server/pvfs/fileIdFullDirInfo.c:
	lwio/server/pvfs/fileLinkInfo.c:
	lwio/server/pvfs/fileNameInfo.c:
	lwio/server/pvfs/fileNamesInfo.c:
	lwio/server/pvfs/fileRenameInfo.c:
	lwio/server/pvfs/fileStreamInfo.c:
	lwio/server/pvfs/lwFilePosixDirInfo.c:
	lwio/server/pvfs/notify.c:
	lwio/server/pvfs/quota.c:
	lwio/server/srv/protocols/smb1/finder.c:
	lwio/server/srv/protocols/smb1/ntrename.c:
	lwio/server/srv/protocols/smb1/rename.c:
	lwio/server/srv/protocols/smb1/trans2qfsi.c:
	lwio/server/srv/protocols/smb1/trans2qi.c:
	lwio/server/srv/protocols/smb2/find.c:
	lwio/server/srv/protocols/smb2/setinfo.c:
	lwio/tests/test_pvfs/main.c:
		Use LW_FIELD_OFFSET() instead of sizeof() to determine the
		offset of the variable length field at the end of unpacked
		structures.  Because many of these types follow the field
		order and size specified in the SMB2 spec, the variable
		length portion of the structure may not land on a natural
		structure alignment boundary.  This can lead to errors in
		buffer size allocation and data placement.  SMB2 structs for
		data passed on the wire are always declared "attribute
		packed", allowing sizeof() to be used safely.
	
	lwio/server/pvfs/fileAllInfo.c:
	lwio/server/pvfs/fileFsAttribInfo.c:
	lwio/server/pvfs/fileFsVolInfo.c:
	lwio/server/rdr/setinfo2.c:
		Wrap code to 80 cols.  Remove excess newlines at the end
		of the file.
	
		Return STATUS_BUFFER_TOO_SMALL if the output buffer size
		is less than the fixed portion of the info class result.
		If the buffer is large enough to return the fixed
		portion, but less than enough to return the entire result,
		return STATUS_BUFFER_OVERFLOW in addition to providing
		the data that can fit in the provided buffer.
	
		Correctly update BytesTransferred in the IoStatus block
		for the IRP to include the actual data transferred instead
		of always asserting that only the fixed portion of the
		info result was provided.
	
	lwio/server/pvfs/fileAllInfo.c:
	lwio/server/pvfs/fileNameInfo.c:
		Fix double accounting of the fixed portion of an info
		response in determining available output buffer space.
	
	lwio/server/pvfs/queryvol.c:
		Remove superfluous casts.
	
	lwio/server/srv/include/elementsapi.h:
	lwio/server/srv/protocols/smb2/structs.h:
		Add packed data structures for info classes Likewise
		supports, but previously assumed to be identical to the
		structures used in the iomgr API.  In general, the
		code assumes that the SMB and iomgr APIs may diverge
		in content, content representation (e.g. pointer to a
		file handle vs. a FID), endianess, and structure packing.
		So explicit marshalling must be performed between the
		two structure types in all cases.
	
		Note: Endianess fixups do not appear to be universally
		deployed in the code base.  This will require correction
		if we ever need to run on a big-endian host.
	
		Be consistent in naming conventions.  Only structures
		fronting dynamic content have the _HEADER suffix.
	
		Add C99 style variable arrays to _HEADER structures
		that were previously missing them.
	
	lwio/server/srv/protocols/smb2/getfileinfo.c:
	lwio/server/srv/protocols/smb2/getfsinfo.c:
	lwio/server/srv/protocols/smb2/getinfo.c:
	lwio/server/srv/protocols/smb2/prototypes.h:
		Refactor SMB2 GetFileInfo and GetFileSystemInfo processing
		code.
	
		For info classes with dynamic content, allow partial results
		to be returned if the output buffer is too small to take
		the entire result.
	
		Correct buffer size and wire format alignment calculations
		for many result types.
	
	lwio/utils/ea.c:
		Add a comment that a "+ 1" is due to the NUL character
		terminator of a string.
	
	Change 1052091 on 2014/03/31 by justing@justing_ns1_likewise
	==============
	Add complete set of atomic operations, imported with
	modifications from FreeBSD, to Likewise.  Use these to
	remove use of a global lock to protect changes to the state
	flags of PVFS I/O request contexts.
	
	lwbase/include/lw/atomic.h:
	lwbase/include/lw/atomic_lock.h:
	lwbase/include/lw/atomic_x86.h:
	lwbase/include/lw/atomic_x86_64.h:
	lwbase/src/atomic.c:
		New atomic ops implementation.  i386 and amd64 assembly
		versions are provided.  All other architectures fall back
		to using a pthread mutex for mutual exclusion.
	
	dcerpc/MakeKitBuild:
	dcerpc/dcelib/lwrpcrt.c:
	libschannel/MakeKitBuild:
	lsass/MakeKitBuild:
	lsass/client/api/clientipc_thr.c:
	lsass/client/rpc/krb5pac/includes.h:
	lsass/interop/lwmapsecurity/lwmapsecurity-lsass.c:
	lsass/pstore/lsapstore-backend-legacy-internal.c:
	lwadvapi/unthreaded/time/MakeKitBuild:
	lwbase/MakeKitBuild:
	lwbase/include/MakeKitBuild:
	lwbase/src/MakeKitBuild:
	lwbase/src/svcm-wrap.c:
	lwio/MakeKitBuild:
	lwio/drivers/iotest/workqueue.c:
	lwio/tools/lwio-tool/lwparseargs.h:
	lwmsg/MakeKitBuild:
	lwnetapi/MakeKitBuild:
	lwreg/MakeKitBuild:
	lwsm/MakeKitBuild:
	lwupgrade/MakeKitBuild:
	mklocal/module/likewise.sh:
	netlogon/MakeKitBuild:
	srvsvc/MakeKitBuild:
	sysauth/MakeKitBuild:
		Update build configuration and includes so that architecture
		information is available when including lw/atomic.h so that
		the appropriate atomic operations can be defined.
	
	lwbase/src/svcm.c:
	lwbase/src/threadpool-common.h:
	lwbase/src/threadpool-timer.c:
		Convert from old to new API.
	
		Use unsigned types for flags variable.  It doesn't make sense
		for a bit field to be signed.
	
	lwio/server/pvfs/irpctx.c:
	lwio/server/pvfs/pvfs.h:
	lwio/server/pvfs/structs.h:
		Make all PvfsIrpContext*Flag() function inline and convert to
		using the appropriate atomic ops instead of a global lock.
	
	Change 1052336 on 2014/04/02 by justing@justing_ns1_likewise
	==============
	Fix potential reference count leak introduced in change 1051300.
	
	lwio/server/srv/protocols/smb2/getinfo.c:
		In SrvGetFileOrVolumeInfoGeneric_WithString_SMB_V2(),
		release the execution context reference (via
		SrvReleaseGetInfoStateAsync_SMB_V2()) if our query
		completes synchronously from inside the sizing loop.
		It is possible for this loop to invoke the query
		function multiple times and have it return
		synchronously.  Each of these references must be
		released.  Previously, the routine released at most
		one reference.
	
	Change 1052375 on 2014/04/02 by justing@justing_ns1_likewise
	==============
	Fix style nit.  No functional changes.
	
	lwio/server/pvfs/pvfs.h:
		Align constant on a tab stop like all others in the file.
	
	Change 1052381 on 2014/04/02 by justing@justing_ns1_likewise
	==============
	Add I/O thread affinity for reads and writes to a shared
	range within a file so that sequential access over SMB
	is seen as sequential by ZFS and its prefetch engine.
	
	lwio/server/pvfs/ccb.c:
	lwio/server/pvfs/ccb_p.h:
		Add "affinity groups" to create create context
		blocks (CCBs).  Each CCB fronts a single posix file
		descriptor and represents a single file handle to
		a client.
	
		All requests to a particular affinity group are
		assigned to and processed by a single threaded
		Likewise thread pool.  CCBs are allowed as many
		affinity groups as there are configured affinity
		threads: 4 (changeable via the Likewise registery)
		* numCPUs.
	
		Requests are grouped by their file offset.  Requests
		accessing the same 16MB (changeable via the Likewise
		registry) range of a file are assigned to the same
		affinity group.
	
		If no best fit for an I/O is found in the existing
		groups, and all groups are allocated, the request
		is assigned to the group with the fewest number of
		outstanding requests.
	
	lwio/server/pvfs/config.c:
	lwio/server/pvfs/structs.h:
		Lookup tunable affinity parameters in the registry.
	
	lwio/server/pvfs/driver.c:
	lwio/server/pvfs/globals.c:
	lwio/server/pvfs/structs.h:
		Defer background thread dispatch of reads and writes to
		PvfsRead() and PvfsWrite().  Previously, a background thread
		was used for all read and write processing.  Some request
		types, such as the setup command for zero-copy I/O,
		performs limited work and will never block.  Performing
		this directly in the calling threads context removes
		significant latency and overhead.
	
		Rename PVFS's old thread pool to AnyThreadPool and allocate
		an array of single threaded AffinityThreadPools.
	
	lwio/server/pvfs/irpctx.c:
	lwio/server/pvfs/locking.c:
	lwio/server/pvfs/notify.c:
	lwio/server/pvfs/oplock.c:
	lwio/server/pvfs/scb.c:
		Use any thread for lease/oplock breaks directory update
		notifications and other house cleaning items.
	
	lwio/server/pvfs/structs.h:
	lwio/server/pvfs/read.c:
	lwio/server/pvfs/write.c:
		Restructure PvfsRead() and PvfsWrite() so that background
		thread processing is only invoked on operations that may
		block.
	
		Assign and use the thread pool of an affinity group when
		performing background processing.

Change 1048927 on 2014/03/15 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1044619 on 2014/02/26 by justing@justing_ns1_likewise
	==============
	Fix the format of SMB2 v1 lease break notifications.
	
	lwio/server/srv/protocols/smb2/oplock.c:
		In SrvBuildLeaseBreakNotification_SMB_V2(), initialize
		the Reserved field in the lease break header to 0.  This
		is the only field in the header that was not already
		initialized.
	
	Change 1044622 on 2014/02/26 by justing@justing_ns1_likewise
	==============
	Conform to Likewise style.  No functional changes.
	
	lwio/server/srv/elements/srvtree2.c:
	lwio/server/srv/protocols/smb2/wire.c:
		Remove excess whitespace before nested '(' in if and while
		blocks.
	
	Change 1048916 on 2014/03/15 by justing@justing_ns1_likewise
	==============
	Improve runtime verification of lease behavior.
	
	lwio/server/pvfs/lease.c:
		PvfsLeaseGrant*(), the code assumes that at most a
		single lease will be found on the SCB's oplock list.
		Assert that this is the case.
	
	Change 1048918 on 2014/03/15 by justing@justing_ns1_likewise
	==============
	Rather than crash, gracefully terminate any connection where the
	client attempts to exceed its credit allotment.  Dropping the
	connection is the response sanctioned by MS_SMB2 3.3.5.2.3
	"Verifying the Sequence Number".
	
	lwio/server/srv/elements/creditor.c:
		Modify SrvCreditorFindDebitorTail() so that it returns
		an error, rather than abort the program, when insufficient
		resources are found to complete the request.  Pass this
		status through the APIs that call this function.
	
		In SrvCreditorAdjustAsyncCredits(), only update the
		client's credit "last credits granted" value for interim
		responses.  The final response after an interim response
		never grants credit as the credit has already been granted,
		but this protocol detail should impact future credit
		allocations.
	
	lwio/server/srv/protocols/smb2/libmain.c:
		In SrvProcessRequestSpecific_SMB_V2(), treat credit
		exceedance as a connection terminating event.
	
	Change 1048919 on 2014/03/15 by justing@justing_ns1_likewise
	==============
	Improve comments.  No functional changes.
	
	lwio/server/srv/protocols/smb2/negotiate.c:
		Add inline comments for the argument names next to
		integer constants passed to SrvCreditorAdjustCredits().
		This is makes it easier to review the code.
	
	Change 1048922 on 2014/03/15 by justing@justing_ns1_likewise
	==============
	Correct potential double credit grant, where the client is
	returned credit in a final response that was already granted
	in an interim response.
	
	lwio/server/srv/protocols/smb2/error.c:
		In SrvBuildErrorResponse_SMB_V2(), always call
		SrvCreditorAdjustCredits() regardless of the state of
		pExecContext->usCreditsGranted.  The value there, if set,
		is mostly likely from an interim response and represents
		credit that has already been communicated to the client.
	
		The motivation for the original code seem to be the
		improbable case that an error occured while building the
		response packet that prevented the allocated credit
		from ever being sent.  If this happens now, this credit
		will be lost.  A future change to the credit system will
		make it possible to detect this condition and reclaim
		the lost credit.
	
	Change 1048923 on 2014/03/15 by justing@justing_ns1_likewise
	==============
	Correct potential credit leak where credit allocated to a client
	is never provided in a response.
	
	lwio/server/srv/protocols/smb2/getquotainfo.c:
		In SrvBuildQuotaInfoResponse_SMB_V2(), use the acutal number
		of credits granted by SrvCreditorAdjustCredits(), rather
		than the value the client requested, in the response.
	
	Change 1048925 on 2014/03/15 by justing@justing_ns1_likewise
	==============
	Simplify code.  No functional changes intended.
	
	lwio/server/srv/protocols/smb2/lock.c:
		In SrvBuildLockResponse_SMB_V2(), rely on the interim response
		tracking the global execution context instead of command
		specific state.  This brings the credit allocation code
		used here in line with all other commands.

Change 1042231 on 2014/02/18 by justing@justing_ns1_likewise

	Merge from //likewise/main to /likewise/r1:
	
	Change 1041934 on 2014/02/17 by justing@justing_ns1_likewise
	==============
	Fix assertion failure in Likewise.
	
	lwio/server/srv/elements/srvsession2.c:
		In SrvSession2TableShutdown(), do not assert that the table
		is empty.  Likewise's shutdown processing stops all work
		processing, but does not cleanup all connections, sessions,
		or tree connects before tearing down data structures.  The
		expectation is that the "destructor" for the object (e.g.
		SrvSession2TableShutdown()) will cleanup anything it finds.
	
	Change 1041955 on 2014/02/17 by robg@robg.ns1.likewise
	==============
	Remove unused variable declaration.

Change 1035416 on 2014/01/25 by justing@justing_ns1_likewise

	Merge from //likewise/main -> //likewise/r1:
	
	Change 1035415 on 2014/01/25 by justing@justing_ns1_likewise
	==============
	Generate system wide unique, rather than per-connection
	unique, session UIDs for SMB2 connections.  This ensures
	compatibility with SMB3 capable clients that enforce this
	SMB3 requirement even on SMB2 connections (e.g. Windows
	Server 2012).
	
	TeamTrack: 28511 (Complete)
	
	lwio/server/srv/elements/libmain.c:
	lwio/server/srv/elements/structs.h:
	lwio/server/srv/include/elementsapi.h:
	lwio/server/srv/elements/srvsession2.c:
		Instantiate a global hash table of SMB2 session objects,
		hashed by the 64bit session UID.
	
	lwio/server/srv/elements/srvconnection.c:
		Delegate generation of SMB2 session object's UID to the
		SMB2 session code.
	
	lwio/server/srv/elements/srvsession2.c:
		When creating an SMB2 session, generate a random,
		non-conflicting, UID, and insert the session into the
		global session table.  This allows collision detection
		when creating future sessions.
	
		When freeing a session, remove it from the global hash
		table.
	
		The existing mechanism of keeping a connection local
		Red-Black tree of sessions is retained.  A connection
		local container is required anyway for RPC calls that
		allow sessions to be enumerated on a per-connection basis.
		This also avoids contending on a single global mutex
		during the per-packet operation of having to convert a
		session UID to a session object.

Change 1033532 on 2014/01/17 by daveb@daveb.p4work.shared.likwise.platform.pure

	P2_28658: likewise not handling Korean characters. 
	merge 1033530 to r1.x
	
	Our SpectraBSD environment is running under the "C"/"POSIX" locale;
	LC_TYPE=POSIX does not support 8 bit characters. Therefore, when
	attemptig to translate a Korean character encoded in UTF-16 into
	a file name iconv(3), operating under LC_TYPE=POSIX, rejects the
	first character with bit 7 set.
	
	The fix is to ensure that likewise gets started under a *UTF-8
	locale.
	
	//likewise/main/config/lwsmd:
	Added code to this lwsmd startup script to ensure that LC_ALL is set
	to a UTF-8 value; if one is not configured or located via the old
	logic then default to en_US.UTF-8.

Change 1033511 on 2014/01/17 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1033494 on 2014/01/17 by justing@justing_ns1_likewise
	==============
	Fix style bug.  No functional changes.
	
	lsass/server/auth-providers/ad-open-provider/lsadm.c:
		Place the static keyword for function declarations and
		definitions on its own line.
	
	Change 1033504 on 2014/01/17 by justing@justing_ns1_likewise
	==============
	Change function and structure names to match existing idiom.
	No functional changes.
	
	lsass/server/auth-providers/ad-open-provider/provider-main.c:
		Modify the AD_AuthenticateUserEx state machine to use
		a "Context", not a "CallbackContext".  This avoids confusion
		with the lsadm wrapper code which uses the "CallbackContext"
		term for routines that allow the generic domain connect
		code to perform caller specific actions that are not
		necessarily completed asynchronously.
	
	Change 1033506 on 2014/01/17 by justing@justing_ns1_likewise
	==============
	Conform to existing idiom for memory free functions.  No functional
	changes intended.
	
	lsass/server/auth-providers/ad-open-provider/lsadmwrap.c:
		Modify LsaDmWrapAuthenicateUserExFreeContext() to take
		a pointer to a pointer of the memory being freed so
		that the clients pointer can be explicitly set to NULL.
	
	Change 1033509 on 2014/01/17 by justing@justing_ns1_likewise
	==============
	Fix segmentation violation in error path when the AD server
	we are connected to goes offline.
	
	lsass/server/auth-providers/ad-open-provider/lsadm.c:
		When processing the LsaDmConnectDomain state machine,
		only call the asynchronous completion routine if we are
		completing asynchronously.  Otherwise the caller will
		perform cleanup actions twice, leading to a segfault.
		This state machine now follows the same idiom as all
		the others, where the AsyncComplete() wrapper function
		is responsible for performing the async callback to
		the caller, not the main state machine function.
	
	lsass/server/auth-providers/ad-open-provider/lsadm.h:
		Remove the no longer used LSA_DM_CONNECT_STAGE_COMPLETE
		stage definition.

Change 1031619 on 2014/01/14 by justing@justing_ns1_likewise

	Merge from //likewise/main to //likewise/r1:
	
	Change 1031617 on 2014/01/14 by justing@justing_ns1_likewise
	==============
	Correct lsass segfault when attempting to connect to an AD domain
	that fails DNS resolution.
	
	lsass/server/auth-providers/ad-open-provider/provider-main.c:
		In AD_AuthenticateUserEx(), handle a failed allocation of
		the context object for the operation.  This can occur due
		to memory ehaustion or a failure to obtain a handle to the
		AD server context because the AD domain specified doesn't
		exist or fails to resolve in DNS.

Change 1031468 on 2014/01/13 by justing@justing_ns1_likewise

	Merge from //likewise/main/... to //likewise/r1/...:
	
	Change 1026117 by justing@justing_ns1_likewise on 2013/12/13 11:19:27
	==============
	lsass/server/auth-providers/ad-open-provider/lsadm.c:
		Tabs -> spaces on one line to match prevailing style.
	
		No functional changes.
	
	Change 1026118 by justing@justing_ns1_likewise on 2013/12/13 11:21:05
	==============
	netlogon/server/api/dcinfo.c:
		Use "%#X" instead of just "%X" so it is obvious that the
		printed value is formatted as hex.
	
	Change 1027902 by justing@justing_ns1_likewise on 2013/12/21 13:52:31
	==============
	Silence bison errors during the Likewise build.
	
	dcerpc/dceflex/parse.y:
		Implement the CCL_EXPR() macro using the standard
		"do {} while(0)" C idiom and terminate all invocations
		with a semi-colon.
	
		The old implementation used naked curly braces and
		was called without a terminating semi-colon.  While
		this did generate correct code, Bison treats the
		missing semi-colon as an error, inserts a semi-colon,
		and warns that the semi-colon insertion feature is
		non-standard and deprecated.
	
	Change 1029668 by justing@justing_ns1_likewise on 2013/12/30 15:17:16
	==============
	git-build/README:
		Add information about the "stuck timeout" timer that
		kills services that fail to initialize within a reasonable
		time period.  Bumping this setting is often required when
		debugging certain Likewise issues in early startup.
	
	Change 1029678 by justing@justing_ns1_likewise on 2013/12/30 15:30:36
	==============
	lsass/include/lsautils.h:
	lsass/server/api/api2.c:
	lsass/server/api/artefacts.c:
	lsass/server/api/auth.c:
	lsass/server/api/session.c:
		Simplify usage of LSA_TRACE_BEGIN/END_FUNCTION()
		macros by using the LW_ARRAY_SIZE macro and moving
		the array size calculation to within the macros.
	
	Change 1029876 by justing@justing_ns1_likewise on 2013/12/31 10:12:51
	==============
	Normalize to Likewise style.  No functional changes intended.
	
	lsass/server/api/auth.c:
	lsass/server/auth-providers/ad-open-provider/adnetapi.c:
	lsass/server/auth-providers/ad-open-provider/lsadm.c:
	lsass/server/auth-providers/ad-open-provider/lsadmwrap.c:
	lsass/server/auth-providers/ad-open-provider/provider-main.c:
	lsass/server/ntlm/acceptsecctxt.c:
	lsass/server/ntlm/ipc_dispatch.c:
		- Fit to 80 columns where possible without code restructuring.
		- Remove superfluous casts: Assigning NULL to any pointer type
		  without cast is allowed by C.
		- Line continuations for functions or macros start on the
		  4 space tab stop at least 4 spaces past the first character
		  of the function name.
		- Braces are column aligned and on their own lines.
		- Case labels for switch statements are intended one tab
		  stop from the "switch".
		- Remove extra spaces after '(' and before ')'.
		- Remove superfluous backslashes escaping newlines for
		  multi-line string constants where each line is individually
		  quoted.
	
	Change 1031073 by justing@justing_ns1_likewise on 2014/01/08 16:14:19
	==============
	Correct stdarg usage in the Likewise logging code.
	
	lwsm/server/logger.c:
		In LwSmLogPrintfv, remove spurious call to va_end().
		va_start() and va_end() are the responsibility of
		the callers of this function.
	
	Change 1031147 by justing@justing_ns1_likewise on 2014/01/09 12:40:00
	==============
	Style fix.  No functional changes.
	
	lwio/server/rdr/write2.c:
		Remove spurious extra blank line.
	
	Change 1031171 by justing@justing_ns1_likewise on 2014/01/09 14:09:35
	==============
	Correct SMB2 credit accounting in the RDR driver to avoid
	leaking credit and thereby hang an RDR connection due to
	credit exhaustion.  The RDR driver is a party to all Active
	Directory communication, so this defect had the effect of
	hanging Active Directory operations until the AD server
	timed out the connection.
	
	TeamTrack: 27958 (Partial)
	
	lwio/server/rdr/structs.h:
		- Use "Credit" rather than "Slot" in credit related variable
		  names.
		- Simplify credit calculations by combining "Used" and
		  "Max" into a single variable "Available" which tracks
		  how much credit we currently have regardless of the
		  amount of credit previously consumed.
	
	lwio/server/rdr/structs.h:
	lwio/server/rdr/socket.c:
		- Track the number of entries in the RDR socket's
		  PendingSend and PendingResponse queues.  This allows
		  the removal of an O(n) loop in RdrSocketCreditsNeeded().
	
	lwio/server/rdr/socket.c:
		- Now that a count must be coherently maintained for the
		  queues, refactor the access code for them so the counts
		  and lists can never be out of synch.
		- Simplify the calculation of the credits to request in
		  the next outgoing packet.  The request should ask for
		  the maximum of enough to handle the current backlog, or
		  sufficient credit to return to the configured minimum
		  reserve.  Additionally, return excess credit (e.g. due
		  to a past burst of activity) when it is no longer needed.
	
	lwio/server/rdr/connect.c:
	lwio/server/rdr/socket.c:
		- Adjust to variable name changes.
	
	Change 1031243 by justing@justing_ns1_likewise on 2014/01/10 12:31:21
	==============
	Refactor common code used to record login events.
	
	Record all login attempts even if these are multiple providers
	in order to handle a request.
	
	lsass/server/api/event_p.h:
	lsass/server/api/event.c:
		Implement LsaSrvWriteLoginEvent() as a replacement for
		LsaSrvWriteLogin(Success/Failed) event.  The old APIs
		are now static and called by LsaSrvWriteLoginEvent().
	
	lsass/server/api/event.c:
		In LsaSrvWriteLoginFailedEvent(), treat LW_ERROR_NOT_HANDLED
		the same as LW_ERROR_NO_SUCH_USER.  Providers return this
		when the caller should try another provider - for example
		if the provider isn't currently active or configured.
	
	lsass/server/api/auth.c:
	lsass/server/api/event.c:
	lsass/server/api/session.c:
		Log all login attempts even to providers that report they
		aren't configured or have a record for a user.
	
		Simplify provider search logic now that we log always and
		the logic for determining the correct log function is
		embedded in LsaSrvWriteLoginEvent().
	
	Change 1031252 by justing@justing_ns1_likewise on 2014/01/10 13:25:54
	==============
	Refactor Lsa authentication code.
	
	lsass/server/api/auth.c:
		In LsaSrvAuthenticateUserEx(), split plain text and
		Chap authentication into separate routines:
		LsaSrvAuthenticateUserExPlainText() and
		LsaSrvAuthenticateUserExChap().
	
		In LsaSrvAuthenticateUserExPlainText() use
		LwAllocateStringPrintf() instead of hand rolled version.
	
	Change 1031424 by justing@justing_ns1_likewise on 2014/01/13 14:12:48
	==============
	Refactor common authentication reporting code.
	
	lsass/server/api/auth.c:
		Pull PAM and NTLM/Chap authentication reporting into
		a new routine LsaSrvAutheticateRecordResults.
	
	lsass/server/api/metrics_p.h:
	lsass/server/api/auth.c:
	lsass/server/api/session.c:
		Introduce LSA_SRV_INCREMENT_SUCCESS_FAIL_METRICS()
		and use it to factor away duplicated code.
	
	Change 1031428 by justing@justing_ns1_likewise on 2014/01/13 14:19:29
	==============
	Style fix.  No functional changes.
	
	lsass/server/api/auth.c:
		Fix leading whitespace on previous change.
	
	Change 1031450 by justing@justing_ns1_likewise on 2014/01/13 16:38:30
	==============
	Treat incoming IPC request messages for the accept security context
	API as const.
	
	lsass/server/ntlm/acceptsecctxt.c:
		Mail API const correctness.
	
	lsass/server/ntlm/context.c:
	lsass/server/ntlm/prototypes.h:
		Const correctness for APIs invoked on the incoming request
		structure.
	
	Change 1031459 by justing@justing_ns1_likewise on 2014/01/13 17:51:13
	==============
	Remove unecessary mutex acquire and release.
	
	lsass/server/api/config.c:
		In LsaSrvEventlogEnabled(), return the global boolean
		that controls logging behavior without any lock protection.
		The boolean is either true or false even if accessed
		concurrently by multiple threads.  Since the lock was
		not held past reading the boolean, it didn't prevent the
		value from changing between being read and the logging
		action taking place.
	
	Change 1031467 by justing@justing_ns1_likewise on 2014/01/13 20:48:12
	==============
	Lsass will deadlock when negotiating a new secure channel
	to the Active Directory server at a time when all threads
	in the lsas IPC pool are already consumed with a backlog
	of accept security context requests.  Secure channel
	operations go through lwio's RDR service and setup of the
	connection requires an IPC call to lsass in order to complete.
	The accept security context operations are waiting for a
	secure channel, but the secure channel setup is waiting for
	an IPC call into lsass to be serviced by a thread that will
	never become available.
	
	Convert accept security context processing to a series of
	asynchronous state machines so that at most one thread in
	the lsass IPC thread pool will be blocked waiting for a
	secure channel operation to complete.
	
	TeamTrack: 27958 (Complete)
	
	lsass/include/lsa/lsa.h:
		Add LSA types for an "async control block", "status
		block", and "completion callback".  These types and
		the code used to implement the state machines follows
		the same async idioms used in lwio:
	
		AsyncControlBlock: function pointer + argument that
				   is passed into functions supporting
				   asynchronous operations.
	
		StatusBlock:       Passed along with the AsyncControlBlock
				   and contains all of the data necessary
				   for the completion function to interpret
				   the result of the async function called.
				   The callback function must be able to
				   get to the StatusBlock via the callback
				   argument in the AsyncControlBlock.
	
	lsass/include/lsa/provider.h:
		Modify the AuthenticalUserEx API call signature to accept
		an AsyncControlBlock and StatusBlock.
	
	lsass/include/lsaipc.h:
	lsass/include/ntlmipc.h:
	lsass/server/api/ipc_dispatch.c:
	lsass/server/ntlm/ipc_dispatch.c:
		Augment the mapping from LW_ERROR codes to LWMSG_STATUS
		codes for NtlmSrv and LsaIpc APIs.  Treat ERROR_IO_PENDING
		as LWMSG_STATUS_PENDING, indicating that an IPC call will
		complete later.
	
	lsass/server/api/auth.c:
	lsass/server/api/auth_p.h:
		Allow an AsyncControlBlock and StatusBlock to be passed
		to LsaSrvAuthenticateUserEx().
	
		Convert LsaSrvAuthenticateUserExChap() to an asynchronous
		state machine.
	
	lsass/server/api/ipc_dispatch.c:
		Convert LsaSrvIpcAuthenticateUserEx() to allow asynchronous
		operations.
	
	lsass/server/auth-providers/ad-open-provider/adnetapi.c:
	lsass/server/auth-providers/ad-open-provider/adnetapi.h:
		Perform all schannel operations via WorkItems.  Execute
		the WorkItems via a private thread pool with a single
		thread instance.  Note that all operations were single
		threaded before, the old code using a pthread_mutex
		to serialize operations.
	
		Convert all interfaces that operate on schannels to be
		asynchronous since all operations are now queued.
	
	lsass/server/auth-providers/ad-open-provider/lsadm.c:
	lsass/server/auth-providers/ad-open-provider/lsadm.h:
	lsass/server/auth-providers/ad-open-provider/lsadmwrap.c:
	lsass/server/auth-providers/ad-open-provider/lsadmwrap.h:
	lsass/server/auth-providers/ad-open-provider/provider-main.c:
	lsass/server/auth-providers/ad-open-provider/provider-main.h:
	lsass/server/include/lsasrvapi.h:
		Modify the lsa domain connect APIs to allow asynchronous
		operations.  Only LsaDmWrapAuthenticateUserExCallback()
		currently takes advantage of the async capabilities, but
		the same treatment could be applied to the other call
		types if necessary.
	
	lsass/server/auth-providers/local-provider/lpmain.c:
	lsass/server/auth-providers/local-provider/lpmain.h:
		Update the local authentication provier to the new APIs.
		The local provider is currently synchronous.
	
	lsass/server/ntlm/acceptsecctxt.c:
	lsass/server/ntlm/context.c:
	lsass/server/ntlm/ipc_dispatch.c:
	lsass/server/ntlm/prototypes.h:
	lsass/server/ntlm/structs.h:
		Convert NtlmSrvIpcAcceptSecurityContext() to an
		asynchronous state machine.

Change 1027613 on 2013/12/20 by keitho@keitho.ns1.likewise.r1

	Adding dump function to the likewise rc.d script.
	
	//likewise/r1/config/MakeKitBuild - Added likewise_diagnostics.sh
	  script to the make function.
	
	//likewise/r1/config/init-likewise.sh - Added the dump option
	  to the script.
	
	//likewise/r1/config/likewise_diagnostics.sh - Added the dump
	  script.  The script extracts the likewise stack traces, and
	  core dumps the likewise processes (upon user confirmation) and
	  tars them up, so the customer can FTP them to Spectra.
	
	Note: This CL is associate with 1027612 and 1027614

Change 1025980 on 2013/12/12 by daveb@daveb.p4work.shared.likwise.platform.pure

	Merge @1025946 to likewise/r1
	
	Suppress false "(symbol: ERROR_FILE_NOT_FOUND)" error messages.
	This message is generated four times for each cifs mount.
	
	Under normal verbosity levels the complete error message is:
	lsass: [lsass] Win32 Error code: 2 (symbol: ERROR_FILE_NOT_FOUND)
	
	The message is generated when callers of SamDbFindObjectRecord()
	misinterpret the ERROR_FILE_NOT_FOUND return status as an error.
	SamDbFindObjectRecord() returns ERROR_FILE_NOT_FOUND when the 
	sqlite3 query fails to find a matching row. Depending on the caller,
	this may or may not be an error.
	
	The SamDbQueryMembership() caller of SamDbFindObjectRecord() was 
	logging all non-zero return values as an error; in this path failure 
	to find a matching row is not a true error.
	
	To suppress the error message a new BAIL_ON_SAMDB_ERROR macro was 
	defined. BAIL_ON_SAMDB_ERROR_QUIET() takes a condition. If the condition
	is true then a message is logged at the INFO level otherwise a message
	is logged at the ERROR level. At normal verbosity levels, this 
	suppresses the ERROR_FILE_NOT_FOUND message.

Change 1024379 on 2013/12/05 by daveb@daveb.p4work.shared.likwise.platform.pure

	P3_28382: Dead Lock in likewise error path (merge from main @1024357)
	
	When SMB V2 read and write call SrvProtocolTransportSendZctResponse(), 
	SrvProtocolTransportReceiveZct(), or 
	SrvProtocolTransportResumeFromZct(), the operation's async state lock 
	is held. The error path in each of these functions will initiate a 
	"protocol rundown" which will execute async call back functions that 
	acquire the async state lock resulting in a deadlock.
	
	Similar paths in the SMB V1 also hold their async locks while calling 
	the aforementioned functions, but the SMB V1 async state 
	does not include the offending callback function; therefore SMB V1
	read and write do not experience the deadlock.
	
	Defined a new protocol rundown initiator named
	SrvConnectionSetInvalidAsync_inlock() that first removes the initiating
	thread's async state from the connection's "async collection" 
	(pConnection->pAsyncStateCollection). With the async state removed, 
	the rundown code will not locate the initiating thread's callback 
	functions and the deadlock is avoided.
	
	Replaced SrvConnectionSetInvalid() in aforementioned functions with the
	new SrvConnectionSetInvalidAsync_inlock().
	
	Modified aforementioned functions to take the AsyncID of the initiating
	operation which is passed through to 
	srvConnectionSetInvalidAsync_inlock().

Change 1021736 on 2013/11/21 by justing@justing_ns1_likewise

	Merge from //likewise/main/... to //likewise/r1/...
	
	Change 1020250 by daveb@daveb.p4work.shared.likwise.platform.pure on 2013/11/15 12:40:50
	==============
	Do not start likewsise from the postinstall script.
	Likewise will be started by node worker / nas_resource.
	See change 1019581.
	
	Change 1021565 by justing@justing_ns1_likewise on 2013/11/21 09:52:08
	==============
	lwio/server/srv/protocols/smb2/wire.c:
		Initialize the single byte appended to error responses
		that have no real data.  This silences warnings in
		wireshark about invalid SMB responses.
	
	Change 1021567 by justing@justing_ns1_likewise on 2013/11/21 09:53:30
	==============
	lwio/server/pvfs/create.c
	lwio/server/pvfs/fcb.c:
		Correct typos in comments.
	
		No functional changes.
	
	Change 1021569 by justing@justing_ns1_likewise on 2013/11/21 09:55:59
	==============
	lwio/server/pvfs/notify.c:
		Correct a comment.
	
		No functional changes.
	
	Change 1021571 by justing@justing_ns1_likewise on 2013/11/21 09:58:55
	==============
	lwio/server/pvfs/notify.c:
		Correct typo in comment.  No functional changes.
	
	Change 1021574 by justing@justing_ns1_likewise on 2013/11/21 10:01:56
	==============
	lwio/server/pvfs/notify.c:
		Align notification entries on 4 byte boundaries instead
		of 8.  4 is all that is required according to the spec,
		and aligning more just wastes space in the client's
		notify buffer.
	
	Change 1021593 by justing@justing_ns1_likewise on 2013/11/21 10:55:22
	==============
	Remove unnecessary notify response data marshalling at the
	smb1 and smb2 layers.
	
	lwio/server/srv/protocols/smb1/nttransact.c:
	lwio/server/srv/protocols/smb2/notify_request.c:
		Remove SrvMarshalChangeNotifyReponse(_SMB_V2) and
		all the work they did to reformat notify response
		data that is already properly formatted for
		transmission to the client.
	
		Issue standard error responses for both STATUS_CANCELLED
		and STATUS_NOTIFY_ENUM_DIR responses for IRPs
		returned from the file system drivers.  Neither
		transmit any file notification data to the client
		and this removes the need for the STATUS_SUCCESS
		code path to consider incoming errors.
	
	Change 1021707 by justing@justing_ns1_likewise on 2013/11/21 16:07:50
	==============
	lwio/server/pvfs/create.c:
		Fix typo in comment.
	
	Change 1021708 by justing@justing_ns1_likewise on 2013/11/21 16:08:27
	==============
	lwio/server/iomgr/iofile.c:
		Fix typo in comment.
	
	Change 1021734 by justing@justing_ns1_likewise on 2013/11/21 21:47:18
	==============
	Do not issue spurious events during file or directory creation.
	
	lwio/server/pvfs/acl.c:
	lwio/server/pvfs/attrib.c:
		Modify functions that emit file/directory modified
		events that are also called during creation processing
		to record these events in the CCB and to only issue them
		if the CCB's "creation completed" flag is not set.
	
	lwio/server/pvfs/create.c:
		When creation processing is complete, issue any recorded
		modifications as a single notification event.  If the
		file or diretory was added, replace any recorded events
		with a single "added" event.
	
	Change 1021735 by justing@justing_ns1_likewise on 2013/11/21 21:53:35
	==============
	Improve spec compliance of generated notify events.
	
	lwio/server/pvfs/notify.c:
		Refactory notification record creation to a single
		routine, PvfsNotifyFormatNotifyInfo().
	
		Do not assume that an FCB's file name is correct.  The
		file name is not currently updated during rename.  Guard
		against stale file names and only trim the prefix on 
		notify events when the file name of the directory
		receiving events is a prefix of the object generating
		the event.
	
		Fix setting of the FileNameLength field.  It is the
		number of bytes in the WCHAR filename without the NUL.
	
		Notify records do not require the NUL on filenames, so
		don't include it (just like Windows).  This saves space
		in the user's notification buffer.
	
		Initialize pad bytes to 0.

Change 1020543 on 2013/11/17 by justing@justing_ns1_likewise

	Merge from //likewise/main/... to //likewise/r1/...
	
	Change 1020540 by justing@justing_ns1_likewise on 2013/11/17 07:44:20
	==============
	lwio/server/pvfs/notify.c:
		Correct typo that snuck in to the last commit.

Change 1020341 on 2013/11/15 by justing@justing_ns1_likewise

	Merge from //likewise/main/... to //likewise/r1/...
	
	Change 1020335 by justing@justing_ns1_likewise on 2013/11/15 17:00:49
	==============
	lwio/server/pvfs/fileIdBothDirInfo.c:
		Correct a typo in a comment.
	
	Change 1020337 by justing@justing_ns1_likewise on 2013/11/15 17:01:49
	==============
	lwio/server/srv/protocols/smb2/tree.c:
		Fix style bug.
	
		No functional changes.
	
	Change 1020338 by justing@justing_ns1_likewise on 2013/11/15 17:05:55
	==============
	Correct SMB file notification records to use relative paths.
	
	lwio/server/pvfs/notify.c:
		In PvfsNotifyReportIrp() and PvfsNotifyReportBuffer(),
		pass in the Fcb for the directory whose filter has triggered.
		Use this Fcb's path as the prefix to strip from entries added
		to the notification report.
	
	Change 1020339 by justing@justing_ns1_likewise on 2013/11/15 17:08:40
	==============
	Allow large notification buffers to be returned for notify requests.
	
	lwio/server/srv/protocols/smb2/notify_state.c:
		When rebuilding the execution state for a completing IRP
		request in SrvNotifyBuildExecContext_SMB_V2(), restore
		the maximum buffer size setting that came from the
		original request.  This ensures there is sufficient
		buffer space to handle the notification records from
		the completing IRP.

Change 1020037 on 2013/11/14 by justing@justing_ns1_likewise

	Merge from //likewise/main/... into //likewise/r1/...
	
	Change 1016152 by justing@justing_ns1_likewise on 2013/10/31 10:06:24
	==============
	Fix printing of status when starting Likewise's lwsmd
	via rc.d script.
	
	config/init-base.sh:
		In status_failed(), add missing FREEBSD in case
		statement.
	
		In this script's "main", invoke print_status when
		running on FreeBSD, where most of main's functionality
		is delegated to FreeBSD's rc.d subsystem.
	
	Change 1017806 by justing@justing_ns1_likewise on 2013/11/05 13:19:54
	==============
	config/init-likewise.sh:
		Remove extra space in init script output so that it
		matches the convension used in lwsmd startup.
	
	Change 1019289 by daveb@daveb.p4work.shared.likwise.platform.pure on 2013/11/12 09:53:34
	==============
	Cleanup print_status logic
	
	Change 1019955 by justing@justing_ns1_likewise on 2013/11/14 15:21:40
	==============
	Remove private and unused copy of sqlite from Likewise.
	
	Change 1019958 by justing@justing_ns1_likewise on 2013/11/14 15:36:51
	==============
	Plug memory leak in Likewise.
	
	lwio/server/pvfs/fcb.c:
		When freeing a file control block, also destroy the
		mutext used to protect file change notification information.
	
	Change 1019963 by justing@justing_ns1_likewise on 2013/11/14 15:41:56
	==============
	Initialize data that was previously referenced without
	initialization.
	
	Found by: valgrind
	
	lwmsg/src/peer-task.c:
	lwmsg/src/connection-wire.c:
		When binding to a unix domain socket, initialize the
		sun_len field of struct sockaddr_un.
	
	lwio/server/srv/protocols/smb2/negotiate.c:
		Initialize pad bytes in the SMB2 negotiate response
		packet to 0.
	
	Change 1019966 by justing@justing_ns1_likewise on 2013/11/14 15:46:25
	==============
	Plug memory leak in Likewise.
	
	Found by: valgrind
	
	lwmsg/src/peer-session.c:
		pthread mutexattr objects can be destroyed as soon as
		the mutex creation operations using the attr object are
		complete.  In lwmsg_peer_session_new(), move the call
		to pthread_mutexattr_destroy() so that it is called
		anytime an attribute is created, not just when this
		routine experiences an error.
	
	Change 1019967 by justing@justing_ns1_likewise on 2013/11/14 15:47:27
	==============
	lwio/server/pvfs/syswrap.c:
		Correct a style bug.
	
		No functional changes.
	
	Change 1019984 by justing@justing_ns1_likewise on 2013/11/14 16:12:51
	==============
	Plug memory leak in Likewise.
	
	Found by: valgrind
	
	lwio/server/srv/protocols/smb2/notify_request.c:
		pthread_mutex_destroy() notify request state's mutex.
	
	Change 1019988 by justing@justing_ns1_likewise on 2013/11/14 16:18:19
	==============
	Correct protocol violation in responses to notify requests that
	have certain errors.  This is flagged in wireshark, but none of
	the clients I tested seemed to care.
	
	lwio/server/srv/protocols/smb2/notify_request.c:
		When sending an error response to a notify request,
		just return the SMB header.  Sending an empty notify
		response is not allowed by the spec.
	
	Change 1019992 by justing@justing_ns1_likewise on 2013/11/14 16:23:08
	==============
	Fix bug that could cause Likewise to inadvertently close
	file descriptor 0.
	
	lwmsg/src/connection.c:
		In lwmsg_connection_new(), initialize the fd field
		to -1, so that calls to lwmsg_connection_destruct()
		of a partially constructed connection object will
		not close the wrong file descriptor.
	
	Change 1020005 by justing@justing_ns1_likewise on 2013/11/14 16:56:20
	==============
	Improvements to the directory change notification service.
	
	lwio/server/pvfs/notify.c:
		Refactor several methods that used to take multiple
		arguments taken from a ReadDirectoryChange IRP to
		just take the IrpContext and pull them from the IRP.
	
		Fix PvfsNotifyReconfigureFilter() to handle changes
		in the "watch tree" setting.
	
		Add additional state information to logging.
	
		Refactor manual cleanup of IRP context records into
		PvfsFreeIrpRecord().  Using this consistently fixes
		a few cases where the IrpContext was not properly
		released.
	
	Change 1020029 by justing@justing_ns1_likewise on 2013/11/14 20:00:17
	==============
	Remove private and unused copies of libiconv and libuuid.

Change 1019167 on 2013/11/11 by justing@justing_ns1_likewise

	Merge from //likewise/main/... to //likewise/r1/...
	
	Change 1011330 on 2013/10/17 by daveb@daveb.p4work.shared.likwise.platform
	==============
	   Style corrections from last check in
	   lwio/server/pvfs/acl.c: 
	   - space and comment corrections
	
	   lwio/server/pvfs/acl_sd.c: 
	   - use LWIO_LOG_TRACE() directly rather than testing for log level of 
	     LW_RTL_LOG_LEVEL_TRACE and then calling LWIO_LOG_ALWAYS
	
	Change 1012329 on 2013/10/21 by daveb@daveb.p4work.shared.likwise.platform
	==============
	
	   Fix security descriptor 4k limit (P3_28003)
	
	   The SMB_INFO/SMB2_SEC_INFO_00 Security Descriptor (SD) query protocol
	   allows the client to specify a "maximum response size" of zero; the server
	   is expected to respond with a STATUS_BUFFER_TOO_SMALL error message
	   that encodes the size of the queried object's SD list.
	
	   Likewise's response to a SD query with a  "maximum response size" of zero 
	   is to return a hard coded 4k.
	
	   In order to fix this shortcoming, the main SD query function, 
	   SrvExecuteQuerySecurityDescriptor_SMB_V2(), was reworked to recognize a  
	   "maximum response size" of zero as a SD size query as opposed to a SD data 
	   query. When a SD size query is received, an IRP IRP_ARGS_QUERY_SET_SECURITY
	   query is manufactured with a NULL SD buffer and a length of zero.
	
	   Next, reworked the lower level IRP handlers to recognize a NULL SD buffer 
	   and a length of zero as a SD size query. The the lower levels look up the 
	   specified object's SD, calculate the size, save the size in the IRP 
	   request and return STATUS_BUFFER_TOO_SMALL.
	
	   Finally, when IRP processing returns to 
	   SrvExecuteQuerySecurityDescriptor_SMB_V2() with a status of 
	   STATUS_BUFFER_TOO_SMALL the actual size of the queried SD is available. 
	   A STATUS_BUFFER_TOO_SMALL error packet is generated with the correct SD 
	   size. 
	
	   The above fix allows likewise to add 1024 SDs per file ZFS 
	   file/directory. 1024 is the maximum number of SDs that ZFS will 
	   accept (see zfs_freebsd_sidacls_to_aclp()).
	
	Change 1013800 on 2013/10/25 by daveb@daveb.p4work.shared.likwise.platform
	==============
	
	   P3_28046: Joining domain results in error in /var/log/messages
	
	   When joining a domain the incipient LLSA_AD_PROVIDER_STATE may be 
	   initialized as the default domain.  Later when the domain is joined and 
	   AD_SetDefaultState() is executed, the default domain is looked up and 
	   the new LLSA_AD_PROVIDER_STATE is located; the code complains 
	   "lsass: [lsass] Failed to set DVTAD.LOCAL as the default domain.". 
	   Which is not true because all LLSA_AD_PROVIDER_STATE references are 
	   pointing to the same object.
	
	   Fixed the logic in AD_SetDefaultState() to not issue an error when the 
	   looked up default LLSA_AD_PROVIDER_STATE is the same as the new 
	   provider state.
	
	Change 1016189 on 2013/10/31 by justing@justing_ns1_likewise
	==============
	lwio/include/lwioutils.h:
		Rename _LWIO_LOG_AT() to LWIO_LOG_AT() to express that
		it is a sanctioned API for use in logging business logic
		within LWIO.
	
	Change 1016195 on 2013/10/31 by justing@justing_ns1_likewise
	==============
	Improve logging of GSSAPI errors in LWIO.
	
	lsass/interop/gssntlm/gssntlm.c:
		In ntlm_gss_display_status() (the method invoked by
		gss_display_status() when NTLM is the active mechanism),
		perform an error code to error description mapping and
		include this in the result.  Also prepend "NTLM" so it
		is obvious that the error was reported by the NTLM
		mechanism.
	
	lwio/server/srv/elements/srvgss.c:
	lwio/server/srv/elements/srvgss_p.h:
		Update the srv_display_status() APIs to take the oid of
		the mechanism reporting status as well as the current
		logging level.  Use this to avoid invocation of
		gss_display_status() when the result will never be used
		due to the active logging level.
	
		Also indicate in the logging output whether or not the
		status being logged was the result of a successful
		GSSAPI operation (which are printed when at log-level
		verbose or greater) or an error.
	
	Change 1017807 on 2013/11/05 by justing@justing_ns1_likewise
	==============
	lwio/server/pvfs/acl_sd.c:
		Use LWIO_LOG_TRACE() instead of LWIO_LOG_ALWAYS() for
		logging in blocks conditionalized on the logging level.
		Even though the current log level may be high enough
		for logging, sub-component filtering may be active and
		thus prevent the logging from happening.  This filtering
		isn't possible for "LOG_ALWAYS()" logging.
	
	Change 1018117 on 2013/11/06 by justing@justing_ns1_likewise
	==============
	lwio/server/pvfs/macros.h:
		Correct PVFS_PTR_DIFF() macro.  The old macro assumed
		it's inputs were pointers to 1 byte objects.  This is
		true for all current uses in the Likewise code base
		with the exception of the PVFS notify module.  Now
		the macro will always return the difference in bytes
		between its arguments.
	
	Change 1018118 on 2013/11/06 by justing@justing_ns1_likewise
	==============
	lwio/server/pvfs/listq.c:
		Move comment to more appropriate location.
		No functional changes.
	
	Change 1018140 on 2013/11/06 by justing@justing_ns1_likewise
	==============
	Revamp the notification service in the POSIX file system
	module of Likewise.  This corrects several issues with failure
	to report events and a potential for excessive memory usage.
	
	TeamTrack: 28197
	
	lwio/include/lwio/io-types.h:
		In the FILE_NOTIFY_INFORMATION structure, prefer
		the C99 style for declaring a variable length
		terminal array on a struct ("[]").  The old code
		used "[1]" which complicates programmatic use of the
		sizeof() operator to determine the allocation size
		for dynamically allocated versions of the struct.
	
	lwio/server/pvfs/structs.h:
		Add the PVFS_IRP_CONTEXT_RECORD type.  This is used
		to chain contexts for pending notify IRPs on a
		notify filter record for an open file.
	
		Add comments to document the "CCB", "SCB" and "FCB"
		acronyms.
	
	lwio/server/pvfs/structs.h:
	lwio/server/pvfs/fcb.c:
	lwio/server/pvfs/notify.c:
		Add a "NotifyMutex" to the File Stream Control Block
		structure so that notify processing does not interfere
		with the FCB's main locking domain (BaseMutex).
	
		Consolidate IRP and "inter-command notification buffer"
		processing to a single list chained off the FCB.
	
	lwio/server/pvfs/notify.c:
		Modify PVFS_NOTIFY_FILTER_RECORD so that it can track
		a list of pending IRPs instead of just a single one.
	
	lwio/server/pvfs/fcb.c:
	lwio/server/pvfs/notify.c:
	lwio/server/pvfs/pvfs.h:
		Adjust for rename of method from PvfsFreeNotifyRecord()
		to PvfsFreeNotifyFilter().
	
	lwio/server/pvfs/pvfs.h:
		Add NOTIFY_LOG_* macros so that targeted logging of the
		notify module is possible.
	
	lwio/server/pvfs/notify.c:
		Add a long comment block to the top of this file giving some
		details on how it works.  More, per-function, documentation
		is needed.
	
		Modify the scheme used to track notification records.
		In the previous implementation, a filter along with
		an optional notification buffer was allocated for
		each unique open-file-handle/filter-mask tuple.
		This allowed a client to unintentionally create
		additional filters that could be orphaned until
		file close.  Instead, and in better keeping to what
		seems to be the intent of MS-SMB2 3.3.1.3, we now
		queue IRPs on a single filter record for each open
		file handle and process them in FIFO order.  A
		single client can still open a file multiple times
		and get a single unique filter for each, but it
		cannot now create 2^32 filters on a single open
		file handle.
	
		Correct several issues that caused the failure to
		provide notification events to clients.  The two
		major ones were dropping lock protection during
		portions of event processing which allowed events
		to be missed, and a bug in how notify records were
		added to the notification buffer that corrupted the
		entire event buffer any time more than one event
		was seen between reception of the client's IRP.
	
		Add trace and debug logging for all notification processing.
	
		Restructure code to minimize lock hold duration.
	
	Change 1018641 on 2013/11/08 by justing@justing_ns1_likewise
	==============
	lwsm/client/main.c:
		In LogTapper(), close the log fifo on termination of
		the tapper thread.  This prevents the other end from
		blocking until the exit of main().
	
	Change 1018643 on 2013/11/08 by justing@justing_ns1_likewise
	==============
	Set the DOS Archive bit whenever any portion of a file changes,
	not just after appending writes.
	
	lwio/server/pvfs/structs.h: 
		Add a new create contest flag PVFS_CCB_FLAG_CLOSE_SET_ARCHIVE.
	
	lwio/server/pvfs/fileEndOfFileInfo.c:                         
	lwio/server/pvfs/write.c:
		Set PVFS_CCB_FLAG_CLOSE_SET_ARCHIVE when a file is modified.
	
	lwio/server/pvfs/close.c:                             
		Rely on PVFS_CCB_FLAG_CLOSE_SET_ARCHIVE instead of
		pending event notification flags to determine whether or
		not to set the archive bit on a file.  The pending
		event notification flags should be cleared once reported,
		which may occur prior to close.
	
	Change 1018644 on 2013/11/08 by justing@justing_ns1_likewise
	==============
	lwio/server/pvfs/close.c:
	lwio/server/pvfs/notify.c:
		Miscellaneous style fixes to match prevailing style.
	
		No functional changes.
	
	Change 1018645 on 2013/11/08 by justing@justing_ns1_likewise
	==============
	Eliminate spurious, duplicate, event notifications on close
	of a file that has been written.
	
	lwio/server/pvfs/write.c:
	lwio/server/pvfs/close.c:
		Clear the ChangeEvent field of the CCB once it has
		been reported.  This prevents close from issuing a
		duplicate notification.  The clear in close.c has no
		effect, but is done to match the idiom used in write.c.
	
	Change 1018646 on 2013/11/08 by justing@justing_ns1_likewise
	==============
	Fix potential resource leak: delete the notify change buffer,
	if present, when a file handle is closed.
	
	TeamTrack: 28197                                                        
	
	lwio/server/pvfs/structs.h:                                
		Move data structure definitions for notify support above
		the definition of PVFS_CCB.
	
		Add a backlink to the active change filter for a CCB
		to the PVFS_CCB structure.
	
	       lwio/server/pvfs/ccb.c:            
		Initialice the ccb's filter backlink to NULL.
	
	       lwio/server/pvfs/pvfs.h:                      
		Declare PvfsNotifyRemoveFilter().
	
	       lwio/server/pvfs/close.c:
		Invoke PvfsNotifyRemoveFilter() on close if a ccb
		has a filter.
	
	       lwio/server/pvfs/notify.c:
		Set and clear the ccb filter backlink at the beginning
		and end of a filter's lifetime.
	
		Implement PvfsNotifyRemoveFilter().

Change 1011051 on 2013/10/16 by justing@justing_ns1_likewise

	Merge from //likewise/main into //likewise/r1:
	
	Change 1011050 by justing@justing_ns1_likewise on 2013/10/16 18:34:39
	==============
	Correct "lwsm tap-log" deadlock, that could cause Likewise
	       to hang when exiting a diagnostic log session. [PART 2]
	
	lwsm/client/main.c:
		In LwSmCmdTapLog() take care to not deadlock when
		initiating the tap.  Issue only a single command
		the the target, the one directing it to use the
		FIFO for logging, prior to firing off the background
		task that services the FIFO.  This satisfies
		LogTapper's requirement to have a writer attached
		to the FIFO, but starts FIFO processing before we
		turn up the log level.
	
		In LogTapper(), don't process the FIFO during
		LW_TASK_EVENT_INIT events.  This can cause us to
		spuriously read the FIFO, see 0 bytes available,
		and interpret this as EOF.
	
		Use C style block comments in this file as this
		seems to be its prevailing style.

Change 1010737 on 2013/10/15 by justing@justing_ns1_likewise

	Merge from //likewise/main into //likewise/r1.
	
	Change 1010735 by justing@justing_ns1_likewise on 2013/10/15 19:38:29
	==============
	Correct "lwsm tap-log" deadlock, that could cause Likewise
	to hang when exiting a diagnostic log session.
	
	lwbase/src/threadpool-common.c:
		In LwRtlExitMain(), only send SIGINT to our process
		the first time an Exit is requested.  This avoids
		a signal storm when a task thread responds to SIGINT
		by calling LwRrlExitMain(), but must remain active
		until the main thread responds and terminates the task.
	
	lwsm/client/main.c:
		In LogTapper(), the task handler for the log-tap
		command, invoke LwRtlExitMain() when we see a SIGINT
		or SIGTERM, but don't terminate our thread.  This
		allows LogTapper() to continue to process the incoming
		stream of log events until the main thread can signal
		the process we're "tapping" to restore it's previous log
		level and log redirection.
	
		This avoids deadlocking the process being "tapped" when
		the logging is emitted during the course of responding
		to lwsm's request to restore the previous log settings.
		If the FIFO used to send log data to "lwsm tap-log" is
		full, and lwsm is no longer servicing the FIFO, then not
		only will the attempt to change the log settings block,
		but so will all other threads that perform logging.

Change 1010428 on 2013/10/14 by daveb@daveb.p4work.shared.likwise.platform

	Merge @1010420 from //likewise/main to //likewise/r1 
	
	Cannot set security descriptor (SD) when the new, combined SD exceeds 
	512 bytes.
	
	A bug in PvfsSetSecurityDescriptorFile() falsely assumes that the size of 
	the current SD is sufficient to represent the new, combined SD.
	If the new, combined SD's size is less than PVFS_DEFAULT_SD_RELATIVE_SIZE 
	(512 bytes) then the code works.
	
	Once the combined SD exceedes 512 bytes PvfsSetSecurityDescriptorFile() 
	returns STATUS_BUFFER_TOO_SMALL and the windows client receives an error 
	message like "The data area passed to a system call is too small"
	
	Changes:
	//likewise/main/lwio/server/pvfs/acl.c:
	Added code to correctly size the current SD and the new, combined SD.
	If thew current SD is larger than PVFS_DEFAULT_SD_RELATIVE_SIZE
	then start allocation of the combined SD at 2x the current.
	
	//likewise/main/lwio/server/pvfs/acl_sd.c
	Added trace code to print sizes.

Change 1009198 on 2013/10/10 by justing@justing_ns1_likewise

	Merge likewise changes from //likewise/main/... to
	//likewise/r1/...
	
	Change 1008523 on 2013/10/07 by justing@justing_ns1_likewise
	==============
	Remove stale copies of curl, cyrus-sasl, krb5, openldap,
	and openssl that are included in the Likewise distribution,
	but are overridden by ports version in our builds.
	
	Change 1008931 on 2013/10/09 by justing@justing_ns1_likewise
	==============
	Prefer TCP over UDP for communication with the Kerberos
	KDC.
	
	This has been the default in Windows since Windows Vista
	and, with Win2K8 UDP requests are always rejected with
	KRB5KRB_ERR_RESPONSE_TOO_BIG status.  Prior to this change
	every Kerberos exchange included a UDP request followed by
	an immediate fallback to TCP.
	
	Note, that Kerberos will still attempt UDP if TCP fails.
	
	netlogon/server/api/lwnet-krb5.c:
		When rendering the krb5 affinity file at domain
		join time, include "udp_preference_limit = 0" in
		the libdefaults section of the file.
	
	Change 1009002 on 2013/10/09 by justing@justing_ns1_likewise
	==============
	lsass/interop/gssntlm/gssntlm.c:
		Update Likewise GSSAPI NTLM module to be compatible
		with krb5 1.11.3's gssapi plugin ABI.
	
		Note: This module is slated to be removed once the
		      NTLM support within cyrus-sasl is vetted.
	
	Change 1009004 on 2013/10/09 by justing@justing_ns1_likewise
	==============
	
	lsass/server/auth-providers/ad-open-provider/join/join.c:
		In LsaGetAccountName, fix loop exceedance check by
		defining a constant and using it both in the loop
		and in the if test that follows it.
	
	Change 1009005 on 2013/10/09 by justing@justing_ns1_likewise
	==============
	
	Update ldap SASL support now that we are relying on the
	"stock-ish" gssapi module in cyrus-sasl.
	
	lwadvapi/threaded/lwldap.c:
		Remove custom (from Likewise's GSS-SPNEGO plugin)
		SASL callback type "SASL_CB_SERVERFQDN".
		Cyrus SASL takes the server name as a standard parameter
		now, so no callback is required.
	
		Specify AD compatible behavior for OpenLdap.
	
		When specifying the security settings for an OpenLdap
		bind, don't bother to set a maximum that prevents
		confidentiality (e.g. encryption).  AD requires
		confidentiality if the DC supports it, and specifying
		the max just makes it harder for the gssapi module
		to perform an AD compatible negotiation.

Change 1009150 on 2013/10/10 by daveb@daveb.p4work.shared.likwise.platform

	Merge change 1009003 from //likewise/main to //likewise/r1 
	
	Large on disk SIDs/ACLs expose bug in PvfsGetSecurityDescriptorFileSd()
	and PvfsGetSecurityDescriptorFilenameSd().
	
	Incorrect usage of BAIL_ON_NT_STATUS() causes these functions to return 
	success when security_descriptor_get_file() et.al return a required size 
	larger than the user supplied size. The result is an invalid security 
	descriptor which may block all accesses to the affected file.
	
	The BAIL_ON_NT_STATUS(status) requires that a "status" variable be 
	provided not a #define constant.
	
	Audited other usages of BAIL_ON_NT_STATUS() and found 2 other similar 
	   errors. 

Change 1007503 on 2013/10/01 by robg@robg.ns1.likewise

	Copy //likewise/main to //likewise/r1

Change 1006142 on 2013/09/24 by willa@willa_likewise

	Merge the SMB1 Read bugfix for Verde 1.2.1.
	A customer encountered this bug and 1.3 is not ready yet.
	
	Merge list (1 changes):
	1001692
	
	Change 1001692 by johns@johns_ns1_likewise_main on 2013/08/28 14:47:01
	==========
	Likewise: fix for SMB1 Reads.
	The IRP flag for ZeroCopy reads where being set correctly for the execution IRP, but not the Completion IRP.
	This caused an assert to fail at line 621 of IopCompleteZctReadWriteFile

Change 666981 on 2013/05/21 by justing@justing_ns1_likewise

	Merge from //likewise/main -> //likewise/r1
	
	Change 666967 by justing@justing_ns1_likewise on 2013/05/20 16:21:16
	=============
	Correct memory leak in Likewise when performing SMB1 reads with
	the zero-copy framework enabled.
	
	TeamTrack: 26634
	
	likewise-platform/lwio/server/srv/protocols/smb1/readx.c:
		In SrvAttemptReadIo(), async command information
		is registered with the connection object so that
		client initiated cancellations can be properly
		routed and handled.  Prevent leak of this state and
		of all of the objects it references in case that
		the read completes asynchronously, but without
		error.  This will happen on the majority of reads
		if ZCT is enabled.
	
		In SrvAttemptReadIo(), ensure that pReadState->bStartedRead
		is always reset to FALSE when this stage of I/O
		processing is complete.  Otherwise, the state machine
		will believe future stages (e.g. SrvCompleteZctRead())
		have already been started and will short circuit
		their execution.
	
	               In SrvProcessReadAndX(), remove logic to cleanup async
		state on error.  This resource is completely managed
		within SrvAttemptReadIo().

Change 666922 on 2013/05/17 by willa@willa_likewise

	Update to //likewise/main/...@666681 for 1.1.

Change 662855 on 2013/03/27 by willa@willa_likewise

	Populate //likewise/r1/... from //likewise/main/...@662853.
	
	This stream is intended for release consumers.

