The Samba-Bugzilla – Attachment 4650 Details for
Bug 6693
wrong logic in "Failed to read all inotify data" - crash with large directories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix for reading the full buffer from inotify
0001-Check-we-read-off-the-compelte-event-from-inotify.patch (text/plain), 1.59 KB, created by
Simo Sorce
on 2009-09-05 11:43:27 UTC
(
hide
)
Description:
Fix for reading the full buffer from inotify
Filename:
MIME Type:
Creator:
Simo Sorce
Created:
2009-09-05 11:43:27 UTC
Size:
1.59 KB
patch
obsolete
>From ddca19dac1132228ef3dac3502e467adf545c840 Mon Sep 17 00:00:00 2001 >From: Simo Sorce <idra@samba.org> >Date: Sat, 5 Sep 2009 10:18:12 -0400 >Subject: [PATCH] Check we read off the compelte event from inotify > >The kernel may return a short read, so we must use read_data() to make sure we >read off the full buffer. If somethign bad happens we also need to kill the >inotify watch because the filedescriptor will return out of sync structures if >we read only part of the data. >--- > source3/smbd/notify_inotify.c | 10 ++++++++-- > 1 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c >index 26570a2..6159945 100644 >--- a/source3/smbd/notify_inotify.c >+++ b/source3/smbd/notify_inotify.c >@@ -232,6 +232,7 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde, > int bufsize = 0; > struct inotify_event *e0, *e; > uint32_t prev_cookie=0; >+ NTSTATUS status; > > /* > we must use FIONREAD as we cannot predict the length of the >@@ -248,9 +249,14 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde, > e0 = e = (struct inotify_event *)TALLOC_SIZE(in, bufsize); > if (e == NULL) return; > >- if (sys_read(in->fd, e0, bufsize) != bufsize) { >- DEBUG(0,("Failed to read all inotify data\n")); >+ status = read_data(in->fd, (char *)e0, bufsize); >+ if (!NT_STATUS_IS_OK(status)) { >+ DEBUG(0,("Failed to read all inotify data - %s\n", >+ nt_errstr(status))); > talloc_free(e0); >+ /* the inotify fd will now be out of sync, >+ * can't keep reading data off it */ >+ TALLOC_FREE(fde); > return; > } > >-- >1.6.0.6 >
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
Flags:
vl
:
review+
Actions:
View
Attachments on
bug 6693
:
4649
| 4650