io_uring: fail links of cancelled timeouts
[linux-2.6-microblaze.git] / fs / afs / write.c
index 3104b62..c053469 100644 (file)
@@ -771,14 +771,20 @@ int afs_writepages(struct address_space *mapping,
        if (wbc->range_cyclic) {
                start = mapping->writeback_index * PAGE_SIZE;
                ret = afs_writepages_region(mapping, wbc, start, LLONG_MAX, &next);
-               if (start > 0 && wbc->nr_to_write > 0 && ret == 0)
-                       ret = afs_writepages_region(mapping, wbc, 0, start,
-                                                   &next);
-               mapping->writeback_index = next / PAGE_SIZE;
+               if (ret == 0) {
+                       mapping->writeback_index = next / PAGE_SIZE;
+                       if (start > 0 && wbc->nr_to_write > 0) {
+                               ret = afs_writepages_region(mapping, wbc, 0,
+                                                           start, &next);
+                               if (ret == 0)
+                                       mapping->writeback_index =
+                                               next / PAGE_SIZE;
+                       }
+               }
        } else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) {
                ret = afs_writepages_region(mapping, wbc, 0, LLONG_MAX, &next);
-               if (wbc->nr_to_write > 0)
-                       mapping->writeback_index = next;
+               if (wbc->nr_to_write > 0 && ret == 0)
+                       mapping->writeback_index = next / PAGE_SIZE;
        } else {
                ret = afs_writepages_region(mapping, wbc,
                                            wbc->range_start, wbc->range_end, &next);