Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1048218pxk; Mon, 31 Aug 2020 08:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX7DsEgL9r9nqMPqA9/ukOkwe9SfEpIbI9GJjP0WTBVD3aicMMQmnsQiDZ6ZnYL3LOqVgi X-Received: by 2002:a17:906:3ad0:: with SMTP id z16mr1687026ejd.193.1598887557660; Mon, 31 Aug 2020 08:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598887557; cv=none; d=google.com; s=arc-20160816; b=afDH0+wyVtzZFA3NDnHoKU0/+uhaCK1JqcwrGvG81CcRhcjqHJB+DhZKBml1agx48J ogz//upkKUjXBqh9/YWB4Dq26Y/fcmJK/2pwhmlSeTpqBLUmpyGTiRqU9IQD9tRh8/Bi Upt73sZ8QFrE4myad1OxSxni2SWJaS7j2k9uP8w0lV5wE2sq3gtByHzBqr7JJ39yeHjL wJflChrF18rElGi7aPhh9VXayEDGSkiJ078Fu4LRbnEWvs/xNh0O914dwUcEuS4+syjI K7fT/P038D+TgZgr03U/Z54gkwRRsaNxvm7VyQGx6PnRShn/hyftrI/ddojNf3wTh0JW UKfA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dkim-signature; bh=v6aATz1DrVzTsNm6cohCGLPYmM1JDr9u4o7wfl1KrmQ=; b=D8rLRuupCCe52X/MhaWfVoRwQSqy2lnmiv9YZUDloWkh/fAXqb+VvvZXNlY4frqYeC Z2tVfixQ+4UMJxurbUst5JkI4P33uoxD6lOapOmv4tDFtKr35pdJtk+w2Yo23ZIawOHr I7Mg4BpB4oGswD01TjjkMoN79xPtj2+ZBvSZmaMr3GT66JwiK3d+z5YQg5pBuXFe90Jc ggS90I5LwxJ5h/sJ0Rl5LT1YkNHeLF8hfpK9Sn/cy8uQNpx/mIaSolQ7wCEaxTeid7Fb rA78nXxeAh9kAp2LZGS1trYtkEXviNuORSY5QMNu/1QOoAnMa9PCPakQxEoCDvsBHldT 4sGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=kpvTUnxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si4846893edo.589.2020.08.31.08.25.33; Mon, 31 Aug 2020 08:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=kpvTUnxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728064AbgHaPWT (ORCPT + 99 others); Mon, 31 Aug 2020 11:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726755AbgHaPWS (ORCPT ); Mon, 31 Aug 2020 11:22:18 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0006C061573 for ; Mon, 31 Aug 2020 08:22:17 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id h10so6332443ioq.6 for ; Mon, 31 Aug 2020 08:22:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=v6aATz1DrVzTsNm6cohCGLPYmM1JDr9u4o7wfl1KrmQ=; b=kpvTUnxia+Vb6v+2T62Y1tzsvRiUWtVSiYS8bxwIgN+SjgF7L1liSKiLaaoKbbqJso 9SPZVUN5K3oaoyI7rEAOsAgh9o7gV/yXCgF+5srCxYXCHpF4WuTl/ElWZtu6YLhSCg60 Pzu62ZNUGtY4niWkO/jRXwatOwWCKX6zAeW6q7+SjjomqfpYfr+1ETFayYIJAqfNZ4G+ qHNe8QjTj+pZjvHt/z/KzTqZx6L/2K7SgrBekZjb57pJ6xB0LYFrRW4EUeDWbf4lMZJ6 93/xr1CVxvjJmyZhwEkSAAdiSeAcr6lfw+RsmoWqkZhas3cbbgY8xkYxcf3SD7ofLm/F kFog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=v6aATz1DrVzTsNm6cohCGLPYmM1JDr9u4o7wfl1KrmQ=; b=MVauvNZUj9T8/S+AJobMd+uSWmwhWsA2Cvd7O7TftB+akGBK6PcXhRUjtzLl8MzJjz haEuxpc2gAHfdLijiX21Fado4jA4TZn0a4foK7AzcaYfJQbSRjODI253byuFSRtRl2gy lScONBZdcTaSYK6ZGuaVCmFzx6yQLBD2RSjWKuH4lgSRI6nYBcsds8iisBRpY76xfZeb HSZQhWegyCDccwfObQO0E3dHcBUGra6urtl4+B+IYl9GWtDA+YUTBV1f5oqn7wLQNqjM Dsa4le3WL03H04wRKyTS8fQBz+/kjcw3o6BagVrHf991jSujIb32NTmFRGmWiuefPB54 EdgA== X-Gm-Message-State: AOAM530IMFzkeIMyTH/ykui9FWt8wOs/BaFBy0PlXHILLHZyJbmqfmAc RqfEPYg+U1lLw0DV393MVOvwKlmCysHJiW9L X-Received: by 2002:a02:c8c8:: with SMTP id q8mr1642061jao.46.1598887336702; Mon, 31 Aug 2020 08:22:16 -0700 (PDT) Received: from [192.168.1.58] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id m3sm4704997ill.57.2020.08.31.08.22.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Aug 2020 08:22:16 -0700 (PDT) From: Jens Axboe Subject: Re: [PATCH] fat: Avoid oops when bdi->io_pages==0 To: OGAWA Hirofumi Cc: Andrew Morton , linux-kernel , fsdevel References: <87ft85osn6.fsf@mail.parknet.co.jp> Message-ID: Date: Mon, 31 Aug 2020 09:22:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87ft85osn6.fsf@mail.parknet.co.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 29, 2020 at 7:08 PM OGAWA Hirofumi wrote: > > On one system, there was bdi->io_pages==0. This seems to be the bug of > a driver somewhere, and should fix it though. Anyway, it is better to > avoid the divide-by-zero Oops. > > So this check it. > > Signed-off-by: OGAWA Hirofumi > Cc: > --- > fs/fat/fatent.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c > index f7e3304..98a1c4f 100644 > --- a/fs/fat/fatent.c 2020-08-30 06:52:47.251564566 +0900 > +++ b/fs/fat/fatent.c 2020-08-30 06:54:05.838319213 +0900 > @@ -660,7 +660,7 @@ static void fat_ra_init(struct super_blo > if (fatent->entry >= ent_limit) > return; > > - if (ra_pages > sb->s_bdi->io_pages) > + if (sb->s_bdi->io_pages && ra_pages > sb->s_bdi->io_pages) > ra_pages = rounddown(ra_pages, sb->s_bdi->io_pages); > reada_blocks = ra_pages << (PAGE_SHIFT - sb->s_blocksize_bits + 1); I don't think we should work-around this here. What device is this on? Something like the below may help. diff --git a/block/blk-core.c b/block/blk-core.c index d9d632639bd1..10c08ac50697 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -539,6 +539,7 @@ struct request_queue *blk_alloc_queue(int node_id) goto fail_stats; q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES; + q->backing_dev_info->io_pages = VM_READAHEAD_PAGES; q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; q->node = node_id; -- Jens Axboe