Skip to contentSkip to conversation

xenbus_dev_write and failed writes

DISCUSSION John Levon 2 participants 5 messages Mar 2, 2007

lore
Share & tools
lore

John Levon

author
#0 lore raw

In several places after setting u->len we return directly on error. Apart from the partial write case, it seems all of these should be resetting u->len to 0 as happens in the success case?

regards
john

#1 lore raw
Quoted 3 lines · John Levon

In several places after setting u->len we return directly on error. Apart from the partial write case, it seems all of these should be resetting u->len to 0 as happens in the success case?

Indeed. Now fixed (along with a couple of other bugs in that function).

-- Keir

author
#2 lore raw
Quoted 7 lines · Keir Fraser
Quoted 3 lines · John Levon

In several places after setting u->len we return directly on error. Apart from the partial write case, it seems all of these should be resetting u->len to 0 as happens in the success case?

Indeed. Now fixed (along with a couple of other bugs in that function).

Also, the BUG_ON in xenbusdrv_queue_reply() looks odd to me (in fact the whole function does). Are we really guaranteed that a reply message will be less than a page size? And it doesn't seem right to just stomp on the buffer contents if we wrap right past the consumer value.

We've seen both the BUG_ON (well, the ASSERT) and "xenstore-ls /" hang. Looking into exactly why now...

regards
john

#3 lore raw
Quoted 4 lines · John Levon

Also, the BUG_ON in xenbusdrv_queue_reply() looks odd to me (in fact the whole function does). Are we really guaranteed that a reply message will be less than a page size? And it doesn't seem right to just stomp on the buffer contents if we wrap right past the consumer value.

Yes, it at least makes sense to discard the data rather than BUG. Actually we should dynamically allocate up to some rather larger threshold than 4kB. Will you fix this?

-- Keir

author
#4 lore raw
Quoted 8 lines · Keir Fraser
Quoted 4 lines

Also, the BUG_ON in xenbusdrv_queue_reply() looks odd to me (in fact the whole function does). Are we really guaranteed that a reply message will be less than a page size? And it doesn't seem right to just stomp on the buffer contents if we wrap right past the consumer value.

Yes, it at least makes sense to discard the data rather than BUG. Actually we should dynamically allocate up to some rather larger threshold than 4kB. Will you fix this?

I doubt I'll have time to fix /both/ kernels, sorry...

regards
john