Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2268146imm; Thu, 7 Jun 2018 07:59:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI04+wxcpLTCOEBPaJU9eBfA6fAN+0aiULLS8gLXQrNVHR4jM0jOerHWA5DC4bj1tDyC1a8 X-Received: by 2002:a62:6141:: with SMTP id v62-v6mr564206pfb.197.1528383577864; Thu, 07 Jun 2018 07:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528383577; cv=none; d=google.com; s=arc-20160816; b=QbEfYr6E0bki3RWQavOD94jyc3QRYBKYm1VT4CZhqjiIT8ZoEG3hVg+57xxwtUCwFl +6sYnC4OqMHha1lLfAaakDs17jr2Mp3kAPalHhNPKjjIlsnHMpZY9QafnU3HeYcu8XAg Z6bQKoz4jdItR0vzM64tCAlkKBas9OdcT9b88jj7QpBF6ZLpaW6Tht2V4Sq0EY76baE9 8YOc3v9jCF74tiINpZvpbFgGbk7Nax0BEO3xkPoRH5qkFK1CLQuE8NW/oB53eBkixFzq ClXU6W9uLGvl2kmdCtIi2f+fTkbQPwysf7Lcwwwz8zfYn9hA1A/VTztO/0rn2jDGNFpB TWGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=1Cvxvc6Eyc0jkBGIhd13F2V47LXH4yeIe58ItlyrgnQ=; b=Iio89yR5YIaspOwnDlentI6cJJcoddiQYcKlsEwF8N4oY/M/P5xV3hbDAaloXuxGu+ P0oD9jd9tAeOVpxHG9381kW+FrbrflaAOFr5v03+64jU/LuskE5lqSmE58uCjif5bj2+ 2pU/RQWX9GakQ+BU5TUC/e5RwjTKmvcOwrDRVjwT6RehvKHPcgMW99F3PYh2DB7dn2B+ Ev4dR/MZn0ptwhu7skRvBqGQQFmbWyWszQGmLLjSEN7nN3/jrkMHTnlRSdJ1fJvq+Fou YrAJxVhZlq3Z1GuOpeAbqSmopKDtgnILXbDwT2W91M0J6wB6lnlhiscHwjcWwWF9n7Va OPeQ== 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 z70-v6si14204151pfi.7.2018.06.07.07.59.23; Thu, 07 Jun 2018 07:59:37 -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; 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 S935444AbeFGO6G (ORCPT + 99 others); Thu, 7 Jun 2018 10:58:06 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41153 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935342AbeFGO6E (ORCPT ); Thu, 7 Jun 2018 10:58:04 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbo-0005a0-DI; Thu, 07 Jun 2018 15:09:48 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb2-0002sL-UF; Thu, 07 Jun 2018 15:09:00 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "J. Bruce Fields" , "Trond Myklebust" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 137/410] NFS: commit direct writes even if they fail partially In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 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 [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- fs/nfs/direct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -732,10 +732,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) bit = NFS_IOHDR_ERROR; else {