diff options
author | Jiro SEKIBA <jir@unicus.jp> | 2010-02-20 19:47:49 +0900 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-02-20 21:18:19 +0900 |
commit | 0d561f12b490dd2b993d73112d3297007688e6df (patch) | |
tree | 3c754966cb9ec6647048ae2fd41428c9fa4b1b84 /fs/nilfs2 | |
parent | 03f29365e84ff6d651be4e6186e0400ca59da6cd (diff) | |
download | op-kernel-dev-0d561f12b490dd2b993d73112d3297007688e6df.zip op-kernel-dev-0d561f12b490dd2b993d73112d3297007688e6df.tar.gz |
nilfs2: add reader's lock for cno in nilfs_ioctl_sync
This adds reader's lock for the_nilfs->cno in nilfs_ioctl_sync,
for the_nilfs->cno should be proctected by segctor_sem when reading.
Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/ioctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 8e5cad0..313d0a2 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c @@ -601,13 +601,17 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp, { __u64 cno; int ret; + struct the_nilfs *nilfs; ret = nilfs_construct_segment(inode->i_sb); if (ret < 0) return ret; if (argp != NULL) { - cno = NILFS_SB(inode->i_sb)->s_nilfs->ns_cno - 1; + nilfs = NILFS_SB(inode->i_sb)->s_nilfs; + down_read(&nilfs->ns_segctor_sem); + cno = nilfs->ns_cno - 1; + up_read(&nilfs->ns_segctor_sem); if (copy_to_user(argp, &cno, sizeof(cno))) return -EFAULT; } |