diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-09-23 14:42:28 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-10-02 00:27:31 -0400 |
commit | 4a47d3a1ff10e564bf04f27ac14552df64f60cdf (patch) | |
tree | 403bdc848fc11049bd20ecb565f701a4d1f3f5c3 /drivers/vhost/scsi.c | |
parent | 0b41d6ca616ddeb3b6c0a80e8770b6f53cd42806 (diff) |
vhost/scsi: Use GFP_ATOMIC with percpu_ida_alloc for obtaining tag
Fix GFP_KERNEL -> GFP_ATOMIC usage of percpu_ida_alloc() within
vhost_scsi_get_tag(), as this code is expected to be called directly
from interrupt context.
v2 changes:
- Handle possible tag < 0 failure with GFP_ATOMIC
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Asias He <asias@redhat.com>
Cc: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/vhost/scsi.c')
-rw-r--r-- | drivers/vhost/scsi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 592b31698fc8..ce5221fa393a 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -728,7 +728,12 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, | |||
728 | } | 728 | } |
729 | se_sess = tv_nexus->tvn_se_sess; | 729 | se_sess = tv_nexus->tvn_se_sess; |
730 | 730 | ||
731 | tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_KERNEL); | 731 | tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_ATOMIC); |
732 | if (tag < 0) { | ||
733 | pr_err("Unable to obtain tag for tcm_vhost_cmd\n"); | ||
734 | return ERR_PTR(-ENOMEM); | ||
735 | } | ||
736 | |||
732 | cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag]; | 737 | cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag]; |
733 | sg = cmd->tvc_sgl; | 738 | sg = cmd->tvc_sgl; |
734 | pages = cmd->tvc_upages; | 739 | pages = cmd->tvc_upages; |