[PATCH 08/10] fsnotify: use path_clone()

From: Mateusz Guzik

Date: Sun Sep 13 2026 - 10:51:52 EST


No functional changes.

Signed-off-by: Mateusz Guzik <mjguzik@xxxxxxxxx>
---
fs/notify/fanotify/fanotify.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index a208a7ec1692..84b4c505dbe3 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -559,9 +559,8 @@ static struct fanotify_event *fanotify_alloc_path_event(const struct path *path,
return NULL;

pevent->fae.type = FANOTIFY_EVENT_TYPE_PATH;
- pevent->path = *path;
*hash ^= fanotify_hash_path(path);
- path_get(path);
+ path_clone(path, &pevent->path);

return &pevent->fae;
}
@@ -600,10 +599,9 @@ static struct fanotify_event *fanotify_alloc_perm_event(const void *data,
pevent->hdr.len = 0;
pevent->state = FAN_EVENT_INIT;
pevent->watchdog_cnt = 0;
- pevent->path = *path;
pevent->pos = range ? range->pos : FANOTIFY_NO_RANGE;
pevent->count = range ? range->count : 0;
- path_get(path);
+ path_clone(path, &pevent->path);

return &pevent->fae;
}
--
2.53.0