mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: David Howells <dhowells@redhat.com>
Cc: dhowells@redhat.com, linux-cachefs@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fscache: fix race between enablement and dropping of object
Date: Thu, 29 Nov 2018 07:18:23 +1100	[thread overview]
Message-ID: <878t1dot0w.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <10285.1543417950@warthog.procyon.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]

On Wed, Nov 28 2018, David Howells wrote:

> NeilBrown <neilb@suse.com> wrote:
>
>> It was observed that a process blocked indefintely in
>> __fscache_read_or_alloc_page(), waiting for FSCACHE_COOKIE_LOOKING_UP
>> to be cleared via fscache_wait_for_deferred_lookup().
>
> Was there a backtrace for that?

Yes.
PID: 29360  TASK: ffff881ff2ac0f80  CPU: 3   COMMAND: "zsh"
 #0 [ffff881ff43efbf8] schedule at ffffffff815e56f1
 #1 [ffff881ff43efc58] bit_wait at ffffffff815e64ed
 #2 [ffff881ff43efc68] __wait_on_bit at ffffffff815e61b8
 #3 [ffff881ff43efca0] out_of_line_wait_on_bit at ffffffff815e625e
 #4 [ffff881ff43efd08] fscache_wait_for_deferred_lookup at ffffffffa04f2e8f
[fscache]
 #5 [ffff881ff43efd18] __fscache_read_or_alloc_page at ffffffffa04f2ffe
[fscache]
 #6 [ffff881ff43efd58] __nfs_readpage_from_fscache at ffffffffa0679668 [nfs]
 #7 [ffff881ff43efd78] nfs_readpage at ffffffffa067092b [nfs]
 #8 [ffff881ff43efda0] generic_file_read_iter at ffffffff81187a73
 #9 [ffff881ff43efe50] nfs_file_read at ffffffffa066544b [nfs]
#10 [ffff881ff43efe70] __vfs_read at ffffffff811fc756
#11 [ffff881ff43efee8] vfs_read at ffffffff811fccfa
#12 [ffff881ff43eff18] sys_read at ffffffff811fda62
#13 [ffff881ff43eff50] entry_SYSCALL_64_fastpath at ffffffff815e986e

This is in SLES12-SP2 which is based on Linux-4.4

>
>> This leaves a window where something else can set FSCACHE_COOKIE_LOOKING_UP
>
> Attempting to enable the cookie again would have that effect.
>
>> There is some uncertainty in this analysis, but it seems to be fit the
>> observations.  Adding the wake in this patch will be handled correctly
>> by __fscache_read_or_alloc_page(), as it checks if ->backing_objects
>> is empty again, after waiting.
>
> That should work.  The read op should just then fail with -ENOBUFS, causing
> the netfs to issue the read over the network instead.
>
> I think there's a more elegant solution to be had, but it'll take some thought
> as to how to achieve it.

Please let me know when you come up with something.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

      reply	other threads:[~2018-11-28 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26  6:16 NeilBrown
2018-11-28 15:12 ` David Howells
2018-11-28 20:18   ` NeilBrown [this message]

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=878t1dot0w.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®