From patchwork Fri Apr 29 12:49:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 8981001 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ADED4BF29F for ; Fri, 29 Apr 2016 12:49:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B741F201DD for ; Fri, 29 Apr 2016 12:49:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C8EE2015A for ; Fri, 29 Apr 2016 12:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbcD2Mte (ORCPT ); Fri, 29 Apr 2016 08:49:34 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:36493 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbcD2Mtd (ORCPT ); Fri, 29 Apr 2016 08:49:33 -0400 Received: by mail-oi0-f45.google.com with SMTP id x201so117015204oif.3 for ; Fri, 29 Apr 2016 05:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=/9FihENR14+q8MB3w1cEpPZcmsDBvMxoUpLQJBijKqg=; b=QNIEAWIF0UzYzDyHuXi09bbolTGTv0SFQxtoAMTKWxYR3wfVbQzUkM57tVQthZtCV8 mRVY/lEFXtFP6CIuqQTUJsrvE2Q+D8q6t3rVwcZAOROph34Nzacj5r1RIW4f5QGnYNpw YVliehDBxmra4/qJll2fAj2IisNLOVFC6u6+xF4BmTAbFM7qahwh98Th0QSwUIlQAC+Y +WAkaTefqbDlpq6h/tvw5l0rTQy1Z0Tf3VfnWbC3HDxUDGRIy3HvVhDe/rOZ7fujVcSF ntyLczgDwlnmfmqGXe0kVxA2IOm6AvgfAIZk73Cfti6QD6vkm85F0ZJQ0I2x0n/J9paW ccAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=/9FihENR14+q8MB3w1cEpPZcmsDBvMxoUpLQJBijKqg=; b=PF+ZXHN8qPIeHM116vgVvX1BN3Y1tXYS/4/vL0EB0wHAp+yIMwE4Y5vWvW3Rq4WFEt AwrYD+DaZuLxBpzUzEd7+dBVfiAbmINItuy4XKvJ+UMGF4rQTGNg0AzmpCdJQCKdT85v T0o9Flx4UCLbTr9jwSBzKdVkNZQ6S0jGBpdEfX+mE72f5qITz7OQfDDS8sv/y0VNJRFV uR1jrzAcJyEreNFGHqfp+3xuh/TnajYznsFPwN4Anya9L1yFbYrI2WJvXSGlTow7L70O SDJClQa3xAD472lF+lqTS5fE/VHJsdnQCwfRk1HhZFq1KbfBvNMicSEQ0Q0RHn+QvmpU /NBA== X-Gm-Message-State: AOPr4FXnxHMODzyffm+O+2vfsvDTvP+TJlOBiC5efklydUmN26N5Ml7ifqGIzbwMrY6JMQ6EjppxXFMyN3ikTxCu X-Received: by 10.202.2.79 with SMTP id 76mr9488311oic.108.1461934172687; Fri, 29 Apr 2016 05:49:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.87.5 with HTTP; Fri, 29 Apr 2016 05:49:13 -0700 (PDT) From: Jinpu Wang Date: Fri, 29 Apr 2016 14:49:13 +0200 Message-ID: Subject: [PATCHv2]sd: Don't treat succeeded SYNC as error To: "Martin K. Petersen" , "James E.J. Bottomley" , Christoph Hellwig , linux-scsi@vger.kernel.org, Sebastian Parschauer , Bart Van Assche Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, all We hit IO error on fsync, it turns out was because sd treat succeeded SYNC as error. From what I checked in SBC spec there is no indication we should fail IO in this case, so we create this patch. Best Regards, Jack Wang v2: No change on patch itself, only resend in body as suggested by Bart, still keep the attachment in case mail client break the format. From 5d1f72d9643ce61cd9f3d312377378c43f171d0c Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 25 Apr 2016 12:05:22 +0200 Subject: [PATCH] sd: Don't treat succeeded SYNC as error We hit IO error in our production on multipath devices during resize device on target side, the problem turns out sd driver passes up as IO error when sense data is UNIT_ATTENTION and ASC && ASCQ indicate Capacity data has changed, even storage side sync the data properly. In order to fix this check in sd_done, report success if condition matches. Sebastian Parschauer report/analyze the bug here: https://sourceforge.net/p/scst/mailman/message/34953416/ Signed-off-by: Sebastian Parschauer Signed-off-by: Jack Wang --- drivers/scsi/sd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) From 5d1f72d9643ce61cd9f3d312377378c43f171d0c Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 25 Apr 2016 12:05:22 +0200 Subject: [PATCH] sd: Don't treat succeeded SYNC as error We hit IO error in our production on multipath devices during resize device on target side, the problem turns out sd driver passes up as IO error when sense data is UNIT_ATTENTION and ASC && ASCQ indicate Capacity data has changed, even storage side sync the data properly. In order to fix this check in sd_done, report success if condition matches. Sebastian Parschauer report/analyze the bug here: https://sourceforge.net/p/scst/mailman/message/34953416/ Signed-off-by: Sebastian Parschauer Signed-off-by: Jack Wang --- drivers/scsi/sd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5a5457a..e9bfe01 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1833,6 +1833,19 @@ static int sd_done(struct scsi_cmnd *SCpnt) } } break; + case UNIT_ATTENTION: + /* Capacity data has changed */ + if (sshdr.asc == 0x2a && sshdr.ascq == 0x09) { + switch (op) { + /* don't treat succeeded fsync() as error */ + case SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE_16: + if (good_bytes == scsi_bufflen(SCpnt)) + SCpnt->result = 0; + break; + } + } + break; default: break; } -- 1.9.1