Skip to contentSkip to conversation

CIFS: Fix readpages retrying on reconnects

PATCH Applied Pavel Shilovsky 2 participants 2 messages Oct 2, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: Fix readpages retrying on reconnects

From: Pavel Shilovsky <[email protected]>

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.

---
 fs/cifs/file.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
fs/cifs/file.c +1 -7
index 7c018a1..5f29354 100644
@@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
 				lru_cache_add_file(page);
 				unlock_page(page);
 				page_cache_release(page);
-				if (rc == -EAGAIN)
-					list_add_tail(&page->lru, &tmplist);
 			}
+			/* Fallback to the readpage in error/reconnect cases */
 			kref_put(&rdata->refcount, cifs_readdata_release);
-			if (rc == -EAGAIN) {
-				/* Re-add pages to the page_list and retry */
-				list_splice(&tmplist, page_list);
-				continue;
-			}
 			break;
 		}
 
Signature · 1 line
1.7.10.4
Applied
#1 lore raw

Merged into cifs-2.6.git for-next (and for-linus)

I would like to get this and also
http://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=19e81573fca7b87ced7701e01ba164b968d929bd
upstream ASAP but timing is getting tight, will need to wait at least a day for the normal linux-next build processes to complete and any additional test results.

Quoted 42 lines · Pavel Shilovsky

From: Pavel Shilovsky <[email protected]>

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.

---
 fs/cifs/file.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
fs/cifs/file.c +1 -8
index 7c018a1..5f29354 100644
@@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
                                lru_cache_add_file(page);
                                unlock_page(page);
                                page_cache_release(page);
-                               if (rc == -EAGAIN)
-                                       list_add_tail(&page->lru, &tmplist);
                        }
+                       /* Fallback to the readpage in error/reconnect cases */
                        kref_put(&rdata->refcount, cifs_readdata_release);
-                       if (rc == -EAGAIN) {
-                               /* Re-add pages to the page_list and retry */
-                               list_splice(&tmplist, page_list);
-                               continue;
-                       }
                        break;
                }
 
--

1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks,

Steve