From d06ba454b7a9984cebf3c28f93429b412a350539 Mon Sep 17 00:00:00 2001 From: luzh Date: Wed, 5 Jul 2017 13:12:10 -0700 Subject: [PATCH] Fix inode check in snapshot When nova_append_snapshot_info_entry() is first called the snapshot inode is not initialized and so we have to skip the first integrity check. --- fs/nova/log.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/nova/log.c b/fs/nova/log.c index a5bf739a062f..de27f7e8d3e5 100644 --- a/fs/nova/log.c +++ b/fs/nova/log.c @@ -956,10 +956,13 @@ int nova_append_snapshot_info_entry(struct super_block *sb, entry_info.epoch_id = data->epoch_id; entry_info.inplace = 0; - if (nova_check_inode_integrity(sb, sih->ino, sih->pi_addr, - sih->alter_pi_addr, &inode_copy, 0) < 0) { - ret = -EIO; - goto out; + if (sih->log_head != 0) { + /* sih->log_head == 0 indicates this inode is not initialized */ + if (nova_check_inode_integrity(sb, sih->ino, sih->pi_addr, + sih->alter_pi_addr, &inode_copy, 0) < 0) { + ret = -EIO; + goto out; + } } ret = nova_append_log_entry(sb, pi, NULL, sih, &entry_info);