From: Zhang Qiang <zhangqiang.buaa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: users-JrjvKiOkagjYtjvyW6yDsg@public.gmane.org
Cc: Zhang Qiang
<qiang.z.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Zhu Yanhai <yanhai.zhu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: [PATCH]nilfs2:missing a read lock for segment writer in nilfs_attach_checkpoint()
Date: Tue, 18 Aug 2009 14:58:24 +0800 [thread overview]
Message-ID: <4A8A5110.6080806@gmail.com> (raw)
'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
next reply other threads:[~2009-08-18 6:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-18 6:58 Zhang Qiang [this message]
[not found] ` <4A8A5110.6080806-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-08-18 9:37 ` [PATCH]nilfs2:missing a read lock for segment writer in nilfs_attach_checkpoint() Ryusuke Konishi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A8A5110.6080806@gmail.com \
--to=zhangqiang.buaa-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=qiang.z.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=users-JrjvKiOkagjYtjvyW6yDsg@public.gmane.org \
--cc=yanhai.zhu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox