From caf736085f2f0d22a992a855d9caae14973f7ea4 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 1 Feb 2006 03:04:39 -0800 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/smbfs/dir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs/smbfs/dir.c') diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c index c6c33e15143..0424d06b147 100644 --- a/fs/smbfs/dir.c +++ b/fs/smbfs/dir.c @@ -209,6 +209,8 @@ init_cache: ctl.valid = 1; read_really: result = server->ops->readdir(filp, dirent, filldir, &ctl); + if (result == -ERESTARTSYS && page) + ClearPageUptodate(page); if (ctl.idx == -1) goto invalid_cache; /* retry */ ctl.head.end = ctl.fpos - 1; @@ -217,7 +219,8 @@ finished: if (page) { cache->head = ctl.head; kunmap(page); - SetPageUptodate(page); + if (result != -ERESTARTSYS) + SetPageUptodate(page); unlock_page(page); page_cache_release(page); } -- cgit v1.2.3