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.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 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 A6D6DC388F7 for ; Mon, 9 Nov 2020 12:36:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D1EE20789 for ; Mon, 9 Nov 2020 12:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729777AbgKIMge (ORCPT ); Mon, 9 Nov 2020 07:36:34 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:41318 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729038AbgKIMgd (ORCPT ); Mon, 9 Nov 2020 07:36:33 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UEkNpYe_1604925389; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UEkNpYe_1604925389) by smtp.aliyun-inc.com(127.0.0.1); Mon, 09 Nov 2020 20:36:30 +0800 Subject: Re: [REF PATCH] mm/swap: fix swapon failure From: Alex Shi To: Matthew Wilcox Cc: linmiaohe@huawei.com, akpm@linux-foundation.org, "Darrick J. Wong" , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1604922436-16597-1-git-send-email-alex.shi@linux.alibaba.com> <20201109120705.GZ17076@casper.infradead.org> <88fb2ed0-cb0c-2b4b-a73e-3a64fdc0a2cd@linux.alibaba.com> Message-ID: <46e34498-01aa-3442-eee3-d3b84a00e1a8@linux.alibaba.com> Date: Mon, 9 Nov 2020 20:36:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <88fb2ed0-cb0c-2b4b-a73e-3a64fdc0a2cd@linux.alibaba.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/11/9 下午8:17, Alex Shi 写道: > > > 在 2020/11/9 下午8:07, Matthew Wilcox 写道: >> 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? >> > > The trick thing is. It do fix my problem on my centos 7 with gcc 8.3.1... > > I am getting headache on this problem... Checked again on my git tree. nothing weird, and code based on cf7cd542d1b5 Add linux-next specific files for 20201104 Sorry, I have no idea where is the 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 >>> >>>