Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3168858pxb; Mon, 9 Nov 2020 04:38:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF9vgSzhFZEdTsxUVWuDDAWaRMdpnCLruUP91IHEfI2TEDF2EjkrGM/mqdWpY2ekFzWQjD X-Received: by 2002:a05:6402:1115:: with SMTP id u21mr1748504edv.148.1604925529543; Mon, 09 Nov 2020 04:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604925529; cv=none; d=google.com; s=arc-20160816; b=UwHNYkThsbjIr0SXrBR/dMN7CsBIs5TsvlBDlwYjA6qh/4+MHR2QmnNweSF6t7BkSe px8sjFd1G5OOfFg5jT7KcuBkFnsn19oFNH6wF+YOk+6WyXaI4lZRXweZeTNchiFN/AOg XEvpuepIiyMl4MaR+KE5GDX+TSaFss2IDSHK6lE5ew6rN48DnGr/8egoiyyXZ08Zj9iF EdZkCaXwptRHt3nSpE9TUjeCQ+8kyMhpxTjMi5eTgwGesYxxFvHCYf5hAdPaXSObQd/i EYS+gSUb+Z82oj3xuidBzT/FJiYypEZsqk0NE1zbfXPBlcTRMx+er3RBF76POJMH1OHv hgZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:from :subject; bh=MOdmyD043D2ujw9ykrFdS1DeoeGchjDJOJ2XrTMgi84=; b=CTmHRAeak8/stVrrD2I6ciGUQh8HO+JeIgVM1MSrWVWLr19tsqG9ft80ycbir4dfVE 8y30r/yIcKKWRI38ZWDI7NdqefBqjDw1D/YjiU8ab/nedtlD22OhE3b2DqibS7PJiM2O MiSuEadsZr01fAiEqortfwxnNYfYfM0gRAH5dU+Ryofx0KhLncdwa4nBT5lOeBCeDgHQ MAR/XiXzmZlwmUaIHnaTWsgjV7MpN5ywfbs3vZv2dI6zhwIS2JUequ5F+0CjwgzE1Dqs 3R7aH1JkindgoVnQs5tFbHz5n/DWMptPbga6K3/2bj44yMqXTvZUo+3vIPKMSykmjL7N f8DA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj4si7052593edb.64.2020.11.09.04.38.26; Mon, 09 Nov 2020 04:38:49 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729666AbgKIMge (ORCPT + 99 others); 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 >>> >>>