Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2356490imm; Mon, 28 May 2018 06:38:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpLaDoauqYLOgei3wAFo7k54ztNtkCNew1SutZL7jKCEtx3aTak9L+fO+6sqzq2FQvptz+u X-Received: by 2002:a62:981d:: with SMTP id q29-v6mr13570906pfd.65.1527514718991; Mon, 28 May 2018 06:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527514718; cv=none; d=google.com; s=arc-20160816; b=wLzi26DCcFj1XfYhewQTqqbKaSLDJ4+FVPBUB0SyJbCi99rsTacFrcFYCKBAT8gYVf dBy+KSGP0ArQrNNtCQ3wCn4V6Xn/5LEO1PdhxexoXFjXpsQ5W4Cs63MUnJCU//U+f3Li MULeyZ9ATr7C2BiTC08T0d3WVhVqGT4wlsEwHGRCDYlbryPUh+KRipDAX1LHHIzNLLiW WMxhb3Lpy4JB11t1iDrk0eqDdMhLDk0rDynW0O/RAnNKE5gbmCqrMQsncoM2+iDQwMVE 7071Eie1dTeYjLRcrE0Rt+JwEr3sU2Q3LtfRcBbMTbL5JQnKHgSaS5/6CbGfFWlSJzZl 0qig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=GaigRS7FgDK4rP46LYJQx8yuaOK5na6gascoIFP9w2s=; b=kuncHTLLB8HOJEoIjnRdpoqY0s4kY9/upAkivrREKZH4/cBp7Et+O9hfdcr7YuH4qA wS6RTOxJzeqQFBElDCRlMUnN2olv7w5rgSxc+7W3DT0uqrcooLoXMYrTllA4TSjSM38J FAopCkFuncyIWUKOIpwUR6FIlIqlpzoJumGoj4sxD/YltmfPTWWBz9DXPhHiBeI9aPyp PvuQ/QuhbB47pvZ0qXsc+Ujaw4kW7tOy8oUfYkNnTv4xvGl8jenjDnsACe59K/+4ykNS tNoTVY8EkAT8y42Ec6RosPTNoRkEh9t62zvDHLQibA420mOhAtL3uYYMtRxJTxTilAh8 wBkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qefjlilC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10-v6si13523572pgv.513.2018.05.28.06.38.24; Mon, 28 May 2018 06:38:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qefjlilC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937729AbeE1KpN (ORCPT + 99 others); Mon, 28 May 2018 06:45:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:35668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937617AbeE1KpF (ORCPT ); Mon, 28 May 2018 06:45:05 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2511B2088E; Mon, 28 May 2018 10:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504304; bh=D3V1vUuvC+VsEu4eVpauuA67e3WS2hyiOBzzFT/4JAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qefjlilC/tEOSVRB2ARR4xqF66a8rgG3V97pozz8qUwPlETGZGvxXjzitG8xECN7f 8t4B4Fx+TOJnfwiPY2iR0KQ3ouTEFTp/DYoBgyL1BENXkykJz1iP9nUBosrgbOBqhT KKhjGZO3Qa54PS57nCrtCmwuPCZj+bOjFBUUuJbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Martin Schwidefsky , Sasha Levin Subject: [PATCH 4.14 089/496] s390/dasd: fix handling of internal requests Date: Mon, 28 May 2018 11:57:54 +0200 Message-Id: <20180528100323.557833015@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Haberland [ Upstream commit 9487cfd3430d07366801886bdf185799a2b6f066 ] Internal DASD device driver I/O such as query host access count or path verification is started using the _sleep_on() function. To mark a request as started or ended the callback_data is set to either DASD_SLEEPON_START_TAG or DASD_SLEEPON_END_TAG. In cases where the request has to be stopped unconditionally the status is set to DASD_SLEEPON_END_TAG as well which leads to immediate clearing of the request. But the request might still be on a device request queue for normal operation which might lead to a panic because of a BUG() statement in __dasd_device_process_final_queue() or a list corruption of the device request queue. Fix by removing the setting of DASD_SLEEPON_END_TAG in the dasd_cancel_req() and dasd_generic_requeue_all_requests() functions and ensure that the request is not deleted in the requeue function. Trigger the device tasklet in the requeue function and let the normal processing cleanup the request. Signed-off-by: Stefan Haberland Reviewed-by: Jan Hoeppner Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dasd.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -2596,8 +2596,6 @@ int dasd_cancel_req(struct dasd_ccw_req case DASD_CQR_QUEUED: /* request was not started - just set to cleared */ cqr->status = DASD_CQR_CLEARED; - if (cqr->callback_data == DASD_SLEEPON_START_TAG) - cqr->callback_data = DASD_SLEEPON_END_TAG; break; case DASD_CQR_IN_IO: /* request in IO - terminate IO and release again */ @@ -3917,9 +3915,12 @@ static int dasd_generic_requeue_all_requ wait_event(dasd_flush_wq, (cqr->status != DASD_CQR_CLEAR_PENDING)); - /* mark sleepon requests as ended */ - if (cqr->callback_data == DASD_SLEEPON_START_TAG) - cqr->callback_data = DASD_SLEEPON_END_TAG; + /* + * requeue requests to blocklayer will only work + * for block device requests + */ + if (_dasd_requeue_request(cqr)) + continue; /* remove requests from device and block queue */ list_del_init(&cqr->devlist); @@ -3932,13 +3933,6 @@ static int dasd_generic_requeue_all_requ cqr = refers; } - /* - * requeue requests to blocklayer will only work - * for block device requests - */ - if (_dasd_requeue_request(cqr)) - continue; - if (cqr->block) list_del_init(&cqr->blocklist); cqr->block->base->discipline->free_cp( @@ -3955,8 +3949,7 @@ static int dasd_generic_requeue_all_requ list_splice_tail(&requeue_queue, &device->ccw_queue); spin_unlock_irq(get_ccwdev_lock(device->cdev)); } - /* wake up generic waitqueue for eventually ended sleepon requests */ - wake_up(&generic_waitq); + dasd_schedule_device_bh(device); return rc; }