]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0145-fs-namespace-preemption-fix.patch
Fix memguard and related syscalls
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0145-fs-namespace-preemption-fix.patch
1 From 1a7fcab0fb255e03887ede8f164f9c28d5ec2ca4 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Sun, 19 Jul 2009 08:44:27 -0500
4 Subject: [PATCH 145/366] fs: namespace preemption fix
5
6 On RT we cannot loop with preemption disabled here as
7 mnt_make_readonly() might have been preempted. We can safely enable
8 preemption while waiting for MNT_WRITE_HOLD to be cleared. Safe on !RT
9 as well.
10
11 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
12 ---
13  fs/namespace.c | 5 ++++-
14  1 file changed, 4 insertions(+), 1 deletion(-)
15
16 diff --git a/fs/namespace.c b/fs/namespace.c
17 index 5be02a0..97f7f9f 100644
18 --- a/fs/namespace.c
19 +++ b/fs/namespace.c
20 @@ -353,8 +353,11 @@ int __mnt_want_write(struct vfsmount *m)
21          * incremented count after it has set MNT_WRITE_HOLD.
22          */
23         smp_mb();
24 -       while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD)
25 +       while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) {
26 +               preempt_enable();
27                 cpu_relax();
28 +               preempt_disable();
29 +       }
30         /*
31          * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
32          * be set to match its requirements. So we must not load that until
33 -- 
34 1.9.1
35