All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Dave Wysochanski <dwysocha@redhat.com>
Cc: dhowells@redhat.com, Daire Byrne <daire.byrne@gmail.com>,
	Benjamin Maynard <benmaynard@google.com>,
	linux-cachefs@redhat.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] fscache: Fix oops due to race with cookie_lru and use_cookie
Date: Thu, 17 Nov 2022 13:30:37 +0000	[thread overview]
Message-ID: <3715748.1668691837@warthog.procyon.org.uk> (raw)
In-Reply-To: <20221117115023.1350181-2-dwysocha@redhat.com>

Dave Wysochanski <dwysocha@redhat.com> wrote:

> If a cookie expires from the LRU and the LRU_DISCARD flag is set,
> but the state machine has not run yet, it's possible another thread
> can call fscache_use_cookie and begin to use it.  When the
> cookie_worker finally runs, it will see the LRU_DISCARD flag set,
> transition the cookie->state to LRU_DISCARDING, which will then
> withdraw the cookie.  Once the cookie is withdrawn the object is
> removed the below oops will occur because the object associated
> with the cookie is now NULL.
> 
> Fix the oops by clearing the LRU_DISCARD bit if another thread
> uses the cookie before the cookie_worker runs.

I think this is the right approach.  The state machine should just fall
through without doing anything, despite having been woken.

David


  parent reply	other threads:[~2022-11-17 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 11:50 [PATCH 0/1] Fix oops in cachefiles_prepare_write due to cookie_lru and use_cookie race Dave Wysochanski
2022-11-17 11:50 ` [PATCH 1/1] fscache: Fix oops due to race with cookie_lru and use_cookie Dave Wysochanski
2022-11-17 13:30 ` David Howells [this message]
2022-11-17 13:36 ` David Howells
2022-11-17 13:52 ` David Howells
2022-11-17 14:10   ` David Wysochanski
2022-11-22  8:00 ` [PATCH 0/1] Fix oops in cachefiles_prepare_write due to cookie_lru and use_cookie race Daire Byrne

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=3715748.1668691837@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=benmaynard@google.com \
    --cc=daire.byrne@gmail.com \
    --cc=dwysocha@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-nfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.