summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2013-10-07 15:51:59 -0700
committerChanho Park <chanho61.park@samsung.com>2014-11-21 19:12:26 +0900
commit66d2009169bb981072c32c618aca2b203d6bf897 (patch)
tree0d180c395bdba6c5d19e1d025e2d015e15cd0442 /fs
parent384b43ecf124f8f0959e92252b0a0c1b4996fe0c (diff)
downloadlinux-3.10-66d2009169bb981072c32c618aca2b203d6bf897.tar.gz
linux-3.10-66d2009169bb981072c32c618aca2b203d6bf897.tar.bz2
linux-3.10-66d2009169bb981072c32c618aca2b203d6bf897.zip
seqcount: Add lockdep functionality to seqcount/seqlock structures
Currently seqlocks and seqcounts don't support lockdep. After running across a seqcount related deadlock in the timekeeping code, I used a less-refined and more focused variant of this patch to narrow down the cause of the issue. This is a first-pass attempt to properly enable lockdep functionality on seqlocks and seqcounts. Since seqcounts are used in the vdso gettimeofday code, I've provided non-lockdep accessors for those needs. I've also handled one case where there were nested seqlock writers and there may be more edge cases. Comments and feedback would be appreciated! Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Li Zefan <lizefan@huawei.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: netdev@vger.kernel.org Link: http://lkml.kernel.org/r/1381186321-4906-3-git-send-email-john.stultz@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c4
-rw-r--r--fs/fs_struct.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 25c0a1b5f6c..42940307255 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2252,7 +2252,7 @@ static void __d_move(struct dentry * dentry, struct dentry * target)
dentry_lock_for_move(dentry, target);
write_seqcount_begin(&dentry->d_seq);
- write_seqcount_begin(&target->d_seq);
+ write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED);
/* __d_drop does write_seqcount_barrier, but they're OK to nest. */
@@ -2384,7 +2384,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
dentry_lock_for_move(anon, dentry);
write_seqcount_begin(&dentry->d_seq);
- write_seqcount_begin(&anon->d_seq);
+ write_seqcount_begin_nested(&anon->d_seq, DENTRY_D_LOCK_NESTED);
dparent = dentry->d_parent;
diff --git a/fs/fs_struct.c b/fs/fs_struct.c
index d8ac61d0c93..7dca743b2ce 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -161,6 +161,6 @@ EXPORT_SYMBOL(current_umask);
struct fs_struct init_fs = {
.users = 1,
.lock = __SPIN_LOCK_UNLOCKED(init_fs.lock),
- .seq = SEQCNT_ZERO,
+ .seq = SEQCNT_ZERO(init_fs.seq),
.umask = 0022,
};