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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 61032C11F66 for ; Wed, 30 Jun 2021 21:49:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DFB6161474 for ; Wed, 30 Jun 2021 21:49:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFB6161474 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fromorbit.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 41ED36B027C; Wed, 30 Jun 2021 17:49:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CEED8D01C8; Wed, 30 Jun 2021 17:49:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 297A86B027E; Wed, 30 Jun 2021 17:49:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 005D76B027C for ; Wed, 30 Jun 2021 17:49:07 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C51BB231BF for ; Wed, 30 Jun 2021 21:49:07 +0000 (UTC) X-FDA: 78311731134.18.A5C1AA3 Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by imf07.hostedemail.com (Postfix) with ESMTP id 4A69710000B5 for ; Wed, 30 Jun 2021 21:49:07 +0000 (UTC) Received: from dread.disaster.area (pa49-179-138-183.pa.nsw.optusnet.com.au [49.179.138.183]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 6AC6C69A1C; Thu, 1 Jul 2021 07:49:05 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1lyi4t-001Hgw-GP; Thu, 01 Jul 2021 07:49:03 +1000 Date: Thu, 1 Jul 2021 07:49:03 +1000 From: Dave Chinner To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/3] mm: Add kvrealloc() Message-ID: <20210630214903.GF664593@dread.disaster.area> References: <20210630061431.1750745-1-david@fromorbit.com> <20210630061431.1750745-2-david@fromorbit.com> <20210630160843.GM13784@locust> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210630160843.GM13784@locust> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=F8MpiZpN c=1 sm=1 tr=0 a=MnllW2CieawZLw/OcHE/Ng==:117 a=MnllW2CieawZLw/OcHE/Ng==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=20KFwNOVAAAA:8 a=7-415B0cAAAA:8 a=RaIoV-Duqy7ywgANOlkA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=none (imf07.hostedemail.com: domain of david@fromorbit.com has no SPF policy when checking 211.29.132.80) smtp.mailfrom=david@fromorbit.com X-Stat-Signature: 3juwby6peo1bc7n6w4e3ocgysdwtw7ze X-Rspamd-Queue-Id: 4A69710000B5 X-Rspamd-Server: rspam06 X-HE-Tag: 1625089747-851672 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: On Wed, Jun 30, 2021 at 09:08:43AM -0700, Darrick J. Wong wrote: > On Wed, Jun 30, 2021 at 04:14:29PM +1000, Dave Chinner wrote: > > From: Dave Chinner > > diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c > > index 1721fce2ec94..fee4fbadea0a 100644 > > --- a/fs/xfs/xfs_log_recover.c > > +++ b/fs/xfs/xfs_log_recover.c > > @@ -2062,7 +2062,7 @@ xlog_recover_add_to_cont_trans( > > old_ptr = item->ri_buf[item->ri_cnt-1].i_addr; > > old_len = item->ri_buf[item->ri_cnt-1].i_len; > > > > - ptr = krealloc(old_ptr, len + old_len, GFP_KERNEL | __GFP_NOFAIL); > > + ptr = kvrealloc(old_ptr, old_len, len + old_len, GFP_KERNEL); > > kvrealloc can return null, so this needs to check for that and -ENOMEM, > right? It'll suck that log recovery fails, but such is life. Ok, looking through the code it seems that returning -ENOMEM here is a non-destructive (i.e. retry-able) failure. It will simply stop processing the log at the point this occurs and abort all pending objects that haven't been processed. The error message is less than stellar ("log mount/recovery failed: error %d") but at least no other damage will be done. I'll update it. Cheers, Dave. -- Dave Chinner david@fromorbit.com