Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932069AbcCBBvX (ORCPT ); Tue, 1 Mar 2016 20:51:23 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:44579 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754968AbcCAXxo (ORCPT ); Tue, 1 Mar 2016 18:53:44 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=YwjHUApz+eTO+ZKspPoiUhaban1FkoOjCBZenTx3SP4jdkcx0mI7VSjCV+qgaoFGkCS3o4RJqhKp gDTlamCYZmcM6XpUsi1Pa644fecTUei5ZfzlJIgVgXS4ksxoRyQFwSjIB3l+tbNTEgniMaKklblA /KZglYuZ+T7Jvjyu9k8=; From: Greg Kroah-Hartman Subject: [PATCH 3.14 065/130] vfs: Avoid softlockups with sendfile(2) X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Dmitry Vyukov , Jan Kara , Al Viro Message-Id: <20160301234502.108514107@linuxfoundation.org> In-Reply-To: <20160301234459.768886030@linuxfoundation.org> References: <20160301234459.768886030@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.9438de464a9b4f1f990dd21080c39fbd X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:53:32 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1135 Lines: 39 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Kara commit c2489e07c0a71a56fb2c84bc0ee66cddfca7d068 upstream. The following test program from Dmitry can cause softlockups or RCU stalls as it copies 1GB from tmpfs into eventfd and we don't have any scheduling point at that path in sendfile(2) implementation: int r1 = eventfd(0, 0); int r2 = memfd_create("", 0); unsigned long n = 1<<30; fallocate(r2, 0, 0, n); sendfile(r1, r2, 0, n); Add cond_resched() into __splice_from_pipe() to fix the problem. CC: Dmitry Vyukov Signed-off-by: Jan Kara Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/splice.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/splice.c +++ b/fs/splice.c @@ -949,6 +949,7 @@ ssize_t __splice_from_pipe(struct pipe_i splice_from_pipe_begin(sd); do { + cond_resched(); ret = splice_from_pipe_next(pipe, sd); if (ret > 0) ret = splice_from_pipe_feed(pipe, sd, actor);