Commit d9a0a345 authored by Jiro SEKIBA's avatar Jiro SEKIBA Committed by Ryusuke Konishi

nilfs2: fix disorder in cp count on error during deleting checkpoints

This fixes a bug that checkpoint count gets wrong on errors when
deleting a series of checkpoints.

The count error is persistent since the checkpoint count is stored on
disk.  Some userland programs refer to the count via ioctl, and this
bugfix is needed to prevent malfunction of such programs.
Signed-off-by: default avatarJiro SEKIBA <jir@unicus.jp>
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: stable@kernel.org
parent ff54de36
...@@ -307,7 +307,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -307,7 +307,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh);
if (ret < 0) { if (ret < 0) {
if (ret != -ENOENT) if (ret != -ENOENT)
goto out_header; break;
/* skip hole */ /* skip hole */
ret = 0; ret = 0;
continue; continue;
...@@ -340,7 +340,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -340,7 +340,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
continue; continue;
printk(KERN_ERR "%s: cannot delete block\n", printk(KERN_ERR "%s: cannot delete block\n",
__func__); __func__);
goto out_header; break;
} }
} }
...@@ -358,7 +358,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -358,7 +358,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
out_header:
brelse(header_bh); brelse(header_bh);
out_sem: out_sem:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment