Skip to content

Commit

Permalink
Fix inode check in snapshot
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
luzh committed Jul 5, 2017
1 parent 725486a commit d06ba45
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fs/nova/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

3 comments on commit d06ba45

@Andiry
Copy link
Contributor

@Andiry Andiry commented on d06ba45 Jul 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right fix? Shouldn't we initialize the snapshot inode during initialization?

@luzh
Copy link
Contributor Author

@luzh luzh commented on d06ba45 Jul 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a better solution. Let me check how to initialize it.

@luzh
Copy link
Contributor Author

@luzh luzh commented on d06ba45 Jul 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made another fix by 147e550

Please sign in to comment.