Fix potential race over inotify mark list access. Accessing mark entries chain should be done with protection. At least we need @mark_lock to be taken when we're dumping things. This patch should eliminate possible "race" candidate for https://jira.sw.ru/browse/PSBM-31567 QA: Please run LTP inotify tests together with suspend/resume. Signed-off-by: Cyrill Gorcunov CC: Andrew Vagin CC: Kirill Tkhai CC: Kir Kolyshkin CC: Pavel Emelyanov --- kernel/cpt/cpt_inotify.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-rhel6.git/kernel/cpt/cpt_inotify.c =================================================================== --- linux-rhel6.git.orig/kernel/cpt/cpt_inotify.c +++ linux-rhel6.git/kernel/cpt/cpt_inotify.c @@ -77,7 +77,7 @@ static int cpt_dump_watches(struct fsnot struct cpt_inotify_wd_image wi; loff_t saved_obj; - /* FIXME locking */ + spin_lock(&g->mark_lock); list_for_each_entry(fse, &g->mark_entries, g_list) { struct nameidata nd; @@ -127,6 +127,7 @@ static int cpt_dump_watches(struct fsnot if (err) break; } + spin_unlock(&g->mark_lock); return err; }