Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp774936pxb; Tue, 5 Apr 2022 22:48:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqwRbe+VYKWYt3Q95wY5+nAgsaS5Iu/9gYmgMPLjybBxeUUFeQskg1t3aTezec4N7gyUVT X-Received: by 2002:a17:90b:2516:b0:1ca:aa68:ca71 with SMTP id ns22-20020a17090b251600b001caaa68ca71mr8158181pjb.58.1649224116864; Tue, 05 Apr 2022 22:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649224116; cv=none; d=google.com; s=arc-20160816; b=jRbPpozZUwTXHDelZq5ODLU4twauiKhmow8wNyO5Fe9Oxv3gaU7SR9L10R1jRmDk+l CXTS2G/d6mkVZHVnJyNP3anbBzvVDDGzbNQQx622AME3gunTerwn09mmenH0QBFWqFK1 CppZ5GjqIPYruH0FbSjLjxbQ0QdlnRv4xNA3lNCaUE87dfBXeY0BOrSmp98vOHMG+En0 Q+P/RbhOgRppugrz50soyQAmw87FCTSJC1giRvDWytm5P8HAXltz8pqNoJYYHVFcPgEG 0pudbHY69MeP0r3XCpo6ObJvcnXRbCMccBJslOmosEhLxnDpZyBu4AaP0w4QsNfnBuzt Jkew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YPe/4fg2XeTQQ5aY/ThILY79wZs4XAXLRPNQ2cmgDBQ=; b=SrWmP/SQlopH0RPvKU1oFtmXDrigVAtxEiQqur7VHl899z1l0xamE7fxcN1IoBc3N9 fi+oUgpPShicMuY5UEKskNEECsJOIkbrMe2+AoGgY1yCOCVo1PPXLjkgpBNV7ginde9u dRbWjd6NA6+GPameEAnWGJGheVSZ2ZE8Ms1jXvwy59dFSxemhSJpQddvXD4oip2fnqmW gvhugj/6rC/3hIQv++c0HRY2VIYBsussJ7RjjEu8CylS3MeiOPUzVjSgP0TQKP6mpaQf ggJjnu3gS4U6N425BWIJ7gnfc7JRI1TyERj3ANJvbAbGmeyMfjkZNy5Qbttv1KZCFsrZ 0rMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BxUVAXIW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b6-20020a170903228600b00153b2d164c5si4740033plh.205.2022.04.05.22.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:48:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BxUVAXIW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BD0234984BE; Tue, 5 Apr 2022 22:20:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348162AbiDEUWV (ORCPT + 99 others); Tue, 5 Apr 2022 16:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349125AbiDEJtM (ORCPT ); Tue, 5 Apr 2022 05:49:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F91EABF63; Tue, 5 Apr 2022 02:41:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0719B818F3; Tue, 5 Apr 2022 09:41:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B2E0C385A3; Tue, 5 Apr 2022 09:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151667; bh=gLkXz8KQ4nS4VC4V52HBqJya/9x7GRrOlH92dFwRMKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BxUVAXIWoEsX5sz06dP/0JWvsOONIgiHwt8Vi/S+Al4q0YlsQCWd3jzaGOhQwLS2i JDTmYSaM1hFzobvhdBprqd4Pd3Xx7bkWMXgfwmdAss0q6TuP9SrJZDEPALhyEejBnO LR6FQ9Fpd/T2dHPhO3DVhl667K4yWPxs8NQgRCZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tong Zhang , Ira Weiny , Christoph Hellwig , Dan Williams , Sasha Levin Subject: [PATCH 5.15 460/913] dax: make sure inodes are flushed before destroy cache Date: Tue, 5 Apr 2022 09:25:22 +0200 Message-Id: <20220405070353.637920523@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Tong Zhang [ Upstream commit a7e8de822e0b1979f08767c751f6c8a9c1d4ad86 ] A bug can be triggered by following command $ modprobe nd_pmem && modprobe -r nd_pmem [ 10.060014] BUG dax_cache (Not tainted): Objects remaining in dax_cache on __kmem_cache_shutdown() [ 10.060938] Slab 0x0000000085b729ac objects=9 used=1 fp=0x000000004f5ae469 flags=0x200000000010200(slab|head|node) [ 10.062433] Call Trace: [ 10.062673] dump_stack_lvl+0x34/0x44 [ 10.062865] slab_err+0x90/0xd0 [ 10.063619] __kmem_cache_shutdown+0x13b/0x2f0 [ 10.063848] kmem_cache_destroy+0x4a/0x110 [ 10.064058] __x64_sys_delete_module+0x265/0x300 This is caused by dax_fs_exit() not flushing inodes before destroy cache. To fix this issue, call rcu_barrier() before destroy cache. Signed-off-by: Tong Zhang Reviewed-by: Ira Weiny Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220212071111.148575-1-ztong0001@gmail.com Fixes: 7b6be8444e0f ("dax: refactor dax-fs into a generic provider of 'struct dax_device' instances") Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/dax/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index fc89e91beea7..7610e4a9ac4e 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -678,6 +678,7 @@ static int dax_fs_init(void) static void dax_fs_exit(void) { kern_unmount(dax_mnt); + rcu_barrier(); kmem_cache_destroy(dax_cache); } -- 2.34.1