aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/cpfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/cpfile.c')
-rw-r--r--fs/nilfs2/cpfile.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
index b5a8cd6b474f..4184c1c2992c 100644
--- a/fs/nilfs2/cpfile.c
+++ b/fs/nilfs2/cpfile.c
@@ -295,10 +295,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
295 return -EINVAL; 295 return -EINVAL;
296 } 296 }
297 297
298 /* cannot delete the latest checkpoint */
299 if (start == nilfs_mdt_cno(cpfile) - 1)
300 return -EPERM;
301
302 down_write(&NILFS_MDT(cpfile)->mi_sem); 298 down_write(&NILFS_MDT(cpfile)->mi_sem);
303 299
304 ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); 300 ret = nilfs_cpfile_get_header_block(cpfile, &header_bh);
@@ -542,20 +538,14 @@ int nilfs_cpfile_delete_checkpoint(struct inode *cpfile, __u64 cno)
542 struct nilfs_cpinfo ci; 538 struct nilfs_cpinfo ci;
543 __u64 tcno = cno; 539 __u64 tcno = cno;
544 ssize_t nci; 540 ssize_t nci;
545 int ret;
546 541
547 nci = nilfs_cpfile_do_get_cpinfo(cpfile, &tcno, &ci, sizeof(ci), 1); 542 nci = nilfs_cpfile_do_get_cpinfo(cpfile, &tcno, &ci, sizeof(ci), 1);
548 if (nci < 0) 543 if (nci < 0)
549 return nci; 544 return nci;
550 else if (nci == 0 || ci.ci_cno != cno) 545 else if (nci == 0 || ci.ci_cno != cno)
551 return -ENOENT; 546 return -ENOENT;
552 547 else if (nilfs_cpinfo_snapshot(&ci))
553 /* cannot delete the latest checkpoint nor snapshots */ 548 return -EBUSY;
554 ret = nilfs_cpinfo_snapshot(&ci);
555 if (ret < 0)
556 return ret;
557 else if (ret > 0 || cno == nilfs_mdt_cno(cpfile) - 1)
558 return -EPERM;
559 549
560 return nilfs_cpfile_delete_checkpoints(cpfile, cno, cno + 1); 550 return nilfs_cpfile_delete_checkpoints(cpfile, cno, cno + 1);
561} 551}