Skip to content

fuse: multi-node mmap support - #7

Merged
bsbernd merged 3 commits into
DDNStorage:redfs-ubuntu-noble-6.8.0-58.60from
cding-ddn:mkwrite-noble-6.8.0-58.60
Jul 18, 2025
Merged

bsbernd merged 3 commits into
DDNStorage:redfs-ubuntu-noble-6.8.0-58.60from
cding-ddn:mkwrite-noble-6.8.0-58.60

Conversation

@cding-ddn

Copy link
Copy Markdown
Collaborator

Add PAGE_MKWRITE fuse request to allow FUSE daemon to acquire DLM lock for protecting dirty page creation.

Allow read_folio to return EAGAIN error and translate it to AOP_TRUNCATE_PAGE to retry page fault and read operations. This is used to prevent deadlock of folio lock/DLM lock order reversal:

  • Fault or read operations acquire folio lock first, then DLM lock.
  • FUSE daemon blocks new DLM lock acquisition while it invalidating page cache. invalidate_inode_pages2_range() acquires folio lock To prevent deadlock, the FUSE daemon will fail its DLM lock acquisition with EAGAIN if it detects an in-flight page cache invalidating operation.

This enables memory mapping across cluster nodes with proper distributed locking coordination.

@cding-ddn
cding-ddn requested a review from bsbernd July 7, 2025 17:47
Comment thread fs/fuse/fuse_i.h
unsigned int no_mkwrite:1;

/* Use io_uring for communication */
unsigned int io_uring;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, needs to be switched to io_uring:1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(unrelated, but had slipped through so far)

Comment thread fs/fuse/file.c Resolved
@bsbernd

ghost commented Jul 7, 2025

Copy link
Copy Markdown
Collaborator

Disadvantage of this way is that we get a PAGE_MKWRITE for every page - that will be expensive.

@bsbernd

ghost commented Jul 7, 2025

Copy link
Copy Markdown
Collaborator

Needs a "Signed-off-by"

@yongzech
yongzech self-requested a review July 8, 2025 05:35
Comment thread include/uapi/linux/fuse.h Resolved
@cding-ddn
cding-ddn force-pushed the mkwrite-noble-6.8.0-58.60 branch from e77b0a5 to b6ebff1 Compare July 11, 2025 09:14
Comment thread fs/fuse/file.c Resolved
@cding-ddn
cding-ddn force-pushed the mkwrite-noble-6.8.0-58.60 branch from b6ebff1 to 989869f Compare July 16, 2025 08:06
Comment thread fs/fuse/file.c Resolved
Comment thread include/uapi/linux/fuse.h Resolved
Comment thread fs/fuse/file.c Resolved
@cding-ddn cding-ddn changed the title fuse: add PAGE_MKWRITE opcode fuse: multi-node mmap support Jul 17, 2025
@cding-ddn
cding-ddn force-pushed the mkwrite-noble-6.8.0-58.60 branch from 989869f to af8a424 Compare July 17, 2025 17:08
@bsbernd

ghost commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator

@cding-ddn I can't merge, there are conflicts. I think the 1st patch in the series is already merged.

Cheng Ding added 3 commits July 18, 2025 10:42
Renumber the operation code to a high value to avoid conflicts with upstream.
Send a DLM_WB_LOCK request in the page_mkwrite handler to enable FUSE
filesystems to acquire a distributed lock manager (DLM) lock for
protecting upcoming dirty pages when a previously read-only mapped
page is about to be written.

Signed-off-by: Cheng Ding <cding@ddn.com>
Allow read_folio to return EAGAIN error and translate it to
AOP_TRUNCATE_PAGE to retry page fault and read operations.
This is used to prevent deadlock of folio lock/DLM lock order reversal:
 - Fault or read operations acquire folio lock first, then DLM lock.
 - FUSE daemon blocks new DLM lock acquisition while it invalidating
   page cache. invalidate_inode_pages2_range() acquires folio lock
To prevent deadlock, the FUSE daemon will fail its DLM lock acquisition
with EAGAIN if it detects an in-flight page cache invalidating
operation.

Signed-off-by: Cheng Ding <cding@ddn.com>
@cding-ddn
cding-ddn force-pushed the mkwrite-noble-6.8.0-58.60 branch from af8a424 to 8ecf118 Compare July 18, 2025 10:42
@cding-ddn

ghost commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator Author

@bernd, I did a rebase, it can be merged now

@bsbernd
bsbernd merged commit 391f71c into DDNStorage:redfs-ubuntu-noble-6.8.0-58.60 Jul 18, 2025
@cding-ddn
cding-ddn deleted the mkwrite-noble-6.8.0-58.60 branch September 23, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants