Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

cding-ddn
Copy link
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
unsigned int no_mkwrite:1;

/* Use io_uring for communication */
unsigned int io_uring;
Copy link
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
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)

@bsbernd
Copy link
Collaborator

bsbernd commented Jul 7, 2025

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

@bsbernd
Copy link
Collaborator

bsbernd commented Jul 7, 2025

Needs a "Signed-off-by"

@yongzech yongzech self-requested a review July 8, 2025 05:35
@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
@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
@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
Copy link
Collaborator

bsbernd commented Jul 18, 2025

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

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 <[email protected]>
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 <[email protected]>
@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
Copy link
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