fix: Fix search fail after mounting ulnfs#207
fix: Fix search fail after mounting ulnfs#207deepin-bot[bot] merged 3 commits intolinuxdeepin:develop/snipefrom
Conversation
When ulnfs is mounted to the home directory, the ulnfs root directory may be mounted in two locations simultaneously because the mount point has a bound mount. This can cause `get_event_path()` to fail in resolving the full path of events. For example, it might resolve to "/persistent/home/uos" instead of "/home/uos". This can cause events to be filtered out due to the failure of `is_under_indexing_path()`, resulting in newly created files not being found. Let's use `mount_info_get_device_mount_point()` to determine the device's mount point.
deepin-anything-server needs to detect all unnamed devices and assign them to the vfs_monitor kernel module. After enabling ProtectKernelTunables, deepin-anything-server will fail to write to /sys/kernel/vfs_monitor/vfs_unnamed_devices. Bug: https://pms.uniontech.com/bug-view-352841.html
As title. Log: Bump version to 7.0.38
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wangrong1069 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
TAG Bot TAG: 7.0.38 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuidePropagate MountInfo into path resolution utilities and event handling so that event/indexing/blacklist paths are resolved using the current mount table (including ulnfs) instead of querying mountpoints ad‑hoc, fixing search failures after mounting ulnfs. Sequence diagram for resolving event paths with MountInfo-aware get_full_pathsequenceDiagram
participant Handler as default_event_handler
participant Mount as MountInfo
participant Helpers as path_helpers
participant Tools as tools
participant FS as filesystem_api
Handler->>Mount: mount_info_new()
activate Mount
Mount-->>Handler: mount_info_
deactivate Mount
loop for each origin_path in config_.indexing_paths
Handler->>Helpers: get_event_path(mount_info_, origin_path, indexing_items_)
activate Helpers
Helpers->>FS: exists(origin_path, ec)
FS-->>Helpers: bool
alt path exists
Helpers->>Tools: get_full_path(mount_info_, origin_path.c_str())
activate Tools
Tools->>FS: lstat(path, &st)
FS-->>Tools: int
alt lstat ok
Tools->>Mount: mount_info_get_device_mount_point(mount_info_, st.st_dev)
Mount-->>Tools: mountpoint
Tools-->>Helpers: event_path
else lstat failed
Tools-->>Helpers: NULL
end
deactivate Tools
alt event_path != NULL
Helpers-->>Handler: event_path_with_slash
else event_path == NULL
Helpers-->>Handler: origin_path_with_slash
end
else path does not exist
Helpers-->>Handler: "" (empty string)
end
deactivate Helpers
end
Class diagram for updated event handling and path resolution with MountInfoclassDiagram
class default_event_handler {
-event_handler_config config_
-GAsyncQueue* event_queue_
-GThread* event_filter_thread_
-GAsyncQueue* config_event_queue_
-MountInfo* mount_info_
-std_vector_indexing_item indexing_items_
-std_vector_string event_path_blocked_list_
+default_event_handler(event_handler_config config)
+void handle_config_event()
}
class MountInfo {
+mount_info_new() MountInfo*
+mount_info_dump(MountInfo* mount_info) gchar*
+mount_info_get_device_mount_point(MountInfo* mount_info, dev_t device) const gchar*
}
class tools {
+char* get_full_path(MountInfo* mount_info, const char* path)
}
class path_helpers {
+std_string determine_blacklist_path(MountInfo* mount_info, const char* path)
+std_string get_event_path(MountInfo* mount_info, const std_string& origin_path, const std_vector_indexing_item& indexing_items)
}
class filesystem_api {
+bool exists(const std_string& path, std_error_code& ec)
+int lstat(const char* path, struct_stat* st)
}
class indexing_item {
}
%% Relationships
default_event_handler *-- MountInfo : owns
path_helpers ..> tools : uses
path_helpers ..> filesystem_api : uses
path_helpers ..> indexing_item : uses
tools ..> MountInfo : queries mount points
filesystem_api <.. tools : calls lstat
filesystem_api <.. path_helpers : calls exists
default_event_handler ..> path_helpers : uses for indexing_paths and blacklist_paths
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Now that
get_full_pathanddetermine_blacklist_pathdepend on aMountInfo*, consider adding an explicit null check or assertion onmount_infoat their entry points (or in the caller) to avoid undefined behavior ifmount_info_new()ever fails or a null is inadvertently passed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that `get_full_path` and `determine_blacklist_path` depend on a `MountInfo*`, consider adding an explicit null check or assertion on `mount_info` at their entry points (or in the caller) to avoid undefined behavior if `mount_info_new()` ever fails or a null is inadvertently passed.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
/merge |
|
TAG Bot ✅ Tag created successfully 📋 Tag Details
|
deepin pr auto reviewGit Diff 代码审查报告总体评估这次提交主要对
下面从语法逻辑、代码质量、代码性能和代码安全四个方面进行详细审查。 语法逻辑审查
代码质量审查
代码性能审查
代码安全审查
改进建议
总结这次提交主要改进了路径解析逻辑,通过引入 |
Summary by Sourcery
Resolve path resolution issues by using shared mount information when computing event and blacklist paths.
Bug Fixes:
Enhancements: