Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs: avoid data races when accessing an inode's delayed_node
Date: Fri, 17 May 2024 14:13:23 +0100	[thread overview]
Message-ID: <cover.1715951291.git.fdmanana@suse.com> (raw)

From: Filipe Manana <fdmanana@suse.com>

We do have some data races when accessing an inode's delayed_node, namely
we use READ_ONCE() in a couple places while there's no pairing WRITE_ONCE()
anywhere, and in one place (btrfs_dirty_inode()) we neither user READ_ONCE()
nor take the lock that protects the delayed_node. So fix these and add
helpers to access and update an inode's delayed_node.

Filipe Manana (3):
  btrfs: always set an inode's delayed_inode with WRITE_ONCE()
  btrfs: use READ_ONCE() when accessing delayed_node at btrfs_dirty_node()
  btrfs: add and use helpers to get and set an inode's delayed_node

 fs/btrfs/btrfs_inode.h   | 12 ++++++++++++
 fs/btrfs/delayed-inode.c | 10 +++++-----
 fs/btrfs/inode.c         |  4 ++--
 3 files changed, 19 insertions(+), 7 deletions(-)

-- 
2.43.0


             reply	other threads:[~2024-05-17 13:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 13:13 fdmanana [this message]
2024-05-17 13:13 ` [PATCH 1/3] btrfs: always set an inode's delayed_inode with WRITE_ONCE() fdmanana
2024-05-17 22:51   ` Qu Wenruo
2024-05-17 13:13 ` [PATCH 2/3] btrfs: use READ_ONCE() when accessing delayed_node at btrfs_dirty_node() fdmanana
2024-05-17 22:51   ` Qu Wenruo
2024-05-17 13:13 ` [PATCH 3/3] btrfs: add and use helpers to get and set an inode's delayed_node fdmanana
2024-05-17 22:51   ` Qu Wenruo
2024-05-20 15:48 ` [PATCH 0/3] btrfs: avoid data races when accessing " David Sterba
2024-05-20 16:58   ` Filipe Manana
2024-05-20 20:20     ` David Sterba
2024-05-21 14:47       ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1715951291.git.fdmanana@suse.com \
    --to=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox