Message ID | 20230127011535.1265297-1-riel@surriel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp590270wrn; Thu, 26 Jan 2023 17:44:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXvoxOpyAukKpN1df65BpTcKa7ITGeYURROm2W/FeNGtZ8cifwdDuJghEQsSdEOEnLM8IT1p X-Received: by 2002:a17:907:c019:b0:867:ef3f:dd85 with SMTP id ss25-20020a170907c01900b00867ef3fdd85mr41985872ejc.56.1674783857439; Thu, 26 Jan 2023 17:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674783857; cv=none; d=google.com; s=arc-20160816; b=dsFg9t1EAkWcp2s6JNSZCKGS2d0YRKxah02V40Ep5N23fVHlkBTfVzZEwuFUSX85Y7 QAYWt0hJZCr5mR7cz0iVN67lBXQ7QU0cLOFTh1SmW66YqUDtCm95qqV/meie3ENPuOGr QhKyyxkJ1XBW5i9NP2uSa1QWaT2wISIeq0pNQoJtuGDXrRBpGExrf9cTFvJHBbT/5bvG AuUQDR7t4Lmz0VUYPl5/djlmjULhznrmaQ2PWge8wNcIXdLSr5aoVPXKiRKo8fW1OYn4 sA1fM/1jqLE3W0khVJ/P/xwh846QLtlhyyBohJSj2mMhvas6u9NvqBtLeB/iTdesvXkw SMWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=5Nob+AW75WCEG64sNq14DOqsWN7/ao0jUqiCeqx6G9w=; b=NuFTXvmfSZioWI5ElYWojpbF4Uii2YA42kteF4fSyJ7OiN+dZpheqOMmyZgmo8ILlU m1yfdm+EwviN2dW6UBTOdkSKNk9UIto/5w9aRVB+SCR0GvUJh2y46VN3DLtho0Y4vovS 6fPu06JFwc+fGh5C6hwAv/MqrLr3HjiiD9XK4c/dTi64qjxGxBQz+QkPen53ifa+K/Cf A5KO9O+YzabC/L4DNZvYT5+Uhe38W5tshxaqoqu9P8FoCFfcXWGelXBSJZ+cHQoyDr8b fl5YAQla+ySQEVBgMRmeGa5RulR/GQ89xrvMxfb++4cydgySA8W7i9sOb3gK00+KmeuQ n8GA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a17090600d400b00870b95fb7c4si3385804eji.998.2023.01.26.17.43.53; Thu, 26 Jan 2023 17:44:17 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbjA0BPr (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Thu, 26 Jan 2023 20:15:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjA0BPq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 26 Jan 2023 20:15:46 -0500 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F314ED0C; Thu, 26 Jan 2023 17:15:44 -0800 (PST) Received: from imladris.home.surriel.com ([10.0.13.28] helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <riel@shelob.surriel.com>) id 1pLDLC-00038z-2j; Thu, 26 Jan 2023 20:15:42 -0500 From: Rik van Riel <riel@surriel.com> To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, kernel-team@meta.com, linux-fsdevel@vger.kernel.org, gscrivan@redhat.com Subject: [PATCH v2 0/2] ipc,namespace: fix free vs allocation race Date: Thu, 26 Jan 2023 20:15:33 -0500 Message-Id: <20230127011535.1265297-1-riel@surriel.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: riel@shelob.surriel.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756120427307573983?= X-GMAIL-MSGID: =?utf-8?q?1756138158030892584?= |
Series |
ipc,namespace: fix free vs allocation race
|
|
Message
Rik van Riel
Jan. 27, 2023, 1:15 a.m. UTC
The IPC namespace code frees ipc_namespace structures asynchronously, via a work queue item. This results in ipc_namespace structures being freed very slowly, and the allocation path getting false failures since the to-be-freed ipc_namespace structures have not been freed yet. Fix that by having the allocator wait when there are ipc_namespace structures pending to be freed. Also speed up the freeing of ipc_namespace structures. We had some discussions about this last year, and ended up trying out various "nicer" ideas that did not work, so I went back to the original, with Al Viro's suggestion for a helper function: https://lore.kernel.org/all/Yg8StKzTWh+7FLuA@zeniv-ca.linux.org.uk/ This series fixes both the false allocation failures, and the slow freeing of ipc_namespace structures. v2: a few more fs/namespace.c cleanups suggested by Al Viro (thank you!)