Commit caf73608 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] smbfs readdir vs signal fix

An old patch designed to fix http://bugme.osdl.org/show_bug.cgi?id=4497,
"getdents gives empty/random result upon signal".

If smbfs's readdir() is interupted by a signal, smb_readdir() failed to
noticed that and proceeded to treat the unread-into page as valid directory
contents.  Fix that up by handling the -ERESTARTSYS.

Thanks to Stian Skjelstad for reporting and testing.

Cc: Stian Skjelstad <stian@nixia.no>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 389d1ea5
...@@ -209,6 +209,8 @@ smb_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -209,6 +209,8 @@ smb_readdir(struct file *filp, void *dirent, filldir_t filldir)
ctl.valid = 1; ctl.valid = 1;
read_really: read_really:
result = server->ops->readdir(filp, dirent, filldir, &ctl); result = server->ops->readdir(filp, dirent, filldir, &ctl);
if (result == -ERESTARTSYS && page)
ClearPageUptodate(page);
if (ctl.idx == -1) if (ctl.idx == -1)
goto invalid_cache; /* retry */ goto invalid_cache; /* retry */
ctl.head.end = ctl.fpos - 1; ctl.head.end = ctl.fpos - 1;
...@@ -217,6 +219,7 @@ smb_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -217,6 +219,7 @@ smb_readdir(struct file *filp, void *dirent, filldir_t filldir)
if (page) { if (page) {
cache->head = ctl.head; cache->head = ctl.head;
kunmap(page); kunmap(page);
if (result != -ERESTARTSYS)
SetPageUptodate(page); SetPageUptodate(page);
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment