Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp514126yba; Mon, 1 Apr 2019 10:49:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpAVC1eU+73ahpZceQZ7Pm4CETldjZi1PMVs2V5FdPcg1wlOpmxcxT/hTO4usfubdgbuBU X-Received: by 2002:a63:4612:: with SMTP id t18mr61803370pga.56.1554140975315; Mon, 01 Apr 2019 10:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554140975; cv=none; d=google.com; s=arc-20160816; b=uSbIIU2iQta5d/zeSsLE/tNsqDUxBGyvcpHwUJaKjNp7Vf6OSlY75Nh+JK0XB4PXGT Sqt5qjEhuP8EEtznMy713T+sKYVAG1smEdtA5nVYuoZgwzkq2aUao1mKAnP/Z4mDdDjp 7iaX8Er08t1bTeYXhITh05G0Igbj0Nq0kPoC9vv7sbUIvwBRdvZXv7q3PEdEb5eF1kuI 7oO/O1PQLw7qw4G05teEUJmRp+dAdzh/Az82nRvZsZP8zC+qX3QLYOXDVn+Hq7D6rpuN EgGy1k/zSNjvHqI948em1L8YfcaYsq6uDfePfd5p8DIWBhcyEQemmRm2MUraJ6kvWQnT vpfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yP23ifOtkTlpbg4zgJPD3fjeqlOmnxXqO7DrOc6eCZU=; b=mgr0EdReVZZvFUVdCvnWfiZ9Hu3sB4xPmhX4AKBLsWj7mjOGoTazgJko03mEQLRE2J SpNCNTtaOZEafur2/nHcwx/iGyRxGeVjwHjEn/65o1CjevsBp75r5BUpAbkejV65Z56c HN1Dbo+xyU48/58loyCeekFC6ONzhSpAAx1jxSA2cAaScwbBSyyBBltt5KNe/BYEdrq7 FwcVGJmaapWD4o3HXCSoP74i2hZqxQ/7GOIt42M4nLxPwyd6juFswMxx7WWDbuzPvysE V9vlBcyVHRsipUDLbeRGr4SLDsVRGZvbKqzTc7ZSP37OewaFstRV1aQB8oQfPRqeDr6X qJ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bXu0/cqq"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si8957448pgs.438.2019.04.01.10.49.19; Mon, 01 Apr 2019 10:49:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bXu0/cqq"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733156AbfDARas (ORCPT + 99 others); Mon, 1 Apr 2019 13:30:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:37852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732925AbfDARao (ORCPT ); Mon, 1 Apr 2019 13:30:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 983042070B; Mon, 1 Apr 2019 17:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139843; bh=sj56pi+oNBZ8sAnlCZtiXvd7qWVHcqU3jYhcOtSdcDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXu0/cqqExDG8yETtiHVAuGc1mAu4NFUJ8aS+XscPr1BZBTkSELeiAf3E2leK6qjh GdL2mdBQp2UTJWhhEbUK3al2r48Un4pgsUGrDOGklRdtP4L0eRVtASGpqWyxjBtzNk 3pojt6vtmt6VCsrMgVxAcP02D37WVYSPvQi4saYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Arnd Bergmann Subject: [PATCH 4.4 030/131] Hang/soft lockup in d_invalidate with simultaneous calls Date: Mon, 1 Apr 2019 19:01:40 +0200 Message-Id: <20190401170054.608426428@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170051.645954551@linuxfoundation.org> References: <20190401170051.645954551@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit 81be24d263dbeddaba35827036d6f6787a59c2c3 upstream. It's not hard to trigger a bunch of d_invalidate() on the same dentry in parallel. They end up fighting each other - any dentry picked for removal by one will be skipped by the rest and we'll go for the next iteration through the entire subtree, even if everything is being skipped. Morevoer, we immediately go back to scanning the subtree. The only thing we really need is to dissolve all mounts in the subtree and as soon as we've nothing left to do, we can just unhash the dentry and bugger off. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- fs/dcache.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1510,7 +1510,7 @@ static void check_and_drop(void *_data) { struct detach_data *data = _data; - if (!data->mountpoint && !data->select.found) + if (!data->mountpoint && list_empty(&data->select.dispose)) __d_drop(data->select.start); } @@ -1552,17 +1552,15 @@ void d_invalidate(struct dentry *dentry) d_walk(dentry, &data, detach_and_collect, check_and_drop); - if (data.select.found) + if (!list_empty(&data.select.dispose)) shrink_dentry_list(&data.select.dispose); + else if (!data.mountpoint) + return; if (data.mountpoint) { detach_mounts(data.mountpoint); dput(data.mountpoint); } - - if (!data.mountpoint && !data.select.found) - break; - cond_resched(); } }