Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/4] Introduce a mmap sem to deal with some mmap issues
@ 2020-12-14 18:19 Josef Bacik
  2020-12-14 18:19 ` [PATCH 1/4] btrfs: add a i_mmap_lock to our inode Josef Bacik
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Josef Bacik @ 2020-12-14 18:19 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

Hello,

Both Filipe and I have found different issues that result in the same thing, we
need to be able to exclude mmap from happening in certain scenarios.  The
specifics are well described in the commit logs, but generally there's 2 issues

1) dedupe needs to validate that pages match, and since the validation is done
   outside of the extent lock we can race with mmap and dedupe pages that do not
   match.
2) We can deadlock in certain low metadata scenarios where we need to flush
   an ordered extent, but can't because mmap is holding the page lock.

These issues exist for remap and fallocate, so add an i_mmap_sem to allow us to
disallow mmap in these cases.  I'm still waiting on xfstests to finish with
this, but 2 hours in and no lockdep or deadlocks.  Thanks,

Josef Bacik (4):
  btrfs: add a i_mmap_lock to our inode
  btrfs: cleanup inode_lock/inode_unlock uses
  btrfs: exclude mmaps while doing remap
  btrfs: exclude mmap from happening during all fallocate operations

 fs/btrfs/btrfs_inode.h   |  1 +
 fs/btrfs/ctree.h         |  1 +
 fs/btrfs/delayed-inode.c |  4 ++--
 fs/btrfs/file.c          | 20 ++++++++++----------
 fs/btrfs/inode.c         | 10 ++++++++++
 fs/btrfs/ioctl.c         | 26 +++++++++++++-------------
 fs/btrfs/reflink.c       | 30 ++++++++++++++++++++++++------
 fs/btrfs/relocation.c    |  4 ++--
 8 files changed, 63 insertions(+), 33 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-23  8:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14 18:19 [PATCH 0/4] Introduce a mmap sem to deal with some mmap issues Josef Bacik
2020-12-14 18:19 ` [PATCH 1/4] btrfs: add a i_mmap_lock to our inode Josef Bacik
2020-12-14 18:19 ` [PATCH 2/4] btrfs: cleanup inode_lock/inode_unlock uses Josef Bacik
2020-12-14 18:19 ` [PATCH 3/4] btrfs: exclude mmaps while doing remap Josef Bacik
2020-12-15 20:23   ` Darrick J. Wong
2020-12-15 20:40     ` Josef Bacik
2020-12-14 18:19 ` [PATCH 4/4] btrfs: exclude mmap from happening during all fallocate operations Josef Bacik
2020-12-23  8:19 ` [PATCH 0/4] Introduce a mmap sem to deal with some mmap issues Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox