Message ID | 6d9ff819edb6df5583844c26169dc6ddd471316d.1731433903.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 786DFD42BBE for <linux-mm@archiver.kernel.org>; Tue, 12 Nov 2024 17:57:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8DC26B008C; Tue, 12 Nov 2024 12:56:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A3EE26B009A; Tue, 12 Nov 2024 12:56:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 891A46B00A8; Tue, 12 Nov 2024 12:56:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 691586B008C for <linux-mm@kvack.org>; Tue, 12 Nov 2024 12:56:58 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1AB44A04C8 for <linux-mm@kvack.org>; Tue, 12 Nov 2024 17:56:58 +0000 (UTC) X-FDA: 82778197614.26.B552D75 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf08.hostedemail.com (Postfix) with ESMTP id 50E14160023 for <linux-mm@kvack.org>; Tue, 12 Nov 2024 17:56:28 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=zZSSzkk0; dmarc=none; spf=none (imf08.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.219.178) smtp.mailfrom=josef@toxicpanda.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731434087; a=rsa-sha256; cv=none; b=S8CP98wSSvGUUlkdcP1RfAStDgB3mqJwz7axlDmzl0LPep8lUxa9L496IMXGPtfgdo+ZSs SrbWhNMu557JL292QFmZAeQ8fPfCvkE0FScfLdLsD1yafzOKzDXYe1NYzku/CpYLximv9Y dUvNly7houk2ylnMns02htG5NDwtWyI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=zZSSzkk0; dmarc=none; spf=none (imf08.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.219.178) smtp.mailfrom=josef@toxicpanda.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731434087; 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=YwypNS/K18MG/TpUiYWFoVqFs+SWJJ3JH1rz09dIOivUGP9kcEZQv3f0g+5n8VNnK8p0yN pPWC7dpt1EnI80Sr0mKQVQNFsn55V8CCBeX+Ii/sivyrk6/rnUawQ4I1TCVnHgYghOyvE1 z3pZgJhA1TQZ0OfIivSItyq7euaeyk0= Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-e28fe3b02ffso5573194276.3 for <linux-mm@kvack.org>; Tue, 12 Nov 2024 09:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1731434215; x=1732039015; 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=zZSSzkk0Grcm/IFRvEAkFDtiId72dPtMFvy1WqGRL3mKFx+wqYM7IjYt/qBgXZHXqv H+6KKXH6OHycS4edRI09xItWd69pIH4/RiYaS5rX0enckro04tUX67s4/qJ0BVS0BRMN ck6WwomC6v1Q9h0HZn+ewlPH8s46kJOyvd26epeuaCiIOk7j+JwnW34BoR7J0mSwi0BL FyNqQT/Q3h0xxPOdERgdJoUbHalWAqRnH8Ne2jms0vY8o7OLFyCDxl515EKRY1m3YiJO Z9DWmAwC1VsC1pNNjVut7b9mmc9Z1/lwZ7J9tF3bWi3No7otqYVrtlHOMnKXj2/uSL3q yNnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731434215; x=1732039015; 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=Z0FnBceVETtGsRTTgk1BZapvRP4Zi5rlgtBdUjhnCWEaCM7c3SuF4w7FmwKN/i7KfU +el/K1dufDiw4aABShwWEHhiQ+wOQxDJvyEiAfuciIojiJz25CP/RxT1i9+88622mX+e sTFn0OeHZY3H7zTDpzV8T99jnq/Hzl9Di2/qb9hZoGYjXtorxec6OY2CwzjnZM/m6HE5 /Al0UdIfbChY1v27OHSkups6e9eXY46RoES1gkdSWwQF7Xp+hQaxd539Uv2Z5f2frjMs mMyWobeMt2p56FSRrgEgHy0vxGVu+Y3LxxHlBey1rJoz9EKJgwRTbnOMC7lfMm1NtqhU Wq/g== X-Forwarded-Encrypted: i=1; AJvYcCWs2KzwVIxnt+rqAIVpSYkdYKZdCdixkhdgRQnT2hqUBQ6TeowMZyxd2bJmYs+nRp2mFuQ8XcUilg==@kvack.org X-Gm-Message-State: AOJu0YwKL841qVweo8PtViWlxFElHKoeyXuLjTwbBtuq+59eN/2MfMSC nfGp+WnISVl0qgAfaZ/pTbJ5qYmVYwd3gD2X90gdtHdG7Skse6Nzk+jkob30Agk= X-Google-Smtp-Source: AGHT+IHRWQQqMmmNmJOTp/8rWDSoFWHv3EcV7+6jsx99WLy4Go67YPaRFk01hHzbJnpPfWcpjoX+9Q== X-Received: by 2002:a05:690c:7448:b0:6dd:e837:3596 with SMTP id 00721157ae682-6eaddd9703amr170632707b3.14.1731434215357; Tue, 12 Nov 2024 09:56:55 -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-6eace8f0c5dsm26584767b3.41.2024.11.12.09.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:56:54 -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 v7 17/18] btrfs: disable defrag on pre-content watched files Date: Tue, 12 Nov 2024 12:55:32 -0500 Message-ID: <6d9ff819edb6df5583844c26169dc6ddd471316d.1731433903.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <cover.1731433903.git.josef@toxicpanda.com> References: <cover.1731433903.git.josef@toxicpanda.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 50E14160023 X-Stat-Signature: 3qpeoj1ondrn8omj3aaigqh9nrwzse4u X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731434188-78179 X-HE-Meta: U2FsdGVkX19hCA7C6y3XPfQP8eTDDyAgODsW4pGSd3FXMfGiRhza8Ct9TltDUZ0q2aCH67x8/ywVS3Q678/E0lKa3sWpgI5ZgUNTYEI7eGi6JpzrVR2HlaAPD67tpBSFjIdN+lfOwLzW+h4+2H6dyJ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MDJMGkdoFbxHs1VOOKP/VssD24oABqZFrn4iTjZHi2K0PA0UJiVdznJDEgrCJkV1hT6gjbJELT4DezPAHDgkvAEtmFk2w1fz12x2WzLW1YnMtL2c/pGJaPpIv4COuJVd71KDDY6oXg5HkPwduau1SHoMCNBtqjN65rmgwOo2Kg+dDldn7qhDuZoRjLnnDnttnIDNrXinPs9yAWqUnti9DwfCZyc8aCIeWfn6Olr68gtA3B/Jic32OhqA2MUgKoiTGTZJZ5ZElXwBc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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(+)