diff options
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/ioctl.c | 4 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 3 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 1 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.h | 2 |
4 files changed, 8 insertions, 2 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 06658caa18bd..0b6387c67e6c 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -182,7 +182,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, | |||
182 | if (copy_from_user(&cpmode, argp, sizeof(cpmode))) | 182 | if (copy_from_user(&cpmode, argp, sizeof(cpmode))) |
183 | goto out; | 183 | goto out; |
184 | 184 | ||
185 | down_read(&inode->i_sb->s_umount); | 185 | mutex_lock(&nilfs->ns_snapshot_mount_mutex); |
186 | 186 | ||
187 | nilfs_transaction_begin(inode->i_sb, &ti, 0); | 187 | nilfs_transaction_begin(inode->i_sb, &ti, 0); |
188 | ret = nilfs_cpfile_change_cpmode( | 188 | ret = nilfs_cpfile_change_cpmode( |
@@ -192,7 +192,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, | |||
192 | else | 192 | else |
193 | nilfs_transaction_commit(inode->i_sb); /* never fails */ | 193 | nilfs_transaction_commit(inode->i_sb); /* never fails */ |
194 | 194 | ||
195 | up_read(&inode->i_sb->s_umount); | 195 | mutex_unlock(&nilfs->ns_snapshot_mount_mutex); |
196 | out: | 196 | out: |
197 | mnt_drop_write_file(filp); | 197 | mnt_drop_write_file(filp); |
198 | return ret; | 198 | return ret; |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index a76d6ea51ffb..6522cac6057c 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -945,6 +945,8 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | |||
945 | struct nilfs_root *root; | 945 | struct nilfs_root *root; |
946 | int ret; | 946 | int ret; |
947 | 947 | ||
948 | mutex_lock(&nilfs->ns_snapshot_mount_mutex); | ||
949 | |||
948 | down_read(&nilfs->ns_segctor_sem); | 950 | down_read(&nilfs->ns_segctor_sem); |
949 | ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno); | 951 | ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno); |
950 | up_read(&nilfs->ns_segctor_sem); | 952 | up_read(&nilfs->ns_segctor_sem); |
@@ -969,6 +971,7 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | |||
969 | ret = nilfs_get_root_dentry(s, root, root_dentry); | 971 | ret = nilfs_get_root_dentry(s, root, root_dentry); |
970 | nilfs_put_root(root); | 972 | nilfs_put_root(root); |
971 | out: | 973 | out: |
974 | mutex_unlock(&nilfs->ns_snapshot_mount_mutex); | ||
972 | return ret; | 975 | return ret; |
973 | } | 976 | } |
974 | 977 | ||
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index 501b7f8b739f..41e6a04a561f 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -76,6 +76,7 @@ struct the_nilfs *alloc_nilfs(struct block_device *bdev) | |||
76 | nilfs->ns_bdev = bdev; | 76 | nilfs->ns_bdev = bdev; |
77 | atomic_set(&nilfs->ns_ndirtyblks, 0); | 77 | atomic_set(&nilfs->ns_ndirtyblks, 0); |
78 | init_rwsem(&nilfs->ns_sem); | 78 | init_rwsem(&nilfs->ns_sem); |
79 | mutex_init(&nilfs->ns_snapshot_mount_mutex); | ||
79 | INIT_LIST_HEAD(&nilfs->ns_dirty_files); | 80 | INIT_LIST_HEAD(&nilfs->ns_dirty_files); |
80 | INIT_LIST_HEAD(&nilfs->ns_gc_inodes); | 81 | INIT_LIST_HEAD(&nilfs->ns_gc_inodes); |
81 | spin_lock_init(&nilfs->ns_inode_lock); | 82 | spin_lock_init(&nilfs->ns_inode_lock); |
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index ef40a510e2f3..2558f320b821 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -47,6 +47,7 @@ enum { | |||
47 | * @ns_flags: flags | 47 | * @ns_flags: flags |
48 | * @ns_bdev: block device | 48 | * @ns_bdev: block device |
49 | * @ns_sem: semaphore for shared states | 49 | * @ns_sem: semaphore for shared states |
50 | * @ns_snapshot_mount_mutex: mutex to protect snapshot mounts | ||
50 | * @ns_sbh: buffer heads of on-disk super blocks | 51 | * @ns_sbh: buffer heads of on-disk super blocks |
51 | * @ns_sbp: pointers to super block data | 52 | * @ns_sbp: pointers to super block data |
52 | * @ns_sbwtime: previous write time of super block | 53 | * @ns_sbwtime: previous write time of super block |
@@ -100,6 +101,7 @@ struct the_nilfs { | |||
100 | 101 | ||
101 | struct block_device *ns_bdev; | 102 | struct block_device *ns_bdev; |
102 | struct rw_semaphore ns_sem; | 103 | struct rw_semaphore ns_sem; |
104 | struct mutex ns_snapshot_mount_mutex; | ||
103 | 105 | ||
104 | /* | 106 | /* |
105 | * used for | 107 | * used for |