Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1920220imm; Thu, 24 May 2018 02:57:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrN5n28lGAasLUNiVmZwt6Ixtpyt/wYihmJZQjXt1smOXVXNciMeKyyBn2ItPcOdcXpkcAA X-Received: by 2002:a63:7043:: with SMTP id a3-v6mr5267983pgn.206.1527155868643; Thu, 24 May 2018 02:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155868; cv=none; d=google.com; s=arc-20160816; b=aSgZZBmQ/ThO6anrMgoc2kU7Qo7ep+/X9JD2fDdjXeg7HZr43GZXYHr0IAd9QpuoOb qHwfHTjZGTDae24fRVSQUN4fKWbri1sjGDW0LTP2N74o68tw7HOE696GG4c+3F1f7bcP W5xqnzfgZ/gpBbK49aGej46VSRK0c5EsHgOX2Ioe4e2G7BJnGl3KN2jRE3pgmtDJLuFg 6NiMcARenZCuuVdFacKYWRx1eBxoL7iUg+Wqob1A5Svo1hDg0IONUTKtmcdLKGLwzWmC 27YNKI1of6muzsMVt1XP7lDZlA0+CZMCJozJ7HDWUhL/boMoiDyWA5gFCh6+Yv+5dsRA djYw== 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=n9uSzW/WuGQu29Zt+d0VvdLVkICn3892n5NuteWXqIY=; b=t932jNBOVupwqG6oSw45XnNhyNxs/KYWQaH/zfVV6y5QfbAYiKPahtLNLf3sDYCesT ZOTUwC+Tto2QvXuAIAlstLB389uAYFPl6hySMBR8nc5E317UzsA9rqqWxG4pw7oawkeP +e02MT/j2cKgRFbUqXqeedMNTwNRLH12b69B9S81U0NU92CAgL6RP/MFSzyoynmhYkTr xxRq+jXFgNfr1UdRjIA6B5ggpempubcXvBYkjvgQfrHxmzdxCZFAClf4tDi48Z6VG5Xl Z8zM5d9ykmeiQR2CqGA7XhKV0PL7ATQ0OObzcE+nkxN/6Odzn1bK/c651BpBO2g1Mt22 xv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FdSQTX5P; 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 r7-v6si21285966ple.585.2018.05.24.02.57.34; Thu, 24 May 2018 02:57:48 -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=FdSQTX5P; 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 S968447AbeEXJ4r (ORCPT + 99 others); Thu, 24 May 2018 05:56:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:36526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968435AbeEXJ4l (ORCPT ); Thu, 24 May 2018 05:56:41 -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 40E5120891; Thu, 24 May 2018 09:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155800; bh=FX/rN9zlKpW6SwVpBAD8oYx/smcORpeBuhCDCRjYhvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FdSQTX5PdWg3bAuJox1dgsJfybrwoeSoP2capuXSe7vn4UmqBtwJtAeBEV1ensb8Q /Bu4lImssFTpVBB1uF/HgzHOEtJz00hZjej+q7IyFSTIAikN4hCkNegDRbHZNndGQD KX5Sj83nc5jh38ULNiHBuQpz6+0F7ujjJT5Pi4qo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianchao Wang , Chris Leech , Lee Duncan , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 114/165] scsi: iscsi_tcp: set BDI_CAP_STABLE_WRITES when data digest enabled Date: Thu, 24 May 2018 11:38:40 +0200 Message-Id: <20180524093626.631443000@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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: Jianchao Wang [ Upstream commit 89d0c804392bb962553f23dc4c119d11b6bd1675 ] iscsi tcp will first send out data, then calculate and send data digest. If we don't have BDI_CAP_STABLE_WRITES, the page cache will be written in spite of the on going writeback. Consequently, wrong digest will be got and sent to target. To fix this, set BDI_CAP_STABLE_WRITES when data digest is enabled in iscsi_tcp .slave_configure callback. Signed-off-by: Jianchao Wang Acked-by: Chris Leech Acked-by: Lee Duncan Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/iscsi_tcp.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -952,6 +953,13 @@ static int iscsi_sw_tcp_slave_alloc(stru static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev) { + struct iscsi_sw_tcp_host *tcp_sw_host = iscsi_host_priv(sdev->host); + struct iscsi_session *session = tcp_sw_host->session; + struct iscsi_conn *conn = session->leadconn; + + if (conn->datadgst_en) + sdev->request_queue->backing_dev_info->capabilities + |= BDI_CAP_STABLE_WRITES; blk_queue_bounce_limit(sdev->request_queue, BLK_BOUNCE_ANY); blk_queue_dma_alignment(sdev->request_queue, 0); return 0;