Message ID | 4cc5bcea13db7904174353d08e85157356282a59.1731684329.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 07F26D68BCB for <linux-mm@archiver.kernel.org>; Fri, 15 Nov 2024 15:32:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 910836B00A8; Fri, 15 Nov 2024 10:32:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BF9F6B00A9; Fri, 15 Nov 2024 10:32:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EB2A6B00AA; Fri, 15 Nov 2024 10:32:00 -0500 (EST) 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 488806B00A8 for <linux-mm@kvack.org>; Fri, 15 Nov 2024 10:32:00 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0E86A1418B8 for <linux-mm@kvack.org>; Fri, 15 Nov 2024 15:32:00 +0000 (UTC) X-FDA: 82788719160.11.AD5B703 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf19.hostedemail.com (Postfix) with ESMTP id 36E741A0018 for <linux-mm@kvack.org>; Fri, 15 Nov 2024 15:31:00 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=3f027r1Y; dmarc=none; spf=none (imf19.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.177) smtp.mailfrom=josef@toxicpanda.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731684539; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SVlCssk7TvFYg+mPz0+epJww2XrJywW98H8fNg6oZ9s=; b=xTgA/57RplowbOtCo5pmOtt3Vq3VG8TsSeo5zrhL+lMHkHTHOHeYRM01sIOWqJhR4FUhIV AnmpX46zvLK6imQZ1X2RagYc69m3IaiU2OdBh6JAdUIdTAEnzB5V8gEtKe/8Q4eHIPlPhD 634TMm3k0lEkWtA2L157kqpu/4wbd3c= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=3f027r1Y; dmarc=none; spf=none (imf19.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.177) smtp.mailfrom=josef@toxicpanda.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731684539; a=rsa-sha256; cv=none; b=zquljKG9nKaMvCtc+zvDXbDnmUhI7QMucnC3DLULWuchnAtZhRrRicjAIdWd1KcfPgNjz8 TLgTMpfnRlMp46lDsay4QJlHLAArWpuoQ9U0DGUewqwML54piskXrNbdLx/yqHfqRfwJZd XnJDrNY3rGPOn3y1Flpgi7D+oeZYcwk= Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-6ee55cfa88cso8333567b3.3 for <linux-mm@kvack.org>; Fri, 15 Nov 2024 07:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1731684717; x=1732289517; darn=kvack.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=SVlCssk7TvFYg+mPz0+epJww2XrJywW98H8fNg6oZ9s=; b=3f027r1YLvkwNN9Za4nwGdWHTA7lQ6c9xpqnEPNOMbhbGdqD283t16ODeVs3aIOUZ8 7+EYqFUxpoJXFMOuOMQB9vpiCw0bHznCESBLqHC0ZUCc2kOIKjbbBfjMCxymEHGIEZvL yyJlCLZzDMLk0vzAOG1J6CAECF2AhKmsNlHNXOpNPzWoPOQuJs7RG0IZOKotluRUwMTl hjmrtVxsNDDH7eaaLmUB8IxYjfw9xyisNefOjpkFMVpiA57BPGtJW0au5pwUEbfb2OBF K9Y9wiH1CUUDTAuRTkoicF9athLftg0MYVpO5oTsOOX+82OhoUlHG/mLNR+b9VYAxGb6 A35Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731684717; x=1732289517; 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=SVlCssk7TvFYg+mPz0+epJww2XrJywW98H8fNg6oZ9s=; b=TvHVf4TrlrY2JVpXRc/yHhQp3EQDp5Yg3eOVq9hXfMt5NMVy215z+wgNxZH7/Fzcr6 jONy931DoBPXpPxkunWKvCJ0ITkCQujVkwVNlaDnhOlatITAD2L5MLZLiN2lEKIUB8Iv XC//487Q7VPL/mApVrMzaODHK5BhY7FEdJXlr34imc7GxRGVVQctgPAc/uih1yEwu7a3 zY2AH+o95fRRcn7je7/EjouPs1roozRdKGr88jumwgqoBvYo5iLuWnHj0nj/hfFRQUMY H8rUYMr4txo0lcVFaQG/YmnScM1DrTCJmC4DiKZFPDwEor+N1nNxcoHOqKsOC/vkZaW0 RLsQ== X-Forwarded-Encrypted: i=1; AJvYcCWPDp63esdugcxwhvU6+29y8AVk4wuVYBOxORZyIanrypnSsbifQa0blyYO5b10//DnLJUu744g/w==@kvack.org X-Gm-Message-State: AOJu0YwANWJYN1K/85hMy/qajFjGT8jTT72AySGMd1O8hVXBQmevS0Xq E89ImoKIHE0JaLXkcGOqLz07tf9VOaLz+D9admEDlkJM1yZyB9x/DfumIHntQyc= X-Google-Smtp-Source: AGHT+IHB7s7jP8NWV/O0FcTu86HRGJSs7P0wkOPC0j5cMuO18DrwRH2o+5qB1EsHLQ8UmBf4vwq9wQ== X-Received: by 2002:a05:690c:62c5:b0:6ea:8a23:7673 with SMTP id 00721157ae682-6ee55bbae6amr38804727b3.8.1731684717148; Fri, 15 Nov 2024 07:31:57 -0800 (PST) Received: from localhost (syn-076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6ee44075016sm7768367b3.63.2024.11.15.07.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 07:31:56 -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, viro@zeniv.linux.org.uk, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org Subject: [PATCH v8 18/19] btrfs: disable defrag on pre-content watched files Date: Fri, 15 Nov 2024 10:30:31 -0500 Message-ID: <4cc5bcea13db7904174353d08e85157356282a59.1731684329.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <cover.1731684329.git.josef@toxicpanda.com> References: <cover.1731684329.git.josef@toxicpanda.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 36E741A0018 X-Stat-Signature: sbjgt7pcitn93bj73zo9881wycn83ok4 X-Rspam-User: X-HE-Tag: 1731684660-576702 X-HE-Meta: U2FsdGVkX1/hmFX64LmTWTobZoW82pM2cm65reCKn61Ca5b372GZ0XkckErF7B9ZXukqN6I3bC11pjDXyZvY7ymhJIjOqZwrRkEdRhvHFqi987JGXHVEsjaohGsB5bjRNZ0ZaCfIguUJGqszuising4Bihnb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aWnZrMBRWhdRYMUW6OUxgZ7yiRbO/rs0l8DIXVvqKltzfW7+w9CjPf+E1Su5GxaOPV3WneHzArvi86LIINg30ADPFWGlvI+wnRiS8oWUA4UbH6iOkOLPbT4hAnImm7gUyAFJvbNaLOJqVIB7s/CGLwB0YJggPaMsxbY3b7Qy6GTcUJc5PwTlJ9mDRWoIOpg5WYEtj97jLZYQjCwjoazg6aMbzxyan+/cyDjwOgx+flZGrx+5o= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
fanotify: add pre-content hooks
|
expand
|
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c9302d193187..1e5913f276be 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2635,6 +2635,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(+)