Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319963
b: refs/heads/master
c: 572d8b3
h: refs/heads/master
i:
  319961: 3ca9e30
  319959: 55d6973
v: v3
  • Loading branch information
Ryusuke Konishi authored and Linus Torvalds committed Jul 31, 2012
1 parent a9c2a4a commit 2c9561b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fe0627e7b3d32a41c16fac6e0af091991545865e
refs/heads/master: 572d8b3945a31bee7c40d21556803e4807fd9141
4 changes: 2 additions & 2 deletions trunk/fs/nilfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp,
if (copy_from_user(&cpmode, argp, sizeof(cpmode)))
goto out;

down_read(&inode->i_sb->s_umount);
mutex_lock(&nilfs->ns_snapshot_mount_mutex);

nilfs_transaction_begin(inode->i_sb, &ti, 0);
ret = nilfs_cpfile_change_cpmode(
Expand All @@ -192,7 +192,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp,
else
nilfs_transaction_commit(inode->i_sb); /* never fails */

up_read(&inode->i_sb->s_umount);
mutex_unlock(&nilfs->ns_snapshot_mount_mutex);
out:
mnt_drop_write_file(filp);
return ret;
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,8 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno,
struct nilfs_root *root;
int ret;

mutex_lock(&nilfs->ns_snapshot_mount_mutex);

down_read(&nilfs->ns_segctor_sem);
ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno);
up_read(&nilfs->ns_segctor_sem);
Expand All @@ -969,6 +971,7 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno,
ret = nilfs_get_root_dentry(s, root, root_dentry);
nilfs_put_root(root);
out:
mutex_unlock(&nilfs->ns_snapshot_mount_mutex);
return ret;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/fs/nilfs2/the_nilfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct the_nilfs *alloc_nilfs(struct block_device *bdev)
nilfs->ns_bdev = bdev;
atomic_set(&nilfs->ns_ndirtyblks, 0);
init_rwsem(&nilfs->ns_sem);
mutex_init(&nilfs->ns_snapshot_mount_mutex);
INIT_LIST_HEAD(&nilfs->ns_dirty_files);
INIT_LIST_HEAD(&nilfs->ns_gc_inodes);
spin_lock_init(&nilfs->ns_inode_lock);
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/nilfs2/the_nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum {
* @ns_flags: flags
* @ns_bdev: block device
* @ns_sem: semaphore for shared states
* @ns_snapshot_mount_mutex: mutex to protect snapshot mounts
* @ns_sbh: buffer heads of on-disk super blocks
* @ns_sbp: pointers to super block data
* @ns_sbwtime: previous write time of super block
Expand Down Expand Up @@ -100,6 +101,7 @@ struct the_nilfs {

struct block_device *ns_bdev;
struct rw_semaphore ns_sem;
struct mutex ns_snapshot_mount_mutex;

/*
* used for
Expand Down

0 comments on commit 2c9561b

Please sign in to comment.