-
Notifications
You must be signed in to change notification settings - Fork 355
DAOS-19526 dfs: Enable Hardlink support for dfuse #19065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sherintg
wants to merge
6
commits into
feature/dfs_hardlinks
Choose a base branch
from
sherintg/dfs_hardlinks/DAOS-19526
base: feature/dfs_hardlinks
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d0d244e
DAOS-19526 dfs: Enable Hardlink support for dfuse
sherintg f934184
Merge branch feature/dfs_hardlinks into sherintg/dfs_hardlinks/DAOS-1…
sherintg 3b0b5ab
DAOS-19526 dfuse: fix hardlink cache correctness and cross-container …
sherintg 09f174c
DAOS-19526 dfuse: Enable hardlink support for dfuse
sherintg e58e6a3
DAOS-19526 dfuse: Enable hardlink support for dfuse
sherintg 3a10601
DAOS-19526 dfuse: Enable hardlink support for dfuse
sherintg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ OPS_SRC = ['create', | |
| 'fgetattr', | ||
| 'forget', | ||
| 'getxattr', | ||
| 'link', | ||
| 'listxattr', | ||
| 'ioctl', | ||
| 'lookup', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -400,6 +400,8 @@ struct dfuse_inode_ops { | |
| const char *newname, unsigned int flags); | ||
| void (*symlink)(fuse_req_t req, const char *link, | ||
| struct dfuse_inode_entry *parent, const char *name); | ||
| void (*hardlink)(fuse_req_t req, struct dfuse_inode_entry *inode, | ||
| struct dfuse_inode_entry *parent, const char *name); | ||
| void (*unlink)(fuse_req_t req, struct dfuse_inode_entry *parent, | ||
| const char *name); | ||
| void (*setxattr)(fuse_req_t req, struct dfuse_inode_entry *inode, | ||
|
|
@@ -486,6 +488,7 @@ struct dfuse_pool { | |
| ACTION(UNLINK) \ | ||
| ACTION(READDIR) \ | ||
| ACTION(SYMLINK) \ | ||
| ACTION(LINK) \ | ||
| ACTION(READLINK) \ | ||
| ACTION(OPENDIR) \ | ||
| ACTION(SETXATTR) \ | ||
|
|
@@ -941,6 +944,15 @@ dfuse_loop(struct dfuse_info *dfuse_info); | |
|
|
||
| #define DFUSE_REPLY_IOCTL(desc, req, arg) DFUSE_REPLY_IOCTL_SIZE(desc, req, &(arg), sizeof(arg)) | ||
|
|
||
| /* A (parent, name) dentry. A file may have multiple hardlinks, all sharing one inode entry; the | ||
| * primary link is stored inline on the inode and any additional links are tracked on ie_dentries. | ||
| */ | ||
| struct dfuse_dentry { | ||
| fuse_ino_t dd_parent; | ||
| char dd_name[NAME_MAX + 1]; | ||
| d_list_t dd_list; | ||
| }; | ||
|
|
||
| /** | ||
| * Inode handle. | ||
| * | ||
|
|
@@ -977,6 +989,12 @@ struct dfuse_inode_entry { | |
| */ | ||
| fuse_ino_t ie_parent; | ||
|
|
||
| /** Additional hardlink dentries beyond the primary ie_parent/ie_name. */ | ||
| d_list_t ie_dentries; | ||
|
|
||
| /** Protects ie_parent, ie_name and ie_dentries. */ | ||
| pthread_spinlock_t ie_dentry_lock; | ||
|
|
||
| struct dfuse_cont *ie_dfs; | ||
|
|
||
| /** Hash table of inodes | ||
|
|
@@ -1189,12 +1207,6 @@ ival_drop_inode(struct dfuse_inode_entry *inode); | |
| int | ||
| ival_update_inode(struct dfuse_inode_entry *inode, double timeout); | ||
|
|
||
| /* Queue an on-demand dentry invalidation (parent/name) to be issued from the invalidation thread. | ||
| * ie_drop, if non-NULL, is a reference that is released after the invalidation has been issued. | ||
| */ | ||
| int | ||
| dfuse_mark_inval_entry(fuse_ino_t parent, const char *name, struct dfuse_inode_entry *ie_drop); | ||
|
|
||
| int | ||
| ival_init(struct dfuse_info *dfuse_info); | ||
|
|
||
|
|
@@ -1250,6 +1262,53 @@ dfuse_ie_init(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie); | |
| void | ||
| dfuse_ie_close(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie); | ||
|
|
||
| /* Track an additional hardlink name for a shared inode. */ | ||
| int | ||
| dfuse_ie_dentry_add(struct dfuse_inode_entry *ie, fuse_ino_t parent, const char *name); | ||
|
|
||
| /* Drop one tracked name; promotes a secondary to primary if the primary was removed. */ | ||
| void | ||
| dfuse_ie_dentry_remove(struct dfuse_inode_entry *ie, fuse_ino_t parent, const char *name); | ||
|
|
||
| /* Rename a tracked name. If the old name is unknown, release all tracked names into released and | ||
| * set the new name as the sole primary. | ||
| */ | ||
| void | ||
| dfuse_ie_dentry_replace(struct dfuse_inode_entry *ie, fuse_ino_t old_parent, const char *old_name, | ||
| fuse_ino_t new_parent, const char *new_name, struct dfuse_dentry *released); | ||
|
|
||
| /* Make (parent, name) the inode's sole tracked name, moving every other name into released. Used | ||
| * for a single-link file where all other cached names are stale. | ||
| */ | ||
| void | ||
| dfuse_ie_dentry_set_single(struct dfuse_inode_entry *ie, fuse_ino_t parent, const char *name, | ||
| struct dfuse_dentry *released); | ||
|
|
||
| /* Snapshot every tracked name into released, moving secondaries out of the inode. */ | ||
| void | ||
| dfuse_ie_dentry_snapshot(struct dfuse_inode_entry *ie, struct dfuse_dentry *released); | ||
|
|
||
| /* Issue fuse_lowlevel_notify_inval_entry() for every name in released and free secondaries. Must | ||
| * only be called from the invalidation thread. Returns -EBADF if the session is dead. | ||
| */ | ||
| int | ||
| dfuse_ie_dentry_inval(struct dfuse_info *dfuse_info, struct dfuse_dentry *released); | ||
|
|
||
| /* Queue every name in released for invalidation on the invalidation thread, consuming released. | ||
| * ie_drop, if set, is released after the final name is invalidated. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be worth of it to mention that there is some actions which are always taken even in case of error. |
||
| */ | ||
| int | ||
| dfuse_queue_inval_dentries(struct dfuse_dentry *released, struct dfuse_inode_entry *ie_drop); | ||
|
|
||
| /* Invalidate cached data/attrs synchronously, then queue a delete on the invalidation thread for | ||
| * every name in released, skipping (exclude_parent, exclude_name) which the kernel already handled. | ||
| * Consumes released. | ||
| */ | ||
| void | ||
| dfuse_ie_inode_delete(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie, | ||
| struct dfuse_dentry *released, fuse_ino_t exclude_parent, | ||
| const char *exclude_name); | ||
|
|
||
| /* ops/...c */ | ||
|
|
||
| void | ||
|
|
@@ -1312,6 +1371,9 @@ void | |
| dfuse_cb_symlink(fuse_req_t, const char *, struct dfuse_inode_entry *, | ||
| const char *); | ||
|
|
||
| void | ||
| dfuse_cb_link(fuse_req_t, struct dfuse_inode_entry *, struct dfuse_inode_entry *, const char *); | ||
|
|
||
| void | ||
| dfuse_cb_setxattr(fuse_req_t, struct dfuse_inode_entry *, const char *, | ||
| const char *, size_t, int); | ||
|
|
@@ -1358,6 +1420,13 @@ void | |
| dfuse_oid_unlinked(struct dfuse_info *dfuse_info, fuse_req_t req, daos_obj_id_t *oid, | ||
| struct dfuse_inode_entry *parent, const char *name); | ||
|
|
||
| /* Handle removal of one hardlink where the file still exists (other links remain). The inode is | ||
| * left intact; only the fuse reply is issued. | ||
| */ | ||
| void | ||
| dfuse_hardlink_removed(struct dfuse_info *dfuse_info, fuse_req_t req, daos_obj_id_t *oid, | ||
| struct dfuse_inode_entry *parent, const char *name); | ||
|
|
||
| /* dfuse_cont.c */ | ||
| void | ||
| dfuse_cont_lookup(fuse_req_t req, struct dfuse_inode_entry *parent, | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new set of tests added, I had seen failure related to log-size not sufficient. Hence increased the size.