aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/the_nilfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/the_nilfs.c')
-rw-r--r--fs/nilfs2/the_nilfs.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 221953bfc859..06e8dfd538d6 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -72,6 +72,7 @@ static struct the_nilfs *alloc_nilfs(struct block_device *bdev)
72 atomic_set(&nilfs->ns_writer_refcount, -1); 72 atomic_set(&nilfs->ns_writer_refcount, -1);
73 atomic_set(&nilfs->ns_ndirtyblks, 0); 73 atomic_set(&nilfs->ns_ndirtyblks, 0);
74 init_rwsem(&nilfs->ns_sem); 74 init_rwsem(&nilfs->ns_sem);
75 init_rwsem(&nilfs->ns_super_sem);
75 mutex_init(&nilfs->ns_writer_mutex); 76 mutex_init(&nilfs->ns_writer_mutex);
76 INIT_LIST_HEAD(&nilfs->ns_list); 77 INIT_LIST_HEAD(&nilfs->ns_list);
77 INIT_LIST_HEAD(&nilfs->ns_supers); 78 INIT_LIST_HEAD(&nilfs->ns_supers);
@@ -681,10 +682,10 @@ struct nilfs_sb_info *nilfs_find_sbinfo(struct the_nilfs *nilfs,
681{ 682{
682 struct nilfs_sb_info *sbi; 683 struct nilfs_sb_info *sbi;
683 684
684 down_read(&nilfs->ns_sem); 685 down_read(&nilfs->ns_super_sem);
685 /* 686 /*
686 * The SNAPSHOT flag and sb->s_flags are supposed to be 687 * The SNAPSHOT flag and sb->s_flags are supposed to be
687 * protected with nilfs->ns_sem. 688 * protected with nilfs->ns_super_sem.
688 */ 689 */
689 sbi = nilfs->ns_current; 690 sbi = nilfs->ns_current;
690 if (rw_mount) { 691 if (rw_mount) {
@@ -705,12 +706,12 @@ struct nilfs_sb_info *nilfs_find_sbinfo(struct the_nilfs *nilfs,
705 goto found; /* snapshot mount */ 706 goto found; /* snapshot mount */
706 } 707 }
707 out: 708 out:
708 up_read(&nilfs->ns_sem); 709 up_read(&nilfs->ns_super_sem);
709 return NULL; 710 return NULL;
710 711
711 found: 712 found:
712 atomic_inc(&sbi->s_count); 713 atomic_inc(&sbi->s_count);
713 up_read(&nilfs->ns_sem); 714 up_read(&nilfs->ns_super_sem);
714 return sbi; 715 return sbi;
715} 716}
716 717
@@ -720,7 +721,7 @@ int nilfs_checkpoint_is_mounted(struct the_nilfs *nilfs, __u64 cno,
720 struct nilfs_sb_info *sbi; 721 struct nilfs_sb_info *sbi;
721 int ret = 0; 722 int ret = 0;
722 723
723 down_read(&nilfs->ns_sem); 724 down_read(&nilfs->ns_super_sem);
724 if (cno == 0 || cno > nilfs->ns_cno) 725 if (cno == 0 || cno > nilfs->ns_cno)
725 goto out_unlock; 726 goto out_unlock;
726 727
@@ -737,6 +738,6 @@ int nilfs_checkpoint_is_mounted(struct the_nilfs *nilfs, __u64 cno,
737 ret++; 738 ret++;
738 739
739 out_unlock: 740 out_unlock:
740 up_read(&nilfs->ns_sem); 741 up_read(&nilfs->ns_super_sem);
741 return ret; 742 return ret;
742} 743}