Paul Durrant [Tue, 24 Feb 2015 11:50:38 +0000 (11:50 +0000)]
Make sure we only use the first 32 (-8) grant entries for crash kernel
XENBUS only uses grant entries 32 onwards so that the first 32 (minus the 8
reserved entries) are clean for the crash kernel. This patch makes sure that
the crash kernel does not go over that limit.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 30 Jan 2015 13:44:42 +0000 (13:44 +0000)]
Insertion into head of austere heap misses setting reverse link
The heap is maintained as a doubly linked list of objects but both
__AllocSmall() and __FreeSmall() are missing setup of the reverse link when
a new object is inserted at the head. This patch adds the necessary fix.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Reported-by: Gregory Jacklin <jackling@amazon.com>
Ben Chalmers [Tue, 20 Jan 2015 14:27:19 +0000 (14:27 +0000)]
Protect BackendPath from race using StateLock
The BackendPath can change as part of PDO state transitions, leading
to a race with the frontend thread. Since the frontend state lock is
locked through state transitions, taking the lock is sufficient to
avoid the race
Signed-off-by: Ben Chalmers <Ben.Chalmers@citrix.com>
Owen Smith [Tue, 20 Jan 2015 13:54:01 +0000 (13:54 +0000)]
Ignore invalid devices
When a floppy drive is attached, the device id string cannot be parsed
into a valid xvd, sd? or hd? format. Report the error instead of asserting
and return the invalid value to ignore the device in question.
Paul Durrant [Thu, 8 Jan 2015 13:44:15 +0000 (13:44 +0000)]
Handle storage query ioctls properly
Both the ioctls we care about are METHOD_BUFFERED so ASSERT that and then
use the associated IRP SystemBuffer, remembering to verify input and output
sizes.
Also we should only return (or expect returned) data in the case of a full
query, as opposed to an existence query.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Tue, 28 Oct 2014 11:27:24 +0000 (11:27 +0000)]
Add XenDisk device upper filter.
XenDisk intercepts and translates IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES
into SCSIOP_UNMAP SRBs. Storport will pass on these SCSIOP_UNMAP requests
to XenVbd, which will create the appropriate BLKIF_OP_DISCARD requests.
XenDisk is only neccessary because Storport does not do the translation
to SCSIOP_UNMAPs.
Signed-off-by: Owen Smith <owen.smith@citrix.com> Acked-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Tue, 28 Oct 2014 11:27:22 +0000 (11:27 +0000)]
Prepare SCSIOP_UNMAP correctly
SCSIOP_UNMAP requests contain a list of extents to discard
and each BLKIF_OP_DISCARD only handles a single extent.
Break a SRB doen into multiple ring requests as necessary.
Signed-off-by: Owen Smith <owen.smith@citrix.com> Acked-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Thu, 4 Sep 2014 08:28:05 +0000 (09:28 +0100)]
Re-read features after Connect
blkback incorrectly writes features before setting Connected instead
of before setting InitWait. Re-read these values after backend goes
Connected, to get the current value.
Note: Some values *must* be written before setting Connected, as
blkback can only discover these values by connecting to the underlying
storage.
Owen Smith [Thu, 4 Sep 2014 08:19:40 +0000 (09:19 +0100)]
Fix BLKIF_OP_INDIRECT protocol requests
Fixes an issue with indirect requests that arose due to changes in
XenBus's (7.x) grant table interface (v3 to v4). Refactored for the
8.0 version of XenBus.
Rework internal request structures to contain a list of segments.
Number of segments determines the difference between direct and
indirect operations.
blkback is limited to 256 segments per indirect request, XenVbd
reports support for 175 physical breaks (i.e. segments).
Paul Durrant [Thu, 14 Aug 2014 16:46:39 +0000 (17:46 +0100)]
Update branding
Remove the use of the 'XenServer' product name except where it is
still appropriate.
Remove use of 'Citrix' from all places except source file
copyrights.
Allow company and product name to be set at build time.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 23 Jul 2014 08:40:54 +0000 (09:40 +0100)]
Implement new API version scheme
This patch changes the way APIs work in an incompatible way. (See README.md
for details).
The patch also includes a *lot* of code tidying and movement and as such
is not really suitable for review as a patch; the resulting code should
itself be reviewed.
Given the scale of the change, the major version number has been revised to
8 and other version numbers reset to zero.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Thu, 1 May 2014 11:32:10 +0000 (12:32 +0100)]
[CA-134598] Store the (partial) tag along with the XENVBD_REQUEST.
Migrate and a bus/target reset will re-queue any existing requests, but not
reset the request tagging correctly, and will eventually run out of free tags.
Paul Durrant [Tue, 22 Apr 2014 09:24:39 +0000 (10:24 +0100)]
Fix BSOD caused by KeWaitForMultipleObjects()
KeWaitForMultipleObjects() should use a wait block array if the
number of objects exceeds THREAD_WAIT_OBJECTS. The number of objects
PdoDestroy() waits on is 4 which exceeds the currently defined value
of that constant (which is 3).
Signed-off-by: Murtaza Ghiya <murtazg@amazon.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Fri, 14 Mar 2014 09:30:59 +0000 (09:30 +0000)]
Prepare, submit and cleanup BLKIF_OP_INDIRECT
When a read or write request would not fit into a single
BLKIF_OP_{READ/WRITE}, and the backend supports indirect
operations, prepare and submit a BLKIF_OP_INDIRECT and
handle the response.
Owen Smith [Wed, 12 Mar 2014 10:09:16 +0000 (10:09 +0000)]
Pass a tag to blkif_request_t.id instead of a raw pointer.
Validate blkif_response_t.id is a correctly formatted tag before
retrieving the appropriate PXENVBD_REQUEST pointer.
Owen Smith [Wed, 12 Feb 2014 09:40:11 +0000 (09:40 +0000)]
Manage SrbStatus better.
Set to PENDING (once) before any actions occur, and only set to success when
completing the SRB. SrbStatus is set to a fail code if any Requests fail.
The fail code can be overwritten with a different fail code, but not with a
success code.
Owen Smith [Fri, 7 Feb 2014 15:52:36 +0000 (15:52 +0000)]
Add handler for SCSIOP_UNMAP, translating to BLKIF_OP_DISCARD
Note: Storport will not generate SCSIOP_UNMAPs, a filter will be
required to convert IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES
into SCSIOP_UNMAPs
Owen Smith [Fri, 7 Feb 2014 11:58:16 +0000 (11:58 +0000)]
Tidy up REQUEST preparation code,
Move scatter gather access to SGList* functions
Move mapping memory to seperate function
Reduce unneccessary local variable usage