From patchwork Wed Sep 4 20:28:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13791370 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 DEF2CCD4F24 for ; Wed, 4 Sep 2024 20:30:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AD6C6B009B; Wed, 4 Sep 2024 16:29:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 629C76B00B6; Wed, 4 Sep 2024 16:29:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A51A6B00C6; Wed, 4 Sep 2024 16:29:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 222BB6B009B for ; Wed, 4 Sep 2024 16:29:44 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D59BE1C42CD for ; Wed, 4 Sep 2024 20:29:43 +0000 (UTC) X-FDA: 82528196646.03.52904E2 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by imf20.hostedemail.com (Postfix) with ESMTP id 19E351C0009 for ; Wed, 4 Sep 2024 20:29:41 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=jznI1wXQ; spf=none (imf20.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.167.173) smtp.mailfrom=josef@toxicpanda.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725481733; a=rsa-sha256; cv=none; b=fjTJNIspLGr3HxgtmouxIoAuq0IwKOmhStt9R2FrhbKkIPNUnl3VR+Q1/YVzboCw53kzkQ CbU1Maw8MTdLfmUdESrhfGbJl7WWCRm5w5kOiPH4XpzlEFLbZSIKYB0i0yWMkes2VR1dib 2HSqp+vkE5fPHDHiSjk3Gc4Nl5jWYRE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=jznI1wXQ; spf=none (imf20.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.167.173) smtp.mailfrom=josef@toxicpanda.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725481733; 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=8Z8sRCIfMieTISA3wuOPUcg1dm1vDp7n73Jg7OelYjY=; b=D8Lol0cChMvIWd6TVLyJ6JJ38E/APzTkjutXamQRS1Wca+cpn2BF13eL/5CWe/NYJ+xJWV EBWfP484lgSwQX22Si0YRkOqH9ikgZEbFms5sakBSqbrK2FcMitKLjRyXJla8ORntXVXEu wCAR88LdWjnH7fNaaBD/tyi7BOZLqP8= Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3df0ad9c791so4233174b6e.1 for ; Wed, 04 Sep 2024 13:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1725481781; x=1726086581; 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=8Z8sRCIfMieTISA3wuOPUcg1dm1vDp7n73Jg7OelYjY=; b=jznI1wXQMssp6xgR5joz02j7Z3nHcNrR6jE/KyZn0+nW2s4i5pZh/L2g6yvBBSk7cQ uJCo0Ay4zkysPiNNSaKUSRNbOzS9hjBv5XlBqx+ejmZx4WzV5JIA14Jafwg9h8JS2cml lHKGUqNqu6salp2NpiJQtUlw49QAS2EFeTbWT+1hcfJG92v3hzCKyLzb3rGZbA7Hn/TZ lMVlNvjrXDcv5eZAr/cyMmmjixnStl4gi/9bLKJlMVQla2ueefKbdOY8bG+4QOjG5bxF bU7jN3e57C81q/hwEDJDPLAhhDtLUKIntwtTXlUAOtDVml+q5RdWo8VjHwslM3Y5ps1X eYgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725481781; x=1726086581; 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=8Z8sRCIfMieTISA3wuOPUcg1dm1vDp7n73Jg7OelYjY=; b=ed4k/LuJy9hayABWxFWlQ1QZ35/1sQZxDQSh/vmdMbd2qm/uDh8AgOYahhCZQoySKA FDvuvLogad1NJKZd9WnJ2BDuc1VKQrUTSei1Z4gcPESsgaErLHhhb/Rk4agu2yI2aLXx nZSjJi1rL4XaLxStdkjzIK4AP3xrkIRoV0xUhHyv0XtE9HMr2yZwq709z7W1gpTUDJ04 w1m8YRZzNj8bSj5FZ07emtaX9OU5Ysn4QyXEvNPbODouDQ24hEdG01xeZPelclK8VSoc P2qEGkZV9NmVYtbW2D4031b4PiduviqMRUv2VqIiWnOm4UAPlm3dTUHpvNwgSdygDk35 5m0A== X-Forwarded-Encrypted: i=1; AJvYcCWvp1f2yOk9Ui7Dz7g3k/Xfh2/CnpF877kNiZPptZbbQJ5jQsNyvt71kWC8Z91rvGP8wgbOb8qdDg==@kvack.org X-Gm-Message-State: AOJu0YxrtlqQHlMzvBime1NJojWMMpzFlhgYUIGT3s+JmY9bBBNhM5I5 +OvH9TQmIQUn1W+l2lkM4t7jWOBssxk1afVOfDBUg7aEh8PUZXQsONZ03zn8Oh4= X-Google-Smtp-Source: AGHT+IETtHQ5ywMiUmPhP/0afBVUyPAVLJijgZTnYTfqkdZL3bCN8lBGOnkAyW3ORokI+fooL1bn0A== X-Received: by 2002:a05:6808:f13:b0:3e0:483:8bc1 with SMTP id 5614622812f47-3e004838dfdmr11138749b6e.43.1725481781057; Wed, 04 Sep 2024 13:29:41 -0700 (PDT) Received: from localhost (syn-076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45801cbc493sm1441111cf.69.2024.09.04.13.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 13:29:40 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, linux-fsdevel@vger.kernel.org, jack@suse.cz, amir73il@gmail.com, brauner@kernel.org, linux-xfs@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v5 16/18] xfs: add pre-content fsnotify hook for write faults Date: Wed, 4 Sep 2024 16:28:06 -0400 Message-ID: <12aebe1a4f039d0234ea74393a39614c0244f7e0.1725481503.git.josef@toxicpanda.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: dgcxfg5fq8j79x38y39419pf5g9hdfh4 X-Rspamd-Queue-Id: 19E351C0009 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1725481781-804379 X-HE-Meta: U2FsdGVkX1/IGIVdtDxioK2DvoXR/Vn2x9cK3D6CrWhCwbz8r0S9GXKssNTbKgk29ydEgq5yrHQL3hezyZWBsMud5w1E5c1lsKYBk+55bujYMmzZtoRLH+mxo9sBO8dZ9gqFsIjKVSgcWwL7GQTRxlw2lTfMr/cuOZWP8v+wxPF6ZfQxWRRVNWB3Bk5QrKTAhQ+eYaIr3hQG8aVJokFnUeXejvdkQ2vm0fou+vGMZmP6+Wl9BB8muTxHlpt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Y625D1Cg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, 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 4cdc54dc9686..3e385756017f 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1283,6 +1283,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);