lkml.org 
[lkml]   [2014]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] xen-blkfront: remove type check from blkfront_setup_discard
On 01/10/2014 04:37 PM, Olaf Hering wrote:
> On Fri, Jan 10, Boris Ostrovsky wrote:
>
>> If the call below fails, is it safe to continue using discard feature? At
>> the least, are discard_granularity and discard_alignment guaranteed to have
>> sane/safe values?
> Its up to the toolstack to provide sane values. In the worst case
> discard fails. In this specific case the three values are optional, so
> the calls can fail. I do not know what happens if the backend device
> actually needs the values, but the frontend can not send proper discard
> requests. Hopefully it will not damage the hardware..

I don't know discard code works but it seems to me that if you pass, for
example, zero as discard_granularity (which may happen if
xenbus_gather() fails) then blkdev_issue_discard() in the backend will
set granularity to 1 and continue with discard. This may not be what the
the guest admin requested. And he won't know about this since no error
message is printed anywhere.

Similarly, if xenbug_gather("discard-secure") fails, I think the code
will assume that secure discard has not been requested. I don't know
what security implications this will have but it sounds bad to me.

I think we should at clear feature_discard and print an error in the log
if *either* of xenbus_gather() calls fail.


-boris


\
 
 \ /
  Last update: 2014-01-11 00:01    [W:0.081 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site