Received: by 10.223.185.116 with SMTP id b49csp2299888wrg; Thu, 15 Feb 2018 09:28:23 -0800 (PST) X-Google-Smtp-Source: AH8x225gvFF312Fs4u3XaP4Owb4obsrlH+qUAEnbKJkCdHi3JJMaZCpnDCsjbyrLdocdSVAwzdf2 X-Received: by 2002:a17:902:3381:: with SMTP id b1-v6mr3320309plc.20.1518715703837; Thu, 15 Feb 2018 09:28:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518715703; cv=none; d=google.com; s=arc-20160816; b=Vok2/IZeJTA4MF9D0EUCQx6TXLkj4ZeVqo21wMMZt0eHbyxs1Lo/PPSyFxXt9w03Ws rAxAKuACHTRI9xHlVjoGjRLW2Fc/DI+71viL9qSENf/RHdSNAwaQ85Nzrni05dCytr7P a+piWMltMjuAWPwlu79ZSfqwJVTapN8wwx+FgsfZWxZUkl57N4XwYUVW44uNkg3GemTX TuHFMU5kq3sNEZdddk+KUB2Oa+xWU/zT2tNclLsPxdJSkJW8ZGNiMezPBiHajxlXapC+ Pvd/FVTvT0JVYVEoqpeWn7LUpL8B981VWb0dh13RYSwtRqdXOulWoixVY8ptuGM/+tKD l9Pg== 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=4qFmkgYWEiiQYanUJ8Rwbi3qUjHHc+YSGAr3sIoWLH8=; b=rkweHacCQDXJbFUxiD2An0BognUrPlFNb2YkDd15gkZdbhSL57vNnui+6YMEI28bGS Ez2E54Bgp+qJeJJTYCsXfSlUQJPjHM7g+lJw7TPUG8OPzrIkGAhr/8ad6mK332WR4zz/ 3FWG94EYj6JKGNToU9MD5yytCBB+kltfvdb8bm09f3JCUyj7L1gMZh0G+njLyKu+jpUP bZozJqg/7cGFbz5gUZ+8lXch01mqQI99ox9XGPpyUTj+S9fhPKAnffJ4hYtsclwlrSHB CvlZwXQK91p5iKnyMNVJEaLG9LSufsISTz1tMkLZpENpuCH91F1kdb8EYVaYIW1b5M+M Vw7g== 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 y190si1518752pfy.87.2018.02.15.09.28.09; Thu, 15 Feb 2018 09:28:23 -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 S1165087AbeBOPeY (ORCPT + 99 others); Thu, 15 Feb 2018 10:34:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:57136 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165004AbeBOPeU (ORCPT ); Thu, 15 Feb 2018 10:34:20 -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 9090B10D2; Thu, 15 Feb 2018 15:34:19 +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.14 107/195] NFS: commit direct writes even if they fail partially Date: Thu, 15 Feb 2018 16:16:38 +0100 Message-Id: <20180215151711.045089736@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@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.14-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)) {