@@ -4336,7 +4336,8 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
4336
4336
break ;
4337
4337
4338
4338
__SetPageLocked (page );
4339
- if (add_to_page_cache_locked (page , mapping , page -> index , gfp )) {
4339
+ rc = add_to_page_cache_locked (page , mapping , page -> index , gfp );
4340
+ if (rc ) {
4340
4341
__ClearPageLocked (page );
4341
4342
break ;
4342
4343
}
@@ -4352,6 +4353,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
4352
4353
struct list_head * page_list , unsigned num_pages )
4353
4354
{
4354
4355
int rc ;
4356
+ int err = 0 ;
4355
4357
struct list_head tmplist ;
4356
4358
struct cifsFileInfo * open_file = file -> private_data ;
4357
4359
struct cifs_sb_info * cifs_sb = CIFS_FILE_SB (file );
@@ -4396,7 +4398,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
4396
4398
* the order of declining indexes. When we put the pages in
4397
4399
* the rdata->pages, then we want them in increasing order.
4398
4400
*/
4399
- while (!list_empty (page_list )) {
4401
+ while (!list_empty (page_list ) && ! err ) {
4400
4402
unsigned int i , nr_pages , bytes , rsize ;
4401
4403
loff_t offset ;
4402
4404
struct page * page , * tpage ;
@@ -4429,9 +4431,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
4429
4431
return 0 ;
4430
4432
}
4431
4433
4432
- rc = readpages_get_pages (mapping , page_list , rsize , & tmplist ,
4434
+ nr_pages = 0 ;
4435
+ err = readpages_get_pages (mapping , page_list , rsize , & tmplist ,
4433
4436
& nr_pages , & offset , & bytes );
4434
- if (rc ) {
4437
+ if (! nr_pages ) {
4435
4438
add_credits_and_wake_if (server , credits , 0 );
4436
4439
break ;
4437
4440
}
0 commit comments