From patchwork Thu Jul 2 16:51:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 11639819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E10D161F for ; Thu, 2 Jul 2020 16:51:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFD112088E for ; Thu, 2 Jul 2020 16:51:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QmvJf2X/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFD112088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 104706B00A8; Thu, 2 Jul 2020 12:51:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0DD7B6B00AB; Thu, 2 Jul 2020 12:51:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0BC56B00BF; Thu, 2 Jul 2020 12:51:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id DA1456B00A8 for ; Thu, 2 Jul 2020 12:51:38 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1C3A22472 for ; Thu, 2 Jul 2020 16:51:38 +0000 (UTC) X-FDA: 76993727076.20.key37_390953826e8a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id BAB77180C0614 for ; Thu, 2 Jul 2020 16:51:28 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,agruenba@redhat.com,,RULES_HIT:4705:30003:30054:30070:30090,0,RBL:207.211.31.120:@redhat.com:.lbl8.mailshell.net-66.10.201.10 62.18.0.100;04y8r917kp1gmr1so5zhw6j5npprcycrygbkezs7z3mo9eosyeqf4xc8a75mfnj.rroo469q6yozinj9pga7jueqra3fynaouccbwhwenyqg5zqf5y8n55s8hehjext.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: key37_390953826e8a X-Filterd-Recvd-Size: 3778 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jul 2020 16:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593708687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AS1biAZZYrc6DCalhh6zy/9YtnCnXv1oypGIRKow0Tc=; b=QmvJf2X/YUbQo00Zm3znJUBFZaoMsq5MQ21OkZv0mgRgug0MJYJ1KcrPMbFdeF27FB2FnL Fr/AS1Rll9fcm0t1eb46bM12wNcPPII2TfZrcWMKDdA7O/5HHv/A99YbAWeK+fJyheQoM8 XVPQbbQYxXRs03m7cqXNfI3dq03WtKM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-ySEhn9NpMCaMKedzkGkJtQ-1; Thu, 02 Jul 2020 12:51:25 -0400 X-MC-Unique: ySEhn9NpMCaMKedzkGkJtQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94898107ACF5; Thu, 2 Jul 2020 16:51:24 +0000 (UTC) Received: from max.home.com (unknown [10.40.192.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7822379231; Thu, 2 Jul 2020 16:51:22 +0000 (UTC) From: Andreas Gruenbacher To: Matthew Wilcox Cc: Dave Chinner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andreas Gruenbacher Subject: [RFC 0/4] Fix gfs2 readahead deadlocks Date: Thu, 2 Jul 2020 18:51:16 +0200 Message-Id: <20200702165120.1469875-1-agruenba@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Rspamd-Queue-Id: BAB77180C0614 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi all, commit d4388340ae0b ("fs: convert mpage_readpages to mpage_readahead") converted gfs2 and other filesystems from the ->readpages to the ->readahead address space operation. Due to gfs2 doing its locking in the ->readpage and ->readahead address space operations rather than at a higher level, this is leading to deadlocks. Switching to a trylock operation in ->readahead improves things but doesn't eliminate all deadlocks; the only reasonable fix seems to be to lift gfs2's locking to the ->fault vm operation and ->read_iter file operation. However, gfs2 includes an optimization that allows reads to be served out of the page cache without any filesystem locking. This optimization is important in concurrent read scenarios. The best way we could find to preserve this optimization is by introducing a new IOCB_NOIO flag for generic_file_read_iter. Introducing this new flag may be too big a change for 5.8. So this patch queue takes a different approach: it first walks back gfs2's conversion to ->readahead. Then it introduces IOCB_NOIO, fixes the locking, and re-applies the readahead conversion. Of this patch queue, either only the first patch or all four patches can be applied to fix gfs2's current issues in 5.8. Please let me know what you think. Thanks, Andreas Andreas Gruenbacher (4): gfs2: Revert readahead conversion fs: Add IOCB_NOIO flag for generic_file_read_iter gfs2: Rework read and page fault locking gfs2: Reinstate readahead conversion fs/gfs2/aops.c | 45 +------------------------------------ fs/gfs2/file.c | 55 ++++++++++++++++++++++++++++++++++++++++++++-- include/linux/fs.h | 1 + mm/filemap.c | 16 ++++++++++++-- 4 files changed, 69 insertions(+), 48 deletions(-)