From patchwork Fri Nov 15 15:30:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13876454 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 2629ED68BC8 for ; Fri, 15 Nov 2024 15:32:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F8396B00A7; Fri, 15 Nov 2024 10:31:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AAC36B00A8; Fri, 15 Nov 2024 10:31:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D53846B00A9; Fri, 15 Nov 2024 10:31: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 B4F956B00A7 for ; Fri, 15 Nov 2024 10:31:58 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5224081931 for ; Fri, 15 Nov 2024 15:31:58 +0000 (UTC) X-FDA: 82788719034.04.C500F01 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf11.hostedemail.com (Postfix) with ESMTP id 2306940007 for ; Fri, 15 Nov 2024 15:30:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=E5DQhheU; dmarc=none; spf=none (imf11.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.179) smtp.mailfrom=josef@toxicpanda.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731684652; a=rsa-sha256; cv=none; b=qW/yJSgdR4TFLCsp2MoChZiD77bJtiGdmKKL1hEg30ASguzKD83YlfkKbJijUSvf3J/2Vi xNyHC+AXDhgQDU/L6u8cFn2jntJQEZjI98Cz9lJKIHlesqnSgZF19tluRBtDlFs6edAfuV K0NX6J8VX0wpU+V6xncyJ5A0oV6nKCQ= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=E5DQhheU; dmarc=none; spf=none (imf11.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.179) smtp.mailfrom=josef@toxicpanda.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731684652; 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=3nbIBZPU5mMiQBH7fH9PUjd6pvpSRIo6Q0oL6vGrX38=; b=3ev7hbtw16YHxDFryoSiBBzt6D62LGs3V5QDHmyMT8L6ufgR/QoV9wYzyAhHqgw7lyZKo+ paEe1YJm4OweiJfAFlkViep+r+sz2ObVfTJ8HejI5eC25UPVVZa9PAZNmJoeqLlQtPtcVH /jo/QdAl9o0HWacUF26mWkSOYEQIiwc= Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-6eb0e90b729so23139647b3.1 for ; Fri, 15 Nov 2024 07:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1731684716; x=1732289516; 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=3nbIBZPU5mMiQBH7fH9PUjd6pvpSRIo6Q0oL6vGrX38=; b=E5DQhheUpQithTlg46jJInks8euxfHE00A0cHs3M4eqM+raO/aubUaQzZT9P24PFVW 0QqBLvSCy75G6m2on0bb0DIzzOn/W0QD5rM8qm8hx8dHy0meIqGkwz9aD1rcsihCPfQl +vWAqFId805NiPOvQ/0e48+XnkbVtZIjf3bYtjMgVQowobWWwDluzT8ZlbzlswDqjvWZ aU5054KdYJDcts+44mE0A37PN2GBlnFX+5/b1nv+JnrqoQrbp5eoiDj+1jikXhKSX+2V ZjLhuqc+Y9IRdu9ywscXQ7IYJPVPd8Bc72WXikhZXr9/GfEedS8x1jJBi5tHDdi87jPx bLhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731684716; x=1732289516; 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=3nbIBZPU5mMiQBH7fH9PUjd6pvpSRIo6Q0oL6vGrX38=; b=nCOHx5UnBE5FdjsqYpAlaXGBTZQOc19U8vY+0H4b+a2iPpX4H0NKcDXUKxZyQ0qfq9 nY5YVbgM3nkfRleoTjDiSliwVXuUUckLv5C4PGTI/0M0OjBWSUMB2i5I+A4E4Y1Sm/P+ MCzHJ7nclw/C37FovAPwZLTYNv+WYZeics7+0vjFeNkFYF4BmvmdwC8QvVQ3l6+ELw9v yYxhnE07t3viIp6OX0Vj7lyfHVhHzY3N5/zgYR2/hqwAbGoLBzTrWkapGTLXNf0QUr2L vRq2FgfrxygwuYnaNVsou8ur0u3wuRs4ynMVnNtsGz6Ro2ngyzALpRYsgbxawxIUFStg Myyg== X-Forwarded-Encrypted: i=1; AJvYcCXEkWjNwZTXkdY9o8p3rlZqdj20p8STqeAu4ylyF93qAc57JKe67KFiqCJ9BDMOnR/SJEazaZgDjg==@kvack.org X-Gm-Message-State: AOJu0YxW41Uk0Dk2X1/ziCBovvWfGtVOliOhOyhPPEuryqT9VR11SMlx JLWffIgAIfNWMPvbHOgALnLzfFPOsBV8xyEYDNGMFpbCIFV3PYFLC6IBAt6leJM= X-Google-Smtp-Source: AGHT+IF2kfSK7avJhhme8jmNEknNmwYth/OIHi/JSJVRuMCWaSMr+rN1yucoeC0+W4HJkwXlrHqqNQ== X-Received: by 2002:a05:690c:688a:b0:6ea:7c46:8c23 with SMTP id 00721157ae682-6ee55ef8021mr42068567b3.35.1731684715691; Fri, 15 Nov 2024 07:31: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-6ee440709dbsm7729117b3.54.2024.11.15.07.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 07:31:55 -0800 (PST) From: Josef Bacik 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 17/19] xfs: add pre-content fsnotify hook for write faults Date: Fri, 15 Nov 2024 10:30:30 -0500 Message-ID: <9eccdf59a65b72f0a1a5e2f2b9bff8eda2d4f2d9.1731684329.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 2306940007 X-Rspamd-Server: rspam01 X-Stat-Signature: jpx8dpad4qz8dwf7r18akgtcgsreb71k X-HE-Tag: 1731684659-578615 X-HE-Meta: U2FsdGVkX18YLxEI6xlndVYliP0yfHp55daCOLGE+sPQIdbyzkWtzC0BPspDf+6MWVSL3f5KcPb2L9RNRDMSp9sQ+en4TQsAYATUi8xAIn6cqKYI2oSz05s/I1ZP8Qa+hTfm9gb6ibGJzaD7qIo8apQgLqzY8rfpNUqbpWlkEPQrob270+TI7HXj6TPJ+qudjAZyNFAJ22H7R3CazjzTtS7v3dKmq7cLAIb7qmnrv7ElxQLAl6xDilD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d56L95BtDU2wqo207lVBDbGWT0YL8GFQBXGT/1/8TMuj1oCZUakE9H2/6CMA385DDmmISOaKK9P9jICSWS40mLhJOJk/QleS9nUkIiOriy1WZN8RE6dsHSwm2F5/61UYPnjb1R3xun4TqouGNe2oh+3wcMooG/vtg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001025, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: xfs has it's own handling for write faults, so we need to add the pre-content fsnotify hook for this case. Reads go through filemap_fault so they're handled properly there. Signed-off-by: Josef Bacik --- fs/xfs/xfs_file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index ca47cae5a40a..4fe89770ecb5 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1458,6 +1458,10 @@ xfs_write_fault( unsigned int lock_mode = XFS_MMAPLOCK_SHARED; vm_fault_t ret; + ret = filemap_fsnotify_fault(vmf); + if (unlikely(ret)) + return ret; + sb_start_pagefault(inode->i_sb); file_update_time(vmf->vma->vm_file);