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 4391DC2D0A3 for ; Mon, 9 Nov 2020 12:36:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0D432074F for ; Mon, 9 Nov 2020 12:36:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0D432074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A43486B006E; Mon, 9 Nov 2020 07:36:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D5FC6B0070; Mon, 9 Nov 2020 07:36:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B9CE6B0071; Mon, 9 Nov 2020 07:36:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 5AEBC6B006E for ; Mon, 9 Nov 2020 07:36:40 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0B8318249980 for ; Mon, 9 Nov 2020 12:36:40 +0000 (UTC) X-FDA: 77464828560.25.duck33_480bcda272ec Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id D38471804E3A8 for ; Mon, 9 Nov 2020 12:36:39 +0000 (UTC) X-HE-Tag: duck33_480bcda272ec X-Filterd-Recvd-Size: 2893 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Nov 2020 12:36:38 +0000 (UTC) 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: quoted-printable 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: =D4=DA 2020/11/9 =CF=C2=CE=E78:17, Alex Shi =D0=B4=B5=C0: >=20 >=20 > =D4=DA 2020/11/9 =CF=C2=CE=E78:07, Matthew Wilcox =D0=B4=B5=C0: >> 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? >> >=20 > The trick thing is. It do fix my problem on my centos 7 with gcc 8.3.1.= .. >=20 > 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... >=20 >>> @@ -3339,7 +3339,8 @@ static bool swap_discardable(struct swap_info_s= truct *si) >>> error =3D inode_drain_writes(inode); >>> if (error) { >>> inode->i_flags &=3D ~S_SWAPFILE; >>> - goto free_swap_address_space; >>> + exit_swap_address_space(p->type); >>> + goto bad_swap_unlock_inode; >>> } >>> =20 >>> mutex_lock(&swapon_mutex); >>> @@ -3364,8 +3365,6 @@ static bool swap_discardable(struct swap_info_s= truct *si) >>> =20 >>> error =3D 0; >>> goto out; >>> -free_swap_address_space: >>> - exit_swap_address_space(p->type); >>> bad_swap_unlock_inode: >>> inode_unlock(inode); >>> bad_swap: >>> --=20 >>> 1.8.3.1 >>> >>>