|
@@ -71,18 +71,14 @@ static struct fsync_inode_entry *get_fsync_inode(struct list_head *head,
|
|
static struct fsync_inode_entry *add_fsync_inode(struct f2fs_sb_info *sbi,
|
|
static struct fsync_inode_entry *add_fsync_inode(struct f2fs_sb_info *sbi,
|
|
struct list_head *head, nid_t ino)
|
|
struct list_head *head, nid_t ino)
|
|
{
|
|
{
|
|
- struct inode *inode = f2fs_iget(sbi->sb, ino);
|
|
|
|
|
|
+ struct inode *inode;
|
|
struct fsync_inode_entry *entry;
|
|
struct fsync_inode_entry *entry;
|
|
|
|
|
|
|
|
+ inode = f2fs_iget_retry(sbi->sb, ino);
|
|
if (IS_ERR(inode))
|
|
if (IS_ERR(inode))
|
|
return ERR_CAST(inode);
|
|
return ERR_CAST(inode);
|
|
|
|
|
|
- entry = kmem_cache_alloc(fsync_entry_slab, GFP_F2FS_ZERO);
|
|
|
|
- if (!entry) {
|
|
|
|
- iput(inode);
|
|
|
|
- return ERR_PTR(-ENOMEM);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ entry = f2fs_kmem_cache_alloc(fsync_entry_slab, GFP_F2FS_ZERO);
|
|
entry->inode = inode;
|
|
entry->inode = inode;
|
|
list_add_tail(&entry->list, head);
|
|
list_add_tail(&entry->list, head);
|
|
|
|
|
|
@@ -136,7 +132,7 @@ retry:
|
|
goto out_unmap_put;
|
|
goto out_unmap_put;
|
|
|
|
|
|
if (de) {
|
|
if (de) {
|
|
- einode = f2fs_iget(inode->i_sb, le32_to_cpu(de->ino));
|
|
|
|
|
|
+ einode = f2fs_iget_retry(inode->i_sb, le32_to_cpu(de->ino));
|
|
if (IS_ERR(einode)) {
|
|
if (IS_ERR(einode)) {
|
|
WARN_ON(1);
|
|
WARN_ON(1);
|
|
err = PTR_ERR(einode);
|
|
err = PTR_ERR(einode);
|
|
@@ -158,6 +154,8 @@ retry:
|
|
err = __f2fs_do_add_link(dir, &fname, inode,
|
|
err = __f2fs_do_add_link(dir, &fname, inode,
|
|
inode->i_ino, inode->i_mode);
|
|
inode->i_ino, inode->i_mode);
|
|
}
|
|
}
|
|
|
|
+ if (err == -ENOMEM)
|
|
|
|
+ goto retry;
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
out_unmap_put:
|
|
out_unmap_put:
|
|
@@ -357,7 +355,7 @@ got_it:
|
|
|
|
|
|
if (ino != dn->inode->i_ino) {
|
|
if (ino != dn->inode->i_ino) {
|
|
/* Deallocate previous index in the node page */
|
|
/* Deallocate previous index in the node page */
|
|
- inode = f2fs_iget(sbi->sb, ino);
|
|
|
|
|
|
+ inode = f2fs_iget_retry(sbi->sb, ino);
|
|
if (IS_ERR(inode))
|
|
if (IS_ERR(inode))
|
|
return PTR_ERR(inode);
|
|
return PTR_ERR(inode);
|
|
} else {
|
|
} else {
|
|
@@ -425,10 +423,15 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
|
|
end = start + ADDRS_PER_PAGE(page, inode);
|
|
end = start + ADDRS_PER_PAGE(page, inode);
|
|
|
|
|
|
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
|
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
|
-
|
|
|
|
|
|
+retry_dn:
|
|
err = get_dnode_of_data(&dn, start, ALLOC_NODE);
|
|
err = get_dnode_of_data(&dn, start, ALLOC_NODE);
|
|
- if (err)
|
|
|
|
|
|
+ if (err) {
|
|
|
|
+ if (err == -ENOMEM) {
|
|
|
|
+ congestion_wait(BLK_RW_ASYNC, HZ/50);
|
|
|
|
+ goto retry_dn;
|
|
|
|
+ }
|
|
goto out;
|
|
goto out;
|
|
|
|
+ }
|
|
|
|
|
|
f2fs_wait_on_page_writeback(dn.node_page, NODE, true);
|
|
f2fs_wait_on_page_writeback(dn.node_page, NODE, true);
|
|
|
|
|
|
@@ -479,11 +482,16 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
|
|
if (err)
|
|
if (err)
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+retry_prev:
|
|
/* Check the previous node page having this index */
|
|
/* Check the previous node page having this index */
|
|
err = check_index_in_prev_nodes(sbi, dest, &dn);
|
|
err = check_index_in_prev_nodes(sbi, dest, &dn);
|
|
- if (err)
|
|
|
|
|
|
+ if (err) {
|
|
|
|
+ if (err == -ENOMEM) {
|
|
|
|
+ congestion_wait(BLK_RW_ASYNC, HZ/50);
|
|
|
|
+ goto retry_prev;
|
|
|
|
+ }
|
|
goto err;
|
|
goto err;
|
|
|
|
+ }
|
|
|
|
|
|
/* write dummy data page */
|
|
/* write dummy data page */
|
|
f2fs_replace_block(sbi, &dn, src, dest,
|
|
f2fs_replace_block(sbi, &dn, src, dest,
|