The Samba-Bugzilla – Attachment 16109 Details for
Bug 14430
smbd-notifyd O(n*n) performance issue with n watches registered for the same folder
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
patch file based on Samba 4.11.9
notifyd-memory-leak-fix-yyang-20200702.txt (text/plain), 2.20 KB, created by
YOUZHONG YANG
on 2020-07-02 22:22:58 UTC
(
hide
)
Description:
patch file based on Samba 4.11.9
Filename:
MIME Type:
Creator:
YOUZHONG YANG
Created:
2020-07-02 22:22:58 UTC
Size:
2.20 KB
patch
obsolete
>diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c >index 6ff1de5b5fec0e5f52b3c51cfad951e1f2b49d78..c82b61fd14cec1efa94cc1172e348f6b5cf47caa 100644 >--- a/source3/smbd/notifyd/notifyd.c >+++ b/source3/smbd/notifyd/notifyd.c >@@ -379,6 +379,8 @@ static bool notifyd_apply_rec_change( > size_t num_instances; > size_t i; > struct notifyd_instance *instance; >+ struct notifyd_instance *inst; >+ void *sys_watch; > TDB_DATA value; > NTSTATUS status; > bool ok = false; >@@ -460,24 +462,52 @@ static bool notifyd_apply_rec_change( > if ((instance->instance.filter != 0) || > (instance->instance.subdir_filter != 0)) { > int ret; >+ sys_watch = NULL; > >- TALLOC_FREE(instance->sys_watch); >+ for (i=0; i<num_instances; i++) { >+ inst = &instances[i]; >+ if(inst == instance) >+ continue; >+ if(instance->instance.filter == inst->instance.filter && >+ instance->instance.subdir_filter == inst->instance.subdir_filter) { >+ sys_watch = inst->sys_watch; >+ break; >+ } >+ } >+ if(sys_watch != NULL) { >+ /* reuse sys_watch */ >+ instance->sys_watch = sys_watch; >+ } else { >+ TALLOC_FREE(instance->sys_watch); > >- ret = sys_notify_watch(entries, sys_notify_ctx, path, >+ ret = sys_notify_watch(entries, sys_notify_ctx, path, > &instance->internal_filter, > &instance->internal_subdir_filter, > notifyd_sys_callback, msg_ctx, > &instance->sys_watch); >- if (ret != 0) { >- DBG_WARNING("sys_notify_watch for [%s] returned %s\n", >+ if (ret != 0) { >+ DBG_WARNING("sys_notify_watch for [%s] returned %s\n", > path, strerror(errno)); >+ } > } > } > > if ((instance->instance.filter == 0) && > (instance->instance.subdir_filter == 0)) { >- /* This is a delete request */ >- TALLOC_FREE(instance->sys_watch); >+ bool found = false; >+ for (i=0; i<num_instances; i++) { >+ inst = &instances[i]; >+ if(inst == instance) >+ continue; >+ if(instance->sys_watch == inst->sys_watch) { >+ found = true; >+ break; >+ } >+ } >+ if(!found) { >+ /* This is a delete request */ >+ TALLOC_FREE(instance->sys_watch); >+ } > *instance = instances[num_instances-1]; > num_instances -= 1; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14430
: 16109 |
16115
|
16116
|
16117
|
16118
|
18372
|
18373
|
18374
|
18455