f2fs: retry to revoke atomic commit in -ENOMEM case
authorChao Yu <yuchao0@huawei.com>
Tue, 8 Aug 2017 11:09:08 +0000 (19:09 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 21 Aug 2017 22:55:04 +0000 (15:55 -0700)
During atomic committing, if we encounter -ENOMEM in revoke path, it's
better to give a chance to retry revoking.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index 95267630c8c46d7be5dfbd262e2bd67f31b4d31c..05144b3a7f6229dc4e1b5f0d9caba0620140df55 100644 (file)
@@ -213,9 +213,15 @@ static int __revoke_inmem_pages(struct inode *inode,
                        struct node_info ni;
 
                        trace_f2fs_commit_inmem_page(page, INMEM_REVOKE);
-
+retry:
                        set_new_dnode(&dn, inode, NULL, NULL, 0);
-                       if (get_dnode_of_data(&dn, page->index, LOOKUP_NODE)) {
+                       err = get_dnode_of_data(&dn, page->index, LOOKUP_NODE);
+                       if (err) {
+                               if (err == -ENOMEM) {
+                                       congestion_wait(BLK_RW_ASYNC, HZ/50);
+                                       cond_resched();
+                                       goto retry;
+                               }
                                err = -EAGAIN;
                                goto next;
                        }