Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp454284imj; Sat, 16 Feb 2019 04:12:06 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib4gTsGJd5f4um57YDGYF51ZolAwsCSvs3V75UMGhGWHh9f7oA5ytppJS9WjgPe4jzClOvJ X-Received: by 2002:a63:1616:: with SMTP id w22mr9714027pgl.200.1550319126411; Sat, 16 Feb 2019 04:12:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550319126; cv=none; d=google.com; s=arc-20160816; b=mVAcYTz7Fxln8dI0NUalEV9lhaK/ah56tiAgsRurHVMoM4ZEKLnDBykaH948KHxwMO W4sQ3Ogx0/zPpBrkFXkeS6qeSv6C4X+Im/Utd4CLxXVzsHVHKG1Tepe488zs8aWNqob9 4qc5Z1TOuy7Su3viE3LArrLvYnK4C17LjEfck2bQalgCXkGGIEPA4MCmsX9WwbRV2bML nhbXaJVV6gvJI/B7DRldADlskeyHUKPoXEfR8CW2B89po+gC1qojilxEBOA7k8oIw4gF /ioNhQz3flJeuFr6IjUG+kKyAXnGw0Pcg4fH0hRlRCP0+Wp6utC/1gNeiILnlHiYgO4K t4Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=lVQx2CgeobYSRslPBeoe4jwzO6pmRMvtNpMvHREN6qA=; b=UzHJSaXgMlfbnS4DJeTdzVEnP6MolDKEhQ8IBIfaRLPj5Ls/AgdT79pGTivnt/dOEb YssHAJwEVB8jZp8yoVd1JBSNWXQ6lDooQCVb6tSKRwv52DMj1/pQH/ytcX7ioa0Pr77E nRUpNRrjVpfwJTvQW4PrlKZ6kjYkj1g/ZVacYFs92SU8COdZjZbkhQtlGVJUGSdkF7xo AiKMWX6HUZ0DviCVKqKev4gD01iKmW6nMU0lIlZVT7DQUdWC52P0RJjg33hw6rlsqcN9 hoPH8sAotvi3rrBA/OKQufS8O/SmZ7pVuLfNGL2pPLmbOyOUm9ZbwZANXBT/DhmGEbRK NpRw== ARC-Authentication-Results: i=1; mx.google.com; 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 v6si7291393pgs.206.2019.02.16.04.11.48; Sat, 16 Feb 2019 04:12:06 -0800 (PST) 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; 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 S1730122AbfBPIoA (ORCPT + 99 others); Sat, 16 Feb 2019 03:44:00 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:3220 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726308AbfBPIoA (ORCPT ); Sat, 16 Feb 2019 03:44:00 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D380E8BFB94C3C197C46; Sat, 16 Feb 2019 16:43:52 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.408.0; Sat, 16 Feb 2019 16:43:50 +0800 Subject: Re: [PATCH] ata: fix a race condition when internal cmd time out To: Sergei Shtylyov , , , , References: <20190216034257.30226-1-yanaijie@huawei.com> <63bc665b-4f5f-0845-9767-825925ead80a@cogentembedded.com> From: Jason Yan Message-ID: <98d269d2-da80-fdd4-13c3-84e2868c05d3@huawei.com> Date: Sat, 16 Feb 2019 16:43:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <63bc665b-4f5f-0845-9767-825925ead80a@cogentembedded.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.96.203] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Sergei Thanks for the review. On 2019/2/16 15:45, Sergei Shtylyov wrote: > Hello! > > On 16.02.2019 6:42, Jason Yan wrote: > >> For internal cmds, we will unmap DMA memory associated with the cmd >> before we abort the cmd. If DMA transfering data before the aborting, > >    Transferring. > >> bus error will occured. > >    Occur. > >> ata_exec_internal_sg >>    ->ata_port_freeze if timeout >>      ->ata_qc_complete >>        ->ata_sg_clean >>                                        dma transfering data = bus error >>    ->ap->ops->post_internal_cmd >>      ->sas_ata_post_internal >>        ->sas_ata_internal_abort >>          ->abort the cmd >> >> Fix this by move post_internal_cmd() before unmapping the DMA memory > >    Moving. > >> when time out. Notice that we have to set ATA_QCFLAG_FAILED flag before >> calling post_internal_cmd() so that the aborting will work. >> >> Reported-by: luojian >> Signed-off-by: Jason Yan > [...] > > MBR, Sergei > >