diff options
Diffstat (limited to 'fs/f2fs/recovery.c')
| -rw-r--r-- | fs/f2fs/recovery.c | 18 | 
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index b07e9b6ef37..f42e4060b39 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -67,7 +67,7 @@ static int recover_dentry(struct page *ipage, struct inode *inode)  		kunmap(page);  		f2fs_put_page(page, 0);  	} else { -		f2fs_add_link(&dent, inode); +		err = f2fs_add_link(&dent, inode);  	}  	iput(dir);  out: @@ -144,14 +144,14 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)  				goto out;  			} -			INIT_LIST_HEAD(&entry->list); -			list_add_tail(&entry->list, head); -  			entry->inode = f2fs_iget(sbi->sb, ino_of_node(page));  			if (IS_ERR(entry->inode)) {  				err = PTR_ERR(entry->inode); +				kmem_cache_free(fsync_entry_slab, entry);  				goto out;  			} + +			list_add_tail(&entry->list, head);  			entry->blkaddr = blkaddr;  		}  		if (IS_INODE(page)) { @@ -173,10 +173,9 @@ out:  static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi,  					struct list_head *head)  { -	struct list_head *this; -	struct fsync_inode_entry *entry; -	list_for_each(this, head) { -		entry = list_entry(this, struct fsync_inode_entry, list); +	struct fsync_inode_entry *entry, *tmp; + +	list_for_each_entry_safe(entry, tmp, head, list) {  		iput(entry->inode);  		list_del(&entry->list);  		kmem_cache_free(fsync_entry_slab, entry); @@ -228,6 +227,9 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,  	/* Deallocate previous index in the node page */  	inode = f2fs_iget_nowait(sbi->sb, ino); +	if (IS_ERR(inode)) +		return; +  	truncate_hole(inode, bidx, bidx + 1);  	iput(inode);  }  |