From patchwork Sat May 20 00:00:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13249001 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBFCFC7EE2A for ; Sat, 20 May 2023 00:02:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86538900003; Fri, 19 May 2023 20:02:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EF8C280001; Fri, 19 May 2023 20:02:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64102900004; Fri, 19 May 2023 20:02:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 50A88900003 for ; Fri, 19 May 2023 20:02:06 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1CE601A0B75 for ; Sat, 20 May 2023 00:02:06 +0000 (UTC) X-FDA: 80808680652.22.503D3DD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 6F67740002 for ; Sat, 20 May 2023 00:02:04 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XsZpY2s+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684540924; a=rsa-sha256; cv=none; b=Bkhk0DcjzfhTEaZJ2ijf66pmvUWeQgmfIERRn+guwpJlBQFSFYCv2/ybAIAfciw89L5jqE JPnnW7Z6y9GgeACK4A9jgLFbTsL31RdSgPjwT3jK0GdeH53rViW6qh25kIGy1FX44EmULb cG5mA9RABLoWsrCRgwwf5eKOVgyawdg= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XsZpY2s+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684540924; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6eCSJNH8vHFST21uMhvhB9UZGjvTsMZCtNRoglPFw+I=; b=tv+l42KcVi9nt6qw58FnaGq/B5Oroib7qnoxJwY9Lj0ucfq7HVTQfyJv0l5rTBJCYzSn4o olhy93BEOHAPBqh2+GSEAKybquZ63dZ0Ro+XHwY2waNI3aJGcJIzkWIw6n+ghbLXRqS7Oa qnZfIeNXnp9LaazOMblUYfONAq4uWHk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540923; 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=6eCSJNH8vHFST21uMhvhB9UZGjvTsMZCtNRoglPFw+I=; b=XsZpY2s+bYCk7gTkC0L1myawAtQ9tysgTggM3ayY18SwlMAc2t/Tyk3li6obc7Byu/0MGH K3mKslobLEy+9B+YUERW+LBwL3XK+MaKP+G8A7tBFKyIkAbBv/ejInEONNRscpEyHyDdu5 EynGHrGsUxg21o23l/o7l0i9wN5bYK4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-Vi3VpzDTNn22brcNxkPP8Q-1; Fri, 19 May 2023 20:02:00 -0400 X-MC-Unique: Vi3VpzDTNn22brcNxkPP8Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A4411C05AEB; Sat, 20 May 2023 00:01:59 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C7A94F2DE2; Sat, 20 May 2023 00:01:56 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , Konstantin Komarov , ntfs3@lists.linux.dev Subject: [PATCH v21 21/30] ntfs3: Provide a splice-read stub Date: Sat, 20 May 2023 01:00:40 +0100 Message-Id: <20230520000049.2226926-22-dhowells@redhat.com> In-Reply-To: <20230520000049.2226926-1-dhowells@redhat.com> References: <20230520000049.2226926-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6F67740002 X-Stat-Signature: jntbxseyykhhuatf8fpdq5qs33agpjaa X-HE-Tag: 1684540924-74011 X-HE-Meta: U2FsdGVkX1+vbZzC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1cZt6LRNuJhLH+8Dbt37l68P4RBwFmrxpaet1t/UDgD+nipLOupVv/+wXy0GiSgMdYeNCc+SzdyxW9QKkUH/ebJFuSds4711FDvtZh3X9cvtJVjrhN3c8+rY5CoBS6Iq6NN4BUuvr+s68V2iekCMl5DF3mkzKcKZWLDEdJeVTSftQHEvIu9RHOTJyZ5GltBRHyilzxUbrUD1jWBPGTIm3mtIUMRRHrbgbZeX0FPt29pBbmvsjsJ0n/FCrKrq8d511aVMsBf1RZLvT5wfKzDdB+noCr2SqfdqODAtkXuFUvv+VndoVrXUaA6EszIhj6E8IaAP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Provide a splice_read stub for NTFS3 to perform various checks before allowing the operation to proceed. Signed-off-by: David Howells cc: Christoph Hellwig cc: Al Viro cc: Jens Axboe cc: Konstantin Komarov cc: ntfs3@lists.linux.dev cc: linux-fsdevel@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org --- fs/ntfs3/file.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 9a3d55c367d9..667c9dc68b58 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -744,6 +744,35 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) return generic_file_read_iter(iocb, iter); } +static ssize_t ntfs_file_splice_read(struct file *in, loff_t *ppos, + struct pipe_inode_info *pipe, + size_t len, unsigned int flags) +{ + struct inode *inode = in->f_mapping->host; + struct ntfs_inode *ni = ntfs_i(inode); + + if (is_encrypted(ni)) { + ntfs_inode_warn(inode, "encrypted i/o not supported"); + return -EOPNOTSUPP; + } + +#ifndef CONFIG_NTFS3_LZX_XPRESS + if (ni->ni_flags & NI_FLAG_COMPRESSED_MASK) { + ntfs_inode_warn( + inode, + "activate CONFIG_NTFS3_LZX_XPRESS to read external compressed files"); + return -EOPNOTSUPP; + } +#endif + + if (is_dedup(ni)) { + ntfs_inode_warn(inode, "read deduplicated not supported"); + return -EOPNOTSUPP; + } + + return generic_file_splice_read(in, ppos, pipe, len, flags); +} + /* * ntfs_get_frame_pages * @@ -1159,7 +1188,7 @@ const struct file_operations ntfs_file_operations = { #ifdef CONFIG_COMPAT .compat_ioctl = ntfs_compat_ioctl, #endif - .splice_read = generic_file_splice_read, + .splice_read = ntfs_file_splice_read, .mmap = ntfs_file_mmap, .open = ntfs_file_open, .fsync = generic_file_fsync,