Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2250030ybd; Mon, 24 Jun 2019 03:18:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfIXabPf2AoXh50dWv/g816mNNPto/BWtqMruSvX56dUBr1I2CyuhVXRi5bOwzIX0zSnns X-Received: by 2002:a17:902:8c83:: with SMTP id t3mr119752874plo.93.1561371483333; Mon, 24 Jun 2019 03:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371483; cv=none; d=google.com; s=arc-20160816; b=J6NKuLgeBf1ZLl3kKUVW7y1jIeL5AeCcNNRvSRMI9QQCaTpTaikMZM1+YiPLh42Jrf kxGKB9RhTzSYdzvd6ykfXEugY/UbX8Gq1llhn1+KGGSdgzgvhiej8pw4aLDN4cKgCBJe QkihggJosAhjjuG0zQKjLAQUhY+7cd6RPRHfCBT/wajNwo4Qd/RcyK/Jm/Qqjg70JhBt a473m3feHDBey/OBGZ8zUa0QvCo9MNDRcSH0xrqci0dHwnO3MmM7+/ru6i+cqpcZLulP yTSDGKLTUNUuk2Ia2iQJp6+Z9SbQdur0ozoVwxZM7QQswk7gC9Pp0l0+uF3Lnd/rXcU8 ET6w== 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=0dZocZw6HkuCUd4/FD2JpbqjaiOR7Tm/a33Sc3CJNBM=; b=dBSdMm3QoLWnJPVsSRKpK6x8x3zWzfQbtGWCy/GFOBPVPF+I816nMJbNsK6Yw6Ss95 BfSrAWGl5OAw265M6HoKyKZkfnKu+kNqlltfqpRVZzqkc4uVDTATYklOx3LfibFsWh9E yOzoQESYMYspcmDi7HaaucEuImRhaG7S0LuUA27kwx81py2lqHpnEy+FvgUbLmXWwRXH c35FFEktYXlPO7Q1l+KJ56K3CHDWw0XTcjNEMYbGMfgN0swZOWeGv0bW6op7kb3mMRvK kd/JTbQlarz3+cBW6YQZNuO3WHzitFo8+8QZXw4pWJdq9EwEDyixUg4V0jCFvdmsEETL rXZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cvHFW7xN; 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 a5si9865919pfc.245.2019.06.24.03.17.47; Mon, 24 Jun 2019 03:18:03 -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=cvHFW7xN; 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 S1730826AbfFXKQy (ORCPT + 99 others); Mon, 24 Jun 2019 06:16:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:54372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730801AbfFXKQt (ORCPT ); Mon, 24 Jun 2019 06:16:49 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (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 4FA8C2146F; Mon, 24 Jun 2019 10:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371408; bh=CnQAIDsK/qngiQI4aLOMQNGqTdbXr98z9kcIyjCyOKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvHFW7xNZEgj4+IodIexrw4Mrpg7+wuq14FsPksI263psoaW5eEOVgd3S9A6mPU17 iIlSi94jEIpDHTrjK9RBBT6Kg8731EC0A62rfF065XCcjY4wpnkx4KUGeecF71riOy GhvRAgVWrV8YpXRlS1uSTMz4txJPntx4JKQDrLWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Naohiro Aota , David Sterba Subject: [PATCH 5.1 092/121] btrfs: start readahead also in seed devices Date: Mon, 24 Jun 2019 17:57:04 +0800 Message-Id: <20190624092325.492365383@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Naohiro Aota commit c4e0540d0ad49c8ceab06cceed1de27c4fe29f6e upstream. Currently, btrfs does not consult seed devices to start readahead. As a result, if readahead zone is added to the seed devices, btrfs_reada_wait() indefinitely wait for the reada_ctl to finish. You can reproduce the hung by modifying btrfs/163 to have larger initial file size (e.g. xfs_io pwrite 4M instead of current 256K). Fixes: 7414a03fbf9e ("btrfs: initial readahead code and prototypes") Cc: stable@vger.kernel.org # 3.2+: ce7791ffee1e: Btrfs: fix race between readahead and device replace/removal Cc: stable@vger.kernel.org # 3.2+ Reviewed-by: Filipe Manana Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/reada.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c @@ -747,6 +747,7 @@ static void __reada_start_machine(struct u64 total = 0; int i; +again: do { enqueued = 0; mutex_lock(&fs_devices->device_list_mutex); @@ -758,6 +759,10 @@ static void __reada_start_machine(struct mutex_unlock(&fs_devices->device_list_mutex); total += enqueued; } while (enqueued && total < 10000); + if (fs_devices->seed) { + fs_devices = fs_devices->seed; + goto again; + } if (enqueued == 0) return;