Received: by 10.223.185.116 with SMTP id b49csp2351573wrg; Thu, 15 Feb 2018 10:14:25 -0800 (PST) X-Google-Smtp-Source: AH8x226/CVShIcFpns18LvxTedh/SvsUP0d54ZNPG3+b/Q0olpWcaNUC62lA5pViqchuwhiA41jc X-Received: by 2002:a17:902:8bc5:: with SMTP id r5-v6mr3283341plo.213.1518718465725; Thu, 15 Feb 2018 10:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518718465; cv=none; d=google.com; s=arc-20160816; b=cuQBsqTuT5pjj1rOaA9GpkXrigb2J3EOmd/2CEfoB3BJ+5fwoZOYdN4bifVi2Gc37U y6zbBHfZbXubOQrIuOQ2PDe7qYrY1WYWFgG/s36LD2MlK4Ki8WyEF52Z4BjBl8nnNTWe xEqj/yzmK+oU59wftAM/yAmzox0vT4xeBiEc3VH4mz7sodbsp2MW0+NDhwGK1T5cUFGU p1k7YLRh6Ynzsrd0ezhTBJdVJqiqbu+MffJLAFx0qwqd6BPX/Mpwa5gy7PrjLf1jSX2C JhBpYAdc2p6wrauXisXlRnXhkgb9hl3bXpLDerc1N10wAkAhJA8FnjWZmML4miSm8rjy q8iw== 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=9pJdzQdPeYS287d48gUla4klZOfPZ6A4pRaIiZdW0oI=; b=IyGUHsbQSsIWjsYDnTRlJnB8hp7Ik/Qn5EXrJkciB4+A6/z4EkjMFPYUWrw6f/cs6p qBTNqR4i3s18t2PBhgdRIKzfO9OVQqZyl8dOGP21BFh7y4HtE5xHIhfx5SvQ0ywnhAAg P4QPe+/DgUH6vQPbySItYAU7hkfvtSUQRNb/r6ekrxHXuhQ8MD8n/5cqAfCYdNTdOtgF YbzOH3bM9SQUWALNsfuk8h0ZW+DHO91xEyLpCQHMMV+wUn6FjnL7ZX06f7tqQkY+LrqO +6PIQVtHE2khTsCf6x6R8RmUqHIN5iE0lcKD8Q4Fld1I2+2cOcTwqGgkxKBW58xeOEgF EU9A== 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 g7si128183pgp.442.2018.02.15.10.14.10; Thu, 15 Feb 2018 10:14:25 -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 S1163754AbeBOP2N (ORCPT + 99 others); Thu, 15 Feb 2018 10:28:13 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53744 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163693AbeBOP2J (ORCPT ); Thu, 15 Feb 2018 10:28:09 -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 D11C71028; Thu, 15 Feb 2018 15:28:08 +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.9 24/88] NFS: commit direct writes even if they fail partially Date: Thu, 15 Feb 2018 16:16:51 +0100 Message-Id: <20180215151226.012002344@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.437136975@linuxfoundation.org> References: <20180215151222.437136975@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.9-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 @@ -787,10 +787,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)) {