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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 3CDC5C2D0A3 for ; Mon, 9 Nov 2020 12:07:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52357207BC for ; Mon, 9 Nov 2020 12:07:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Qpc+qZyo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52357207BC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 623CA6B0036; Mon, 9 Nov 2020 07:07:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D46A6B005D; Mon, 9 Nov 2020 07:07:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49C2E6B0068; Mon, 9 Nov 2020 07:07:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 1D7A36B0036 for ; Mon, 9 Nov 2020 07:07:25 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B9FAC1EE6 for ; Mon, 9 Nov 2020 12:07:24 +0000 (UTC) X-FDA: 77464754808.09.sofa27_3b00c0e272ec Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 9C3CC180AD802 for ; Mon, 9 Nov 2020 12:07:24 +0000 (UTC) X-HE-Tag: sofa27_3b00c0e272ec X-Filterd-Recvd-Size: 2625 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Nov 2020 12:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SEg9o19P1oU0SOhiF3mICDABrubXxOmsaY562ffq9Us=; b=Qpc+qZyonhmTKiOXGulCn7GjWP 5mm+kKxInVYhk3qSim68L36as7yyQMT2WR0ZGgtqtNfKJDtjPWlaCg47SDrYe0SquEcigIhLiQN33 Vhpp8qXG7AojTQ1psuzonRZdljE2wzp3cU+hz1Ctg8imUYRBZ5nN9yPSkYRUkwBzxywhfThZDRL0g aT7lp3DtfcLwIzLbU19tM2WyIUiP6ziLBJZokpdKHsioxXd2ObxdHPWb0709vgffQesrt1/94dxvi e+UaJL1+o53KZmpY4GUwyvwhGQQQyE/1wT/8UM27tjg0OBH7MILQCqrgP+EuiZqZFqpTiS++IlWa8 v4KJV2kQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5wv-0000Cr-AQ; Mon, 09 Nov 2020 12:07:05 +0000 Date: Mon, 9 Nov 2020 12:07:05 +0000 From: Matthew Wilcox To: Alex Shi Cc: linmiaohe@huawei.com, akpm@linux-foundation.org, "Darrick J. Wong" , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [REF PATCH] mm/swap: fix swapon failure Message-ID: <20201109120705.GZ17076@casper.infradead.org> References: <1604922436-16597-1-git-send-email-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1604922436-16597-1-git-send-email-alex.shi@linux.alibaba.com> 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 Mon, Nov 09, 2020 at 07:47:16PM +0800, Alex Shi wrote: > Go through the context I found the exit_swap_address_space(p->type) > shouldn't be used in good result path. So just move it to error path. But ... it's not used in the success path. There's a 'goto' right before it. Does this really fix your problem? > @@ -3339,7 +3339,8 @@ static bool swap_discardable(struct swap_info_struct *si) > error = inode_drain_writes(inode); > if (error) { > inode->i_flags &= ~S_SWAPFILE; > - goto free_swap_address_space; > + exit_swap_address_space(p->type); > + goto bad_swap_unlock_inode; > } > > mutex_lock(&swapon_mutex); > @@ -3364,8 +3365,6 @@ static bool swap_discardable(struct swap_info_struct *si) > > error = 0; > goto out; > -free_swap_address_space: > - exit_swap_address_space(p->type); > bad_swap_unlock_inode: > inode_unlock(inode); > bad_swap: > -- > 1.8.3.1 > >