Received: by 10.223.185.116 with SMTP id b49csp2231070wrg; Thu, 15 Feb 2018 08:27:37 -0800 (PST) X-Google-Smtp-Source: AH8x227YDK2ISJbtcCklxg1sJWuv8/mqA/CjPdHj/ycNUtjRuDJHLh8+f7ux4zJT/fr8H6Ec4q5K X-Received: by 10.99.113.85 with SMTP id b21mr2699362pgn.305.1518712057470; Thu, 15 Feb 2018 08:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518712057; cv=none; d=google.com; s=arc-20160816; b=qmrYvNvxXwkEhoU9FekdAaaY1Av5+5hHVKCaprkaIEHpWJOUBl8HPwkkD58WPyQgXD Nj2l803aBy/vcTaBBLs5H99fVV/qqRxLtfF7qi0yhZfn2DLzd9sx0zZ05rIX7BWntA7K 5VGjGQo4IhCkQQidOKxG9cS5lCG7U/h3fL+svKlAse7+uucH/Go+WWACJ5lPSao7m+Kr f4ueLgLACTBzeqpzPR5/ZBqSa9daTUi7AJI+XP6Ms85GAgHBxIIKxYYDJuUmyt2oh7rP gm+xTbjMdlaX1WyUg8I/V4ERR9KpVIfUvvHDCoycuqpNZVkv5bxCahHq1TA23pZex/uh XiLA== 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 :arc-authentication-results; bh=2bRmBzL0WaHKn8vobiK+Ok5qONd5ihODnQqXFVmVLi0=; b=AyZuC4VhWJRE6VtqX+7kyVsepMHNX/2qEIdnCV4mFtmo1WlOQ+mBhW/Yzn+5fbT8KA Vm6U77+TGfCiwey00qWR40iu6C/gELMJZbtoVQPKL0Tc9FRqjK0dTcNLK4oJyvZIk6ex Qj9BavtyW17fns3iVT24tJRwzXmMJPBd1rdX3YEqs8pNbcLugXjhYmUKW4ptAxVfBXnw g0wPe3isrF6O4GnNnKfWAvUV7xOLkDoa06bzH/otulvwjV/yCvaeDpl5Fd8LmBgBQbel ZJWHLSbQkaTzuv6+a6z5Iduj768dJzgh1ckv8BhO+St4CDO3HnS7ZgjxNdUwxUb3xBMd GWmw== 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 u2si215630pgc.321.2018.02.15.08.27.22; Thu, 15 Feb 2018 08:27:37 -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 S1425862AbeBOQ0T (ORCPT + 99 others); Thu, 15 Feb 2018 11:26:19 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33824 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033695AbeBOPnG (ORCPT ); Thu, 15 Feb 2018 10:43:06 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 347991156; Thu, 15 Feb 2018 15:43:06 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "J. Bruce Fields" , Trond Myklebust Subject: [PATCH 4.15 100/202] NFS: commit direct writes even if they fail partially Date: Thu, 15 Feb 2018 16:16:40 +0100 Message-Id: <20180215151718.558528669@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: J. Bruce Fields commit 1b8d97b0a837beaf48a8449955b52c650a7114b4 upstream. If some of the WRITE calls making up an O_DIRECT write syscall fail, we neglect to commit, even if some of the WRITEs succeed. We also depend on the commit code to free the reference count on the nfs_page taken in the "if (request_commit)" case at the end of nfs_direct_write_completion(). The problem was originally noticed because ENOSPC's encountered partway through a write would result in a closed file being sillyrenamed when it should have been unlinked. Signed-off-by: J. Bruce Fields Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/direct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -775,10 +775,8 @@ static void nfs_direct_write_completion( spin_lock(&dreq->lock); - if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) { - dreq->flags = 0; + if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) dreq->error = hdr->error; - } if (dreq->error == 0) { nfs_direct_good_bytes(dreq, hdr); if (nfs_write_need_commit(hdr)) {