History

CIFS: Fix readpages retrying on reconnects

If we got a reconnect error from async readv we re-add pages back to page_list and continue loop. That is wrong because these pages have been already added to the pagecache but page_list has pages that have not been added to the pagecache yet. This ends up with a general protection fault in put_pages after readpages. Fix it by not retrying the read of these pages and falling back to readpage instead. Fixes debian bug 762306

Pavel Shilovsky committed 12 years ago

Commit 1209bbd1 parent 19e81571 file · +1 −7Browse files

Unified · Split

fs/cifs/file.c+1−7
@@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, · 3567 unmodified lines
35683568 lru_cache_add_file(page);
35693569 unlock_page(page);
35703570 page_cache_release(page);
3571− if (rc == -EAGAIN)
3572− list_add_tail(&page->lru, &tmplist);
35733571 }
3572+ /* Fallback to the readpage in error/reconnect cases */
35743573 kref_put(&rdata->refcount, cifs_readdata_release);
3575− if (rc == -EAGAIN) {
3576− /* Re-add pages to the page_list and retry */
3577− list_splice(&tmplist, page_list);
3578− continue;
3579− }
35803574 break;
35813575 }
35823576