All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Return the result from user admin command IOCTL even in case of failure
@ 2013-05-22 22:34 Chayan Biswas
  2013-05-23 17:36 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Chayan Biswas @ 2013-05-22 22:34 UTC (permalink / raw)


We copy the result to user if the command is completed from the
controller even if it completes with failure (non-zero) status.
A return status of < 0 indicates the command was not completed
by the controller. The user application may expect the error code
in the result field in case of failure.


Signed-off-by: Chayan Biswas <Chayan.Biswas at sandisk.com>
---
 drivers/block/nvme-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 42abf72..8493708 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1439,7 +1439,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev,
                nvme_free_iod(dev, iod);
        }

-       if (!status && copy_to_user(&ucmd->result, &cmd.result,
+       if ((status >= 0) && copy_to_user(&ucmd->result, &cmd.result,
                                                        sizeof(cmd.result)))
                status = -EFAULT;

--
1.7.1


________________________________

PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies).

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

* [PATCH v2] Return the result from user admin command IOCTL even in case of failure
  2013-05-22 22:34 [PATCH v2] Return the result from user admin command IOCTL even in case of failure Chayan Biswas
@ 2013-05-23 17:36 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2013-05-23 17:36 UTC (permalink / raw)


On Wed, May 22, 2013@10:34:49PM +0000, Chayan Biswas wrote:
> -       if (!status && copy_to_user(&ucmd->result, &cmd.result,
> +       if ((status >= 0) && copy_to_user(&ucmd->result, &cmd.result,

I just tried to apply this and the patch is corrupted.  It looks like your
mailer has changed the tabs to spaces.  This seems to be an unfortunately
common problem with Outlook / Exchange.  Since this one's a one-liner,
I'll fix it up by hand, but for larger patches, can you use a different
mailer?

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

end of thread, other threads:[~2013-05-23 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-22 22:34 [PATCH v2] Return the result from user admin command IOCTL even in case of failure Chayan Biswas
2013-05-23 17:36 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.