From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227UyIBpjZHAzJv5J1ifX+h8aiUOS0BbvLbl4QRLwE3wkkNzePvxT/+It6l1+mLRoIMcYBN5 ARC-Seal: i=1; a=rsa-sha256; t=1518709387; cv=none; d=google.com; s=arc-20160816; b=xwGCqhQba9TXBhEOUQkAtn+M1YPKkroizvrxCrxB2c0/B2V2Tcc/gYmhNTSsCu/SQw 1/T1Z3E4Nc8nySqpvnu623t+goaf7AY7DI5Y+aVXfrFmQcrb1Xn8ZTUhtlMGr8x2/KUh rbbTG0+6iqhaVcJfb5MXzJN4gOXaqao4luxY9oXQjyIAjb9AasH9+eKoFofS5vNb1xS6 t85Vv7JG9vFELP20RyvsjVjtSb2SoGO0MKs6ulP50oqf1Z+418ty7PexXzS2nvHvYgxd 0en/aBBfHaRuAFipt3IhN4X3cnyrebfcOdR9LsnfbI1hpKEnsDA+b3QbWzEY9H0CHL/Y sBbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2bRmBzL0WaHKn8vobiK+Ok5qONd5ihODnQqXFVmVLi0=; b=f7cqRke8uegd/gonrCDOIwgsfR7vq+5KQ0AUYMoHDC34uj1MZWhjY76e0kXkWClGmZ TrsNBUDtab89ViWWpGRDwpVzIv6ZgrRgSUdNl6tAC3Wsy04phzCVnDebJ2KUTgSpt1fB FNPAC+Zfp79xezU5GmP7hIyHrn14pzh44nVf2ea5nqfC0DjyEgWvS98D/IA1l9shissK W7S9gf0ymNmiNgSk6PbNpWgOEjZyOblahQYj3qv8n3203yYVBrJSJJ6G4/KgRzJva+9G KPAE37MAo3bSgIFBZsgRCJhtYMRxwxfGEe7TvbeM0UKNGGHrnnNZ1kX09YY4ZOQ63w1G wJIw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1592480730180404338?= X-GMAIL-MSGID: =?utf-8?q?1592482215216301600?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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)) {