Skip to content

Commit 6c30c53

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2: nilfs2: fix oopses with doubly mounted snapshots nilfs2: missing a read lock for segment writer in nilfs_attach_checkpoint()
2 parents 0dc9aa8 + a924586 commit 6c30c53

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

fs/nilfs2/super.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,10 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
416416
if (unlikely(err))
417417
goto failed;
418418

419+
down_read(&nilfs->ns_segctor_sem);
419420
err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp,
420421
&bh_cp);
422+
up_read(&nilfs->ns_segctor_sem);
421423
if (unlikely(err)) {
422424
if (err == -ENOENT || err == -EINVAL) {
423425
printk(KERN_ERR

fs/nilfs2/the_nilfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ nilfs_detach_writer(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
253253

254254
static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi)
255255
{
256-
if (!atomic_dec_and_test(&sbi->s_count))
256+
if (atomic_dec_and_test(&sbi->s_count))
257257
kfree(sbi);
258258
}
259259

0 commit comments

Comments
 (0)