linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA
@ 2014-10-27 13:44 Vitaly Kuznetsov
  2014-11-03 12:22 ` Laszlo Ersek
  2014-12-01 13:01 ` [PATCH RESEND] " Vitaly Kuznetsov
  0 siblings, 2 replies; 7+ messages in thread
From: Vitaly Kuznetsov @ 2014-10-27 13:44 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Boris Ostrovsky, David Vrabel, xen-devel, linux-kernel,
	Jeff Moyer, Laszlo Ersek, Andrew Jones

Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
in d11e61583 and was factored out into blkif_request_flush_valid() in
0f1ca65ee. However:
1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
   and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
   will still pass the check.
2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
   the request is invalid.
3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
   -EOPNOTSUPP is more appropriate here.
Fix all of the above issues.

This patch is based on the original patch by Laszlo Ersek and a comment by
Jeff Moyer.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/block/xen-blkfront.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 5ac312f..2e6c103 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
 		notify_remote_via_irq(info->irq);
 }
 
-static inline bool blkif_request_flush_valid(struct request *req,
-					     struct blkfront_info *info)
+static inline bool blkif_request_flush_invalid(struct request *req,
+					       struct blkfront_info *info)
 {
 	return ((req->cmd_type != REQ_TYPE_FS) ||
-		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
-		!info->flush_op));
+		((req->cmd_flags & REQ_FLUSH) &&
+		 !(info->feature_flush & REQ_FLUSH)) ||
+		((req->cmd_flags & REQ_FUA) &&
+		 !(info->feature_flush & REQ_FUA)));
 }
 
 /*
@@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
 
 		blk_start_request(req);
 
-		if (blkif_request_flush_valid(req, info)) {
-			__blk_end_request_all(req, -EIO);
+		if (blkif_request_flush_invalid(req, info)) {
+			__blk_end_request_all(req, -EOPNOTSUPP);
 			continue;
 		}
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA
  2014-10-27 13:44 [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA Vitaly Kuznetsov
@ 2014-11-03 12:22 ` Laszlo Ersek
  2014-11-03 15:49   ` Boris Ostrovsky
  2014-12-01 13:01 ` [PATCH RESEND] " Vitaly Kuznetsov
  1 sibling, 1 reply; 7+ messages in thread
From: Laszlo Ersek @ 2014-11-03 12:22 UTC (permalink / raw)
  To: Vitaly Kuznetsov, Konrad Rzeszutek Wilk
  Cc: Boris Ostrovsky, David Vrabel, xen-devel, linux-kernel,
	Jeff Moyer, Andrew Jones

On 10/27/14 14:44, Vitaly Kuznetsov wrote:
> Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
> in d11e61583 and was factored out into blkif_request_flush_valid() in
> 0f1ca65ee. However:
> 1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
>    and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
>    will still pass the check.
> 2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
>    the request is invalid.
> 3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
>    -EOPNOTSUPP is more appropriate here.
> Fix all of the above issues.
> 
> This patch is based on the original patch by Laszlo Ersek and a comment by
> Jeff Moyer.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  drivers/block/xen-blkfront.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 5ac312f..2e6c103 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
>  		notify_remote_via_irq(info->irq);
>  }
>  
> -static inline bool blkif_request_flush_valid(struct request *req,
> -					     struct blkfront_info *info)
> +static inline bool blkif_request_flush_invalid(struct request *req,
> +					       struct blkfront_info *info)
>  {
>  	return ((req->cmd_type != REQ_TYPE_FS) ||
> -		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
> -		!info->flush_op));
> +		((req->cmd_flags & REQ_FLUSH) &&
> +		 !(info->feature_flush & REQ_FLUSH)) ||
> +		((req->cmd_flags & REQ_FUA) &&
> +		 !(info->feature_flush & REQ_FUA)));
>  }
>  
>  /*
> @@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
>  
>  		blk_start_request(req);
>  
> -		if (blkif_request_flush_valid(req, info)) {
> -			__blk_end_request_all(req, -EIO);
> +		if (blkif_request_flush_invalid(req, info)) {
> +			__blk_end_request_all(req, -EOPNOTSUPP);
>  			continue;
>  		}
>  
> 

Not sure if there has been some feedback yet (I can't see anything
threaded with this message in my inbox).

FWIW I consulted "Documentation/block/writeback_cache_control.txt" for
this review. Apparently, REQ_FLUSH forces out "previously completed
write requests", whereas REQ_FUA delays the IO completion signal for
*this* request until "the data has been committed to non-volatile
storage". So, indeed, support for REQ_FLUSH only does not guarantee that
REQ_FUA can be served.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA
  2014-11-03 12:22 ` Laszlo Ersek
@ 2014-11-03 15:49   ` Boris Ostrovsky
  2014-11-03 17:11     ` Vitaly Kuznetsov
  0 siblings, 1 reply; 7+ messages in thread
From: Boris Ostrovsky @ 2014-11-03 15:49 UTC (permalink / raw)
  To: Laszlo Ersek, Vitaly Kuznetsov, Konrad Rzeszutek Wilk
  Cc: David Vrabel, xen-devel, linux-kernel, Jeff Moyer, Andrew Jones

On 11/03/2014 07:22 AM, Laszlo Ersek wrote:
> On 10/27/14 14:44, Vitaly Kuznetsov wrote:
>> Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
>> in d11e61583 and was factored out into blkif_request_flush_valid() in
>> 0f1ca65ee. However:
>> 1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
>>     and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
>>     will still pass the check.
>> 2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
>>     the request is invalid.
>> 3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
>>     -EOPNOTSUPP is more appropriate here.
>> Fix all of the above issues.
>>
>> This patch is based on the original patch by Laszlo Ersek and a comment by
>> Jeff Moyer.
>>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> ---
>>   drivers/block/xen-blkfront.c | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 5ac312f..2e6c103 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
>>   		notify_remote_via_irq(info->irq);
>>   }
>>   
>> -static inline bool blkif_request_flush_valid(struct request *req,
>> -					     struct blkfront_info *info)
>> +static inline bool blkif_request_flush_invalid(struct request *req,
>> +					       struct blkfront_info *info)
>>   {
>>   	return ((req->cmd_type != REQ_TYPE_FS) ||
>> -		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
>> -		!info->flush_op));
>> +		((req->cmd_flags & REQ_FLUSH) &&
>> +		 !(info->feature_flush & REQ_FLUSH)) ||
>> +		((req->cmd_flags & REQ_FUA) &&
>> +		 !(info->feature_flush & REQ_FUA)));

Somewhat unrelated to the patch, but I am wondering whether we actually 
need flush_op field at all as it seems that it is unambiguously defined 
by REQ_FLUSH/REQ_FUA.

-boris

>>   }
>>   
>>   /*
>> @@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
>>   
>>   		blk_start_request(req);
>>   
>> -		if (blkif_request_flush_valid(req, info)) {
>> -			__blk_end_request_all(req, -EIO);
>> +		if (blkif_request_flush_invalid(req, info)) {
>> +			__blk_end_request_all(req, -EOPNOTSUPP);
>>   			continue;
>>   		}
>>   
>>
> Not sure if there has been some feedback yet (I can't see anything
> threaded with this message in my inbox).
>
> FWIW I consulted "Documentation/block/writeback_cache_control.txt" for
> this review. Apparently, REQ_FLUSH forces out "previously completed
> write requests", whereas REQ_FUA delays the IO completion signal for
> *this* request until "the data has been committed to non-volatile
> storage". So, indeed, support for REQ_FLUSH only does not guarantee that
> REQ_FUA can be served.
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> Thanks
> Laszlo


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA
  2014-11-03 15:49   ` Boris Ostrovsky
@ 2014-11-03 17:11     ` Vitaly Kuznetsov
  0 siblings, 0 replies; 7+ messages in thread
From: Vitaly Kuznetsov @ 2014-11-03 17:11 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Laszlo Ersek, Konrad Rzeszutek Wilk, David Vrabel, xen-devel,
	linux-kernel, Jeff Moyer, Andrew Jones

Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:

> On 11/03/2014 07:22 AM, Laszlo Ersek wrote:
>> On 10/27/14 14:44, Vitaly Kuznetsov wrote:
>>> Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
>>> in d11e61583 and was factored out into blkif_request_flush_valid() in
>>> 0f1ca65ee. However:
>>> 1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
>>>     and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
>>>     will still pass the check.
>>> 2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
>>>     the request is invalid.
>>> 3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
>>>     -EOPNOTSUPP is more appropriate here.
>>> Fix all of the above issues.
>>>
>>> This patch is based on the original patch by Laszlo Ersek and a comment by
>>> Jeff Moyer.
>>>
>>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>>> ---
>>>   drivers/block/xen-blkfront.c | 14 ++++++++------
>>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>>> index 5ac312f..2e6c103 100644
>>> --- a/drivers/block/xen-blkfront.c
>>> +++ b/drivers/block/xen-blkfront.c
>>> @@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
>>>   		notify_remote_via_irq(info->irq);
>>>   }
>>>   -static inline bool blkif_request_flush_valid(struct request
>>> *req,
>>> -					     struct blkfront_info *info)
>>> +static inline bool blkif_request_flush_invalid(struct request *req,
>>> +					       struct blkfront_info *info)
>>>   {
>>>   	return ((req->cmd_type != REQ_TYPE_FS) ||
>>> -		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
>>> -		!info->flush_op));
>>> +		((req->cmd_flags & REQ_FLUSH) &&
>>> +		 !(info->feature_flush & REQ_FLUSH)) ||
>>> +		((req->cmd_flags & REQ_FUA) &&
>>> +		 !(info->feature_flush & REQ_FUA)));
>
> Somewhat unrelated to the patch, but I am wondering whether we
> actually need flush_op field at all as it seems that it is
> unambiguously defined by REQ_FLUSH/REQ_FUA.

I was under an impression it was added for readability sake but we
definitely can remove it. If noone objects I'll send separate cleanup
patch (don't want to mix these two).

>
> -boris
>
>>>   }
>>>     /*
>>> @@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
>>>     		blk_start_request(req);
>>>   -		if (blkif_request_flush_valid(req, info)) {
>>> -			__blk_end_request_all(req, -EIO);
>>> +		if (blkif_request_flush_invalid(req, info)) {
>>> +			__blk_end_request_all(req, -EOPNOTSUPP);
>>>   			continue;
>>>   		}
>>>   
>>>
>> Not sure if there has been some feedback yet (I can't see anything
>> threaded with this message in my inbox).
>>
>> FWIW I consulted "Documentation/block/writeback_cache_control.txt" for
>> this review. Apparently, REQ_FLUSH forces out "previously completed
>> write requests", whereas REQ_FUA delays the IO completion signal for
>> *this* request until "the data has been committed to non-volatile
>> storage". So, indeed, support for REQ_FLUSH only does not guarantee that
>> REQ_FUA can be served.
>>
>> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>>
>> Thanks
>> Laszlo

-- 
  Vitaly

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH RESEND] xen/blkfront: improve protection against issuing unsupported REQ_FUA
  2014-10-27 13:44 [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA Vitaly Kuznetsov
  2014-11-03 12:22 ` Laszlo Ersek
@ 2014-12-01 13:01 ` Vitaly Kuznetsov
  2014-12-03 16:57   ` Boris Ostrovsky
  1 sibling, 1 reply; 7+ messages in thread
From: Vitaly Kuznetsov @ 2014-12-01 13:01 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Boris Ostrovsky, David Vrabel, Laszlo Ersek, Andrew Jones,
	Jeff Moyer, linux-kernel, xen-devel

Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
in d11e61583 and was factored out into blkif_request_flush_valid() in
0f1ca65ee. However:
1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
   and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
   will still pass the check.
2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
   the request is invalid.
3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
   -EOPNOTSUPP is more appropriate here.
Fix all of the above issues.

This patch is based on the original patch by Laszlo Ersek and a comment by
Jeff Moyer.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 drivers/block/xen-blkfront.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 5ac312f..2e6c103 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
 		notify_remote_via_irq(info->irq);
 }
 
-static inline bool blkif_request_flush_valid(struct request *req,
-					     struct blkfront_info *info)
+static inline bool blkif_request_flush_invalid(struct request *req,
+					       struct blkfront_info *info)
 {
 	return ((req->cmd_type != REQ_TYPE_FS) ||
-		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
-		!info->flush_op));
+		((req->cmd_flags & REQ_FLUSH) &&
+		 !(info->feature_flush & REQ_FLUSH)) ||
+		((req->cmd_flags & REQ_FUA) &&
+		 !(info->feature_flush & REQ_FUA)));
 }
 
 /*
@@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
 
 		blk_start_request(req);
 
-		if (blkif_request_flush_valid(req, info)) {
-			__blk_end_request_all(req, -EIO);
+		if (blkif_request_flush_invalid(req, info)) {
+			__blk_end_request_all(req, -EOPNOTSUPP);
 			continue;
 		}
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND] xen/blkfront: improve protection against issuing unsupported REQ_FUA
  2014-12-01 13:01 ` [PATCH RESEND] " Vitaly Kuznetsov
@ 2014-12-03 16:57   ` Boris Ostrovsky
  2014-12-03 17:05     ` Vitaly Kuznetsov
  0 siblings, 1 reply; 7+ messages in thread
From: Boris Ostrovsky @ 2014-12-03 16:57 UTC (permalink / raw)
  To: Vitaly Kuznetsov, Konrad Rzeszutek Wilk
  Cc: David Vrabel, Laszlo Ersek, Andrew Jones, Jeff Moyer,
	linux-kernel, xen-devel

On 12/01/2014 08:01 AM, Vitaly Kuznetsov wrote:
> Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
> in d11e61583 and was factored out into blkif_request_flush_valid() in
> 0f1ca65ee. However:
> 1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
>     and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
>     will still pass the check.
> 2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
>     the request is invalid.
> 3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
>     -EOPNOTSUPP is more appropriate here.
> Fix all of the above issues.
>
> This patch is based on the original patch by Laszlo Ersek and a comment by
> Jeff Moyer.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

(although, as I mentioned last time, a companion patch to remove 
flush_op would be a good thing to have)


-boris

> ---
>   drivers/block/xen-blkfront.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 5ac312f..2e6c103 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
>   		notify_remote_via_irq(info->irq);
>   }
>   
> -static inline bool blkif_request_flush_valid(struct request *req,
> -					     struct blkfront_info *info)
> +static inline bool blkif_request_flush_invalid(struct request *req,
> +					       struct blkfront_info *info)
>   {
>   	return ((req->cmd_type != REQ_TYPE_FS) ||
> -		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
> -		!info->flush_op));
> +		((req->cmd_flags & REQ_FLUSH) &&
> +		 !(info->feature_flush & REQ_FLUSH)) ||
> +		((req->cmd_flags & REQ_FUA) &&
> +		 !(info->feature_flush & REQ_FUA)));
>   }
>   
>   /*
> @@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
>   
>   		blk_start_request(req);
>   
> -		if (blkif_request_flush_valid(req, info)) {
> -			__blk_end_request_all(req, -EIO);
> +		if (blkif_request_flush_invalid(req, info)) {
> +			__blk_end_request_all(req, -EOPNOTSUPP);
>   			continue;
>   		}
>   


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND] xen/blkfront: improve protection against issuing unsupported REQ_FUA
  2014-12-03 16:57   ` Boris Ostrovsky
@ 2014-12-03 17:05     ` Vitaly Kuznetsov
  0 siblings, 0 replies; 7+ messages in thread
From: Vitaly Kuznetsov @ 2014-12-03 17:05 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Konrad Rzeszutek Wilk, David Vrabel, Laszlo Ersek, Andrew Jones,
	Jeff Moyer, linux-kernel, xen-devel

Boris Ostrovsky <boris.ostrovsky@oracle.com> writes:

> On 12/01/2014 08:01 AM, Vitaly Kuznetsov wrote:
>> Guard against issuing unsupported REQ_FUA and REQ_FLUSH was introduced
>> in d11e61583 and was factored out into blkif_request_flush_valid() in
>> 0f1ca65ee. However:
>> 1) This check in incomplete. In case we negotiated to feature_flush = REQ_FLUSH
>>     and flush_op = BLKIF_OP_FLUSH_DISKCACHE (so FUA is unsupported) FUA request
>>     will still pass the check.
>> 2) blkif_request_flush_valid() is misnamed. It is bool but returns true when
>>     the request is invalid.
>> 3) When blkif_request_flush_valid() fails -EIO is being returned. It seems that
>>     -EOPNOTSUPP is more appropriate here.
>> Fix all of the above issues.
>>
>> This patch is based on the original patch by Laszlo Ersek and a comment by
>> Jeff Moyer.
>>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>
> (although, as I mentioned last time, a companion patch to remove
> flush_op would be a good thing to have)
>

Thanks, it is on my todo list but I'm trying to separate this
(potential) bugfix from straight cleanup.

> -boris
>
>> ---
>>   drivers/block/xen-blkfront.c | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 5ac312f..2e6c103 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -582,12 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
>>   		notify_remote_via_irq(info->irq);
>>   }
>>   -static inline bool blkif_request_flush_valid(struct request *req,
>> -					     struct blkfront_info *info)
>> +static inline bool blkif_request_flush_invalid(struct request *req,
>> +					       struct blkfront_info *info)
>>   {
>>   	return ((req->cmd_type != REQ_TYPE_FS) ||
>> -		((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
>> -		!info->flush_op));
>> +		((req->cmd_flags & REQ_FLUSH) &&
>> +		 !(info->feature_flush & REQ_FLUSH)) ||
>> +		((req->cmd_flags & REQ_FUA) &&
>> +		 !(info->feature_flush & REQ_FUA)));
>>   }
>>     /*
>> @@ -612,8 +614,8 @@ static void do_blkif_request(struct request_queue *rq)
>>     		blk_start_request(req);
>>   -		if (blkif_request_flush_valid(req, info)) {
>> -			__blk_end_request_all(req, -EIO);
>> +		if (blkif_request_flush_invalid(req, info)) {
>> +			__blk_end_request_all(req, -EOPNOTSUPP);
>>   			continue;
>>   		}
>>   

-- 
  Vitaly

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-12-03 17:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 13:44 [PATCH] xen/blkfront: improve protection against issuing unsupported REQ_FUA Vitaly Kuznetsov
2014-11-03 12:22 ` Laszlo Ersek
2014-11-03 15:49   ` Boris Ostrovsky
2014-11-03 17:11     ` Vitaly Kuznetsov
2014-12-01 13:01 ` [PATCH RESEND] " Vitaly Kuznetsov
2014-12-03 16:57   ` Boris Ostrovsky
2014-12-03 17:05     ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).