Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1177230iog; Thu, 16 Jun 2022 00:07:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s1QtHJHxM7eaDpIXSUfjntbZrn5a2d/2q0fI+Dx6x4na3DnzWN9rk0fJAtoOEC/US6Ktzd X-Received: by 2002:a05:6402:51d3:b0:431:6c7b:28d with SMTP id r19-20020a05640251d300b004316c7b028dmr4440531edd.281.1655363262151; Thu, 16 Jun 2022 00:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655363262; cv=none; d=google.com; s=arc-20160816; b=EIwOJdzRXHTzWfi1ZKRmm9Ex+K8TsBW/dq+PxhWHrPknQQmfRxEQDGxzL5PrKH1E4K lNhIyU9gM2ueVjatAgs+8wVOxHXnW/PZzaLYzWXAPFI9rEn4iiFdAhyG12Cw/DejlkRi i7s4lR0niCGxGSechPQE7wm5+LgCO/6Mtd8iV/aE5dUH8a97GN+VttZ9WI62DdBoS7m/ taF6u0qbZ8kTQrPjZ4xn0DG01mvr2CW3GsAVCnefEGF06aA6J2Rm5+m01rh7l8ZLNSed kBlrb2UBFDkO5MHDsoe2Zz4dIsPovQ+tgmdxwcaTnGUSAruOf8jc0bGrkenseS9gCAuq g8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=6+SL803wERBcuUltMYFG+neazXzMGLBQJewTmmNat+c=; b=kMs2Tr3bCuonNYSscPJCh1F5NehJgL9MDaKixuNx0n66xpW7ddkGehL69ID3J0eZu7 aZ6daFJGzDMfQad94bsG+XGJ1zUPLShh/DsEE9lLHQrDHW5TecUIIKTNu1woX1UU2vCY 1gbbnDxGAiT/7FvOv+DmvOYArzhZ3E2MVuxI05HbOD4OdJMcPIQGYdk/+h68n/PbZDsa IEJuzmGtJpuuaecOJT0XbLcBvpFx/IyZyZhqk/xJSD2ErX4W5EANclNdxiiRMORbVNhn eYLDbrBnjD6s5e/H8B1qH1qoiRFBW7LEz6heDgmr8z24KlhmRlNOI4lN8n4CnJJ0GDgv nMGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a170906778e00b00707a2b7c6d6si971169ejm.175.2022.06.16.00.07.13; Thu, 16 Jun 2022 00:07:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350136AbiFPHAe (ORCPT + 99 others); Thu, 16 Jun 2022 03:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbiFPHA2 (ORCPT ); Thu, 16 Jun 2022 03:00:28 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445A35A5BA for ; Thu, 16 Jun 2022 00:00:27 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LNtLB2TVCz1KB2f; Thu, 16 Jun 2022 14:58:26 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 16 Jun 2022 15:00:24 +0800 Subject: Re: [PATCH v2 2/2] mm/swapfile: release swap info when swap device is unpluged To: Christoph Hellwig CC: , , , , , , , , , , , , , liubo References: <20220615070228.2858170-1-liubo254@huawei.com> <20220615070228.2858170-3-liubo254@huawei.com> From: Miaohe Lin Message-ID: <94b554c5-50cc-141c-c494-14005425930a@huawei.com> Date: Thu, 16 Jun 2022 15:00:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/6/15 19:22, Christoph Hellwig wrote: > Sorry, but this is simply broken. We can't just do d_path magic > here. That being said the problem is real, and I think the right > answer is to offer a swapoff variant that doesn't need to open the > underlying device or file, but useѕ some kind of handle. I'm just When swap device is unplugged, the swap_file->f_path.dentry will be in the d_unlinked() status. Could we use it to detect the problem instead? IMHO, we can found the unplugged swap devices this way and further get the right swap device to swapoff through comparing the swap device name with @specialfile. Or am I miss something? > not sure what would be a good handle here. Using handle sounds like a good idea too. :) But can the above solution be acceptable? > . > Thanks!