From patchwork Fri Feb 10 15:32:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 13135930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD915C64EC4 for ; Fri, 10 Feb 2023 15:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232787AbjBJPdw (ORCPT ); Fri, 10 Feb 2023 10:33:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232366AbjBJPdv (ORCPT ); Fri, 10 Feb 2023 10:33:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F174BB9D for ; Fri, 10 Feb 2023 07:33:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676043179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uj7Rv4KeEREhQreSkWBQhCSYBs5N5QoJeDQDwyenPI4=; b=hYz7EH+0pULVIREyzApOMY5VVlQHcBBAkOaT2AkZOnw41AGxF9W3/NYmAGfriYCs5aCD8/ yNs6gRaubgevCAw/bR0RESQMvRB1Har2AEkjhvg9+YFYsr07nH0iWibIeifrg/oG+r/xOO dEgYhzjw2Ip+b+I3UPqxSGzQBdXztes= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-2NAH9aGyPMmisW9aHU-23Q-1; Fri, 10 Feb 2023 10:32:53 -0500 X-MC-Unique: 2NAH9aGyPMmisW9aHU-23Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE39B85A5A3; Fri, 10 Feb 2023 15:32:52 +0000 (UTC) Received: from localhost (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACBAF1121315; Fri, 10 Feb 2023 15:32:50 +0000 (UTC) From: Ming Lei To: Jens Axboe , io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro Cc: Stefan Hajnoczi , Miklos Szeredi , Bernd Schubert , Nitesh Shetty , Christoph Hellwig , Ziyang Zhang , Ming Lei Subject: [PATCH 2/4] fs/splice: allow to ignore signal in __splice_from_pipe Date: Fri, 10 Feb 2023 23:32:10 +0800 Message-Id: <20230210153212.733006-3-ming.lei@redhat.com> In-Reply-To: <20230210153212.733006-1-ming.lei@redhat.com> References: <20230210153212.733006-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org __splice_from_pipe() is used for splice data from pipe, and the actor could be simply grabbing pages, so if the caller can confirm this actor won't block, it isn't necessary to return -ERESTARTSYS. Signed-off-by: Ming Lei --- fs/splice.c | 4 ++-- include/linux/splice.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index c4770e1644cc..a8dc46db1045 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -471,7 +471,7 @@ static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_des * Check for signal early to make process killable when there are * always buffers available */ - if (signal_pending(current)) + if (signal_pending(current) && !sd->ignore_sig) return -ERESTARTSYS; repeat: @@ -485,7 +485,7 @@ static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_des if (sd->flags & SPLICE_F_NONBLOCK) return -EAGAIN; - if (signal_pending(current)) + if (signal_pending(current) && !sd->ignore_sig) return -ERESTARTSYS; if (sd->need_wakeup) { diff --git a/include/linux/splice.h b/include/linux/splice.h index 98c471fd918d..89e0a0f8b471 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h @@ -64,6 +64,7 @@ struct splice_desc { loff_t *opos; /* sendfile: output position */ size_t num_spliced; /* number of bytes already spliced */ bool need_wakeup; /* need to wake up writer */ + bool ignore_sig; }; struct partial_page {