From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB79CC43613 for ; Mon, 24 Jun 2019 10:05:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99BCC21473 for ; Mon, 24 Jun 2019 10:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370728; bh=eBOPclAZ8mS+XH4bfLm+2ME/n8GaAMKlpxOiRgILpy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Y+vWl7sahdMYNIXn4wLgW3bcx4CNwOauElPMnB86pqjm+2SSO+qY2Yzi3eCOHZm1R FwiEEMeAJey6TaiM1C34m+lQTUldPLjuDypP9ZWCFK7yUdEsgXuYYe1iVoHsOi8uDe E9FVHwkZw+nqyGIogUNcoiWP4o5J0RI4Z6I1Kr/Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729550AbfFXKF1 (ORCPT ); Mon, 24 Jun 2019 06:05:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:37376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729921AbfFXKF0 (ORCPT ); Mon, 24 Jun 2019 06:05:26 -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 04E33208E3; Mon, 24 Jun 2019 10:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370725; bh=eBOPclAZ8mS+XH4bfLm+2ME/n8GaAMKlpxOiRgILpy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Li9Nx4Bn+Tw79sHggwGJLa9o0LPGubM7xBsRqDU4PaQAkif48trye/VP9/pMiXwIn jPLQAM9Uo2EmB9xEJQN2eATz3IaNGF613nHpy1reunzzF78j/hxtNzNVA4NmVndME8 sssDkBSH06TDqDC+PIicB5266zraJKhZL+pAOWHk= 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 4.19 68/90] btrfs: start readahead also in seed devices Date: Mon, 24 Jun 2019 17:56:58 +0800 Message-Id: <20190624092318.500006081@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092313.788773607@linuxfoundation.org> References: <20190624092313.788773607@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -745,6 +745,7 @@ static void __reada_start_machine(struct u64 total = 0; int i; +again: do { enqueued = 0; mutex_lock(&fs_devices->device_list_mutex); @@ -756,6 +757,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;