nilfs2: missing a read lock for segment writer in nilfs_attach_checkpoint()

'ns_cno' of structure 'the_nilfs' must be protected from segment
writer, in other words, the caller of nilfs_get_checkpoint should hold
read lock for nilfs->ns_segctor_sem. This patch adds the lock/unlock
operations in nilfs_attach_checkpoint() when calling
nilfs_cpfile_get_checkpoint().

Signed-off-by: Zhang Qiang <zhangqiang.buaa@gmail.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

authored by Zhang Qiang and committed by Ryusuke Konishi 1154ecbd 64f1607f

+2
+2
fs/nilfs2/super.c
··· 416 if (unlikely(err)) 417 goto failed; 418 419 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, 420 &bh_cp); 421 if (unlikely(err)) { 422 if (err == -ENOENT || err == -EINVAL) { 423 printk(KERN_ERR
··· 416 if (unlikely(err)) 417 goto failed; 418 419 + down_read(&nilfs->ns_segctor_sem); 420 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, 421 &bh_cp); 422 + up_read(&nilfs->ns_segctor_sem); 423 if (unlikely(err)) { 424 if (err == -ENOENT || err == -EINVAL) { 425 printk(KERN_ERR