* [PATCH]nilfs2:missing a read lock for segment writer in nilfs_attach_checkpoint()
@ 2009-08-18 6:58 Zhang Qiang
[not found] ` <4A8A5110.6080806-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qiang @ 2009-08-18 6:58 UTC (permalink / raw)
To: users-JrjvKiOkagjYtjvyW6yDsg; +Cc: Zhang Qiang, Zhu Yanhai
'ns_cno' of structure 'the_nilfs' must be protected from segment writer, in other words,
the caller of nilfs_get_check_point 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
fs/nilfs2/super.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 05174c5..55f3d6b 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -371,8 +371,10 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
if (unlikely(err))
goto failed;
+ down_read(&nilfs->ns_segctor_sem);
err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp,
&bh_cp);
+ up_read(&nilfs->ns_segctor_sem);
if (unlikely(err)) {
if (err == -ENOENT || err == -EINVAL) {
printk(KERN_ERR
--
1.6.0.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-18 9:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 6:58 [PATCH]nilfs2:missing a read lock for segment writer in nilfs_attach_checkpoint() Zhang Qiang
[not found] ` <4A8A5110.6080806-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-08-18 9:37 ` Ryusuke Konishi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.