[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24655.1530695695@warthog.procyon.org.uk>
Date: Wed, 04 Jul 2018 10:14:55 +0100
From: David Howells <dhowells@...hat.com>
To: NeilBrown <neilb@...e.com>
Cc: dhowells@...hat.com, Andrew Morton <akpm@...ux-foundation.org>,
Anthony DeRobertis <aderobertis@...rics.net>,
linux-cachefs@...hat.com, linux-kernel@...r.kernel.org,
Lei Xue <carmark.dlut@...il.com>,
Vegard Nossum <vegard.nossum@...il.com>,
Daniel Axtens <dja@...ens.net>,
KiranKumar Modukuri <kiran.modukuri@...il.com>
Subject: Re: [PATCH] cachefiles: fix multiple-put race.
NeilBrown <neilb@...e.com> wrote:
> + fscache_enqueue_retrieval(monitor->op);
> +
> spin_lock(&object->work_lock);
> list_add_tail(&monitor->op_link, &monitor->op->to_do);
> spin_unlock(&object->work_lock);
>
> - fscache_enqueue_retrieval(monitor->op);
That won't necessarily work because the work processor can then happen before
you've added the work to the to_do list.
I'm thinking that KiranKumar's solution might be the best one.
The problem is that cachefiles_read_waiter() doesn't have a ref on the monitor
object but is entirely dependent on the waitqueue lock for safety. I think
KiranKumar's patch is correct to take a ref before doing the queuing. It
might be possible to then pass this along to the work processor, but that
might be too fiddly.
Actually, I want to get rid of the page monitoring stuff entirely as it's
quite fragile and use an iterator and direct-IO instead, but we have to fix
this for now.
David
Powered by blists - more mailing lists