Message ID | c46f21bd55082ccf7380d438d82d3ebbaea284f9.1731355931.git.josef@toxicpanda.com |
---|---|
State | Not Applicable |
Headers | show
Return-Path: <SRS0=X1H6=SG=vger.kernel.org=linux-ext4+bounces-5035-patchwork-incoming=ozlabs.org@ozlabs.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=ul3sfdrd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org; envelope-from=srs0=x1h6=sg=vger.kernel.org=linux-ext4+bounces-5035-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XnLmp753pz1xty for <incoming@patchwork.ozlabs.org>; Tue, 12 Nov 2024 07:31:38 +1100 (AEDT) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4XnLmm2Nvyz4wbx for <incoming@patchwork.ozlabs.org>; Tue, 12 Nov 2024 07:31:36 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4XnLmm28x7z4wxx; Tue, 12 Nov 2024 07:31:36 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip=147.75.48.161 arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1731357093; cv=pass; b=n+HTIA2Ap3wzEjey5BSsUK63vJZdYWE2SjJia2Y1hrQIY0w7wnWpDEKdr5gXaNRtmV0sv6tktQKHLqirY+FQQGi+Glw6lYUYIY9TlWUc/BIVSKV8S/3kJwtkXbljBsL+kRBQFbfQqWjaAQIBLP+Vw37TwP+9pUyx6yCjlonF+3aCOekGkQzqu3n4mtjtgYK7S4/LR8eapr/Zjpoql6IpwXFWLBg1fNUA4ikVqP2dbqz324JsbzokeMoOKCA9j8m7pPyb+DUaGyR+ryhXsTxGMEar3YDeSPP/WltFOTYExBNuHYakdATl7Zof9Fp4Rg824Ghoi8z5597d9HFlXRMSdg== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1731357093; c=relaxed/relaxed; bh=qkyyLOcMapxd8eZps50M2cPjgtuAOvBDRyUA+1LsM90=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HXrfCwTg2VsKGx5T/L8ol1Ihd+BCQAB4JKfB3eAIUSITLR6G+GM0jCTOMZ7Eqtpn/up2KapvJ2W8cn5VnxcDjAGOdsjj7mRQr3WZXg9il+zjb6kJ0rk0cQU8GoPZ2S76zj8L4V/glCQzo/5bZXv1kmYRQMYi7h52Oh9qXowxfCRKSJIQjeBngr+rWQ2/wPiHMIep0TsbAjy2sN24xfWbWZGSNofB9A/XlPXOugMsip1SWUmcL3B54fLaiyLApDCZzEoMne77hsiMp7UDamyM9NKYbN2MLCAPovCeis0C6HtwzOJIB2qWs16MMzn1iZv+z7+FK/dkw3S6t5+85DCrAw== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; dkim=pass (2048-bit key; unprotected) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=ul3sfdrd; dkim-atps=neutral; spf=pass (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-ext4+bounces-5035-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=ul3sfdrd; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-ext4+bounces-5035-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4XnLmj1fT5z4wbx for <patchwork-incoming@ozlabs.org>; Tue, 12 Nov 2024 07:31:33 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2A135B2A74D for <patchwork-incoming@ozlabs.org>; Mon, 11 Nov 2024 20:23:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFF151C8FA8; Mon, 11 Nov 2024 20:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="ul3sfdrd" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34ACA1C9B9B for <linux-ext4@vger.kernel.org>; Mon, 11 Nov 2024 20:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731356379; cv=none; b=j5FN4K+TDYtfL5okodOn1YplDKVBLs4Mig31M6jB58MJ1oJG0XGKeCsqy6sVnoNxm8ZtFBXkd9HbdYcWBpNi22fV/kVlXLSQH/7Pj58C08AWoaPEHRvRnLfzVJdsls15I+umto4mHi+qNTDzPKndLMEU2ftuzPoYPLtc4RjjPIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731356379; c=relaxed/simple; bh=g8f8HPGo6FF6bNhCenpptLnEwEhFsJS2XcfOHpq3gpw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=epF6VTgR8vOJT46zlARThqcXIXVYzxQjv1YJN19zxsnecEGhV2+UhR/Q5v+P2OlOXasLaS5i8XkrGx63ks+2i+KKP9QadReTGNz6Z62DK16JG+HP4DeR4Z5rc0zbz0NLf1zHu6oCzJVLiOGD6s8QTT1XlXrNW2nLdtPaG+4Cits= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=none smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b=ul3sfdrd; arc=none smtp.client-ip=209.85.222.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toxicpanda.com Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-7b1434b00a2so388523985a.0 for <linux-ext4@vger.kernel.org>; Mon, 11 Nov 2024 12:19:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1731356377; x=1731961177; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qkyyLOcMapxd8eZps50M2cPjgtuAOvBDRyUA+1LsM90=; b=ul3sfdrdnV34wC5BOw9gEuQZTFZo6RWEaCK/AQr3weUiTVU/eJkPtu9fgqudOsJXnv mZQj0sOAbfHNRFTehmU174vQivZGCUYNwADSJ9qV7Wyw/j3oyq5/gRKmj06ki2wD6JNy 75RkjRTrqTQ/lCnQa22zFxX7asmDSp3503jGvAIce+8FbpLPJ6UB6O/AJPUeLCiV+aCR 7+PZ6R7vOGnkwyTkgTDuCySVK9RNBzQhe5LdYWDiV1Ej1FOBlVtMQwdGy495bC+y56mu 6ZCDJEMlkyjuYiDc5dW7atL7J8aPlLG605AIYviz0sGSZc6jaB8FO3OYgiwfU0pytqqC apdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731356377; x=1731961177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qkyyLOcMapxd8eZps50M2cPjgtuAOvBDRyUA+1LsM90=; b=vUJ9+6LkfqjNxgCiI5Ky0QWBjZLUcfipB3D17SviZtT+E7/iUCGJMTkvDpLvhB+Eki lVxqCdIo5EWrUPEpnoBfoLu+rD4aUC+MZpHB15wZi9Z4p4Wbx6dftXl/Lj0DuV46uLba V022CSg3IdmNrfXfDjKauTiFulU/Y353Rb52sz4dvn7xBBEPPdIaTiNgY3PStdDtWpG9 xQxctWivB40jwMMlyo1OGCFrnzouAzjtdWIEP7IvJ7QzLxeP0KCUy3A/j8znb6PYqnEs Nxbg7yQ0HEqZGyRHUA+jhUpG92Y/ExPiEwm2HtsMVDLcX8aunALE+DVRPB9Y5IZ2hsZ1 z1yQ== X-Forwarded-Encrypted: i=1; AJvYcCVdBW4oQ80p2xuzJx52LuubShxoO0PpCNJmy8y2vMpUfeqzMPNMr24A7tCqyyhm5a3pJ0PIGPCIKQ1k@vger.kernel.org X-Gm-Message-State: AOJu0YxNDkA2ll9IYNItoVfay1HJmqDH1HXEaeyroSdwJYGGoOnVTBB2 GUx5JX3gi8AmECY75pfL94rl14G9+rj/ZHQrG06jht+eD6pMrBdzChAmGgdUFQI= X-Google-Smtp-Source: AGHT+IGjGL9g3kFfcH+6V8KAtQzfg7b48XSPpKvHKYOiM22WInprVkhEgNc7K8iBcMmLd7E6fsLBYg== X-Received: by 2002:a05:620a:19a7:b0:7b1:3e41:849f with SMTP id af79cd13be357-7b331eff745mr2211412185a.47.1731356377090; Mon, 11 Nov 2024 12:19:37 -0800 (PST) Received: from localhost (syn-076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b32acae57asm525455685a.81.2024.11.11.12.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 12:19:36 -0800 (PST) From: Josef Bacik <josef@toxicpanda.com> To: kernel-team@fb.com, linux-fsdevel@vger.kernel.org, jack@suse.cz, amir73il@gmail.com, brauner@kernel.org, torvalds@linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org Subject: [PATCH v6 16/17] btrfs: disable defrag on pre-content watched files Date: Mon, 11 Nov 2024 15:18:05 -0500 Message-ID: <c46f21bd55082ccf7380d438d82d3ebbaea284f9.1731355931.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <cover.1731355931.git.josef@toxicpanda.com> References: <cover.1731355931.git.josef@toxicpanda.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: <linux-ext4.vger.kernel.org> List-Subscribe: <mailto:linux-ext4+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-ext4+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID, DKIM_SIGNED,DKIM_VALID,DMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on gandalf.ozlabs.org |
Series |
fanotify: add pre-content hooks
|
expand
|
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 226c91fe31a7..9b13df1ea729 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2638,6 +2638,15 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) goto out; } + /* + * Don't allow defrag on pre-content watched files, as it could + * populate the page cache with 0's via readahead. + */ + if (fsnotify_file_has_pre_content_watches(file)) { + ret = -EINVAL; + goto out; + } + if (argp) { if (copy_from_user(&range, argp, sizeof(range))) { ret = -EFAULT;
We queue up inodes to be defrag'ed asynchronously, which means we do not have their original file for readahead. This means that the code to skip readahead on pre-content watched files will not run, and we could potentially read in empty pages. Handle this corner case by disabling defrag on files that are currently being watched for pre-content events. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/ioctl.c | 9 +++++++++ 1 file changed, 9 insertions(+)