@@ -3531,7 +3531,8 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
35313531 break ;
35323532
35333533 __SetPageLocked (page );
3534- if (add_to_page_cache_locked (page , mapping , page -> index , gfp )) {
3534+ rc = add_to_page_cache_locked (page , mapping , page -> index , gfp );
3535+ if (rc ) {
35353536 __ClearPageLocked (page );
35363537 break ;
35373538 }
@@ -3547,6 +3548,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
35473548 struct list_head * page_list , unsigned num_pages )
35483549{
35493550 int rc ;
3551+ int err = 0 ;
35503552 struct list_head tmplist ;
35513553 struct cifsFileInfo * open_file = file -> private_data ;
35523554 struct cifs_sb_info * cifs_sb = CIFS_FILE_SB (file );
@@ -3587,7 +3589,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
35873589 * the order of declining indexes. When we put the pages in
35883590 * the rdata->pages, then we want them in increasing order.
35893591 */
3590- while (!list_empty (page_list )) {
3592+ while (!list_empty (page_list ) && ! err ) {
35913593 unsigned int i , nr_pages , bytes , rsize ;
35923594 loff_t offset ;
35933595 struct page * page , * tpage ;
@@ -3610,9 +3612,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
36103612 return 0 ;
36113613 }
36123614
3613- rc = readpages_get_pages (mapping , page_list , rsize , & tmplist ,
3615+ nr_pages = 0 ;
3616+ err = readpages_get_pages (mapping , page_list , rsize , & tmplist ,
36143617 & nr_pages , & offset , & bytes );
3615- if (rc ) {
3618+ if (! nr_pages ) {
36163619 add_credits_and_wake_if (server , credits , 0 );
36173620 break ;
36183621 }
0 commit comments