Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1642137
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Khazhismel Kumykov <khazhy@google.com> |
| Newsgroups | linux.kernel |
| Subject | Hang/soft lockup in d_invalidate with simultaneous calls |
| Date | Tue, 16 May 2017 02:10:01 +0200 |
| Message-ID | <tHydP-6FF-3@gated-at.bofh.it> (permalink) |
| X-Original-To | linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=77tAWZWgCYi1RZJwzx8WnURDosYVQCZvwsX0tVmiiYA=; b=S7uzMbzWIQPrN+2s5mle56cdsWzbmq18YYoTAu5F6dg+qbUBKuoiyWgojbdPAMGiKb zautQ0ujIbFTBjNOmwvMNgWNfnXQ9gcPULb1nn/iiP/clmZ4TfXxKEMGC4/8WF7kBoQR KsFMnqv5aReur5qLq9MS3OLKyv7wm0ZkWOrJkt3vYW11DuHIy+oKhjCDZPtU0G1pFBj9 kYYrxrp/ZFgPRU6UPYbQkVJN6eUbMmGTK71HzehD03CBTzPIFTyzLzxRk5GrfExzy/Dq hAl0LsljXGJkaFxsMbh3QI0DqiT+5NA9qm9I4QbJ/OwYZ3lL3IIcFn5q4sBxETlSnk21 dkAg== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=77tAWZWgCYi1RZJwzx8WnURDosYVQCZvwsX0tVmiiYA=; b=cHbTRHHZsjrjRwRpvxuAsSRjYxSrIp7SKu5kDax97npmuJkACKn2pQbWze6/Oj6HKZ oavn7iKA2MPVpi4+eXjGwJCFT0JsbqKlnw7lHI4rQ+y81SsU7mAWXrIpQ7BfjUz59oHn IfT1vT4TSPt0jJXOQP4jHK8c1lLcxNu8183K6UUn0rPdPmv+r20iKLKF/2SN56SHoRn2 TlEmVeByZeXt/X4A1LYp+/1iLNRvDrvvf4858QRxScuAWhD5UEuyH+/9mpgOSzg4yLBE mmDp1kaEbhatsPcaZck3Uu9qPGc5tEuYF7/zj4ukrvM7G4qONw6vl1im8798R7B5a2QV M8Fg== |
| X-Gm-Message-State | AODbwcBsA8U90jtA2gheFqJSt0MKmbI8swaEVJH64OeU9+Ho7TKNK6Ok 5XnZYmLdbK9aBbhiKLdzjUwWKIW/SCRM |
| X-Received | by 10.84.128.65 with SMTP id 59mr11846473pla.121.1494893104904; Mon, 15 May 2017 17:05:04 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="94eb2c124ae8834ddf054f98ec9d" |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 151 |
| Organization | linux.* mail to news gateway |
| X-Original-Date | Mon, 15 May 2017 17:05:04 -0700 |
| X-Original-Message-ID | <CACGdZYJBAYz3MXb18i=T91hD5TNFvCXUJH7ByvnJC1BTxjq6pA@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1642137 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi,
I'm seeing behavior in d_invalidate, if multiple threads call d_invalidate on
the same tree at the same, behavior time blows up and all the calls hang with
large enough trees/enough simultaneous callers. (e.g. a directory w/ 100k
entries in d_subdir, and 5 or so threads calling d_invalidate was able to hang
my test VMs)
This seems to be due to thrashing on the dentry locks in multiple threads
tightly looping calling d_walk waiting for a shrink_dentry_list call (also
thrashing the locks) to complete. (d_invalidate loops calling d_walk so long as
any dentry in the tree is in a dcache shrink list).
There was a similar report recently "soft lockup in d_invalidate()" that
proposed in the d_invalidate d_walk to ignore dentries marked as in a shrink
list already, which does prevent this hang/lockup in this case as well, although
I'm not sure it doesn't violate the contract for d_invalidate. (Although the
entries in a shrink list should be dropped eventually, not necessarily by the
time d_invalidate returns).
If someone more familiar with the dcache could provide input I would appreciate.
A reliable repro on mainline is:
- create a mountpoint with DCACHE_OP_REVALIDATE, e.g. fuse passthrough
- create a directory and populate with ~100k files with content to
populate dcache
- create some background processes opening/reading files in this folder (5
while true; cat $file was enough to get an indefinite hang for me)
- cause the directory to need to be invalidated (e.g., make_bad_inode on the
directory)
This results in the background processes all entering d_invalidate and hanging,
while with just one process in d_invalidate (e.g., stat'ing a file in the dir)
things go pretty quickly as expected.
(The proposed patch from other thread)
diff --git a/fs/dcache.c b/fs/dcache.c
index 7b8feb6..3a3b0f37 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1364,7 +1364,7 @@ static enum d_walk_ret select_collect(void *_data,
struct dentry *dentry)
goto out;
if (dentry->d_flags & DCACHE_SHRINK_LIST) {
- data->found++;
+ goto out;
} else {
if (dentry->d_flags & DCACHE_LRU_LIST)
d_lru_del(dentry);
khazhy
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Hang/soft lockup in d_invalidate with simultaneous calls Khazhismel Kumykov <khazhy@google.com> - 2017-05-16 02:10 +0200
Re: Hang/soft lockup in d_invalidate with simultaneous calls Khazhismel Kumykov <khazhy@google.com> - 2017-05-18 00:00 +0200
Re: Hang/soft lockup in d_invalidate with simultaneous calls Khazhismel Kumykov <khazhy@google.com> - 2017-05-22 20:20 +0200
csiph-web