Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3152130pxb; Mon, 9 Nov 2020 04:09:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+In4HfYxv0bESItFHpPXfOEPpJJ5iFgyAlp7eumFhmjbUutn+K98H/2OCzwQbFUtrr6jl X-Received: by 2002:aa7:d493:: with SMTP id b19mr14505147edr.279.1604923772827; Mon, 09 Nov 2020 04:09:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604923772; cv=none; d=google.com; s=arc-20160816; b=HtOYoVfa169FsclN5THwkAqxkP3b1IwGJGeYTtzNSCGnIyI7OE4OEEORBAkKW0RP+G gcP/TJ2qc4noHSUDaagh+B1JM0L4DpKtLKGJHJqnUMuJ3uSlMXisaPtn4Tek+hEIzRmQ wn3CspZgwdidb6//QD46Pjb3EZV6axqBKw9ms1mrkdD0FNLjlqQA0jHKyUrEQF0+iQo6 wv/X8u7NbQjekCevpCZ02LFmLdQ8sVojt1jeMFpwFz2cXUXKXnimA99OqL4jyqlNW7PD Wrf6EZJ8BY4EoxnXgpG6iTy3bPbiKJxwvugrNK4nUfLdtPKSAOq7uDVFeZZwOfDSD1TZ IORQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SEg9o19P1oU0SOhiF3mICDABrubXxOmsaY562ffq9Us=; b=PGcrQo92O6D6kGJtgZh1Jm0OWe/D8zUPvmzr3CR4syP106XG+YOZqxiGFQZQn6B/MC 2qQGeXEegEBAe8vTHZEhKjoibDZ2z7We2Pd1/5ftGkOLD6tlF876djdKFr2TebAFfbW0 yt1son0bcga9OO8hi/SJB0Py0bOM1Eza7apjCCmmBdWUGbzys+QInF18R8fJfMZcFHjn ankJ19S9a87S0R7YfQ79p3+FSDXe7M7GNQ6sC+geicoGmYJxwOoV4+cwHN6dxsRKa1mv Wuo3bImn4x5475XcBHSgGa/+MWm+Eg96yXIC/Jt3nTchIUqgSadLaCzhTXqtnaC7rO+K hvSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Qpc+qZyo; 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 e24si6666939ejr.575.2020.11.09.04.09.10; Mon, 09 Nov 2020 04:09:32 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=Qpc+qZyo; 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 S1729336AbgKIMHW (ORCPT + 99 others); Mon, 9 Nov 2020 07:07:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbgKIMHV (ORCPT ); Mon, 9 Nov 2020 07:07:21 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A45DFC0613CF for ; Mon, 9 Nov 2020 04:07:21 -0800 (PST) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >