Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp41875rdb; Fri, 26 Jan 2024 18:01:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGC6ilAJzHZIF1mvF6x/gcSeGnYxjUWOmPyS9vHFozSrQ670fW7LA7LJPHSGyNP3BmWutTp X-Received: by 2002:a05:6214:4109:b0:685:41bf:e554 with SMTP id kc9-20020a056214410900b0068541bfe554mr982775qvb.29.1706320917500; Fri, 26 Jan 2024 18:01:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706320917; cv=pass; d=google.com; s=arc-20160816; b=J7pyttXi/pHHSSb1vVMtK7fnIp7hY2l06mGo8dAeoHEeyly7KZwsobY9DeT9/caRcU WlhO+NjuZhzR5pM6BKSWQfhqDW3vlyP7y/K9P/CxSM4rp4B8+yqgjFnFYYIG8a8hrEpe thu/rHAaAc2OWtSCVVYGzqLoAJE+gV/itmhbLnwBYb07gHfbDNIjtwPBKllFXHB4kGQb Xi2uyssfkCTnuKTxTi/GKlmSCnHnBPKOjevukvtQmZwGyXq6KnYzDVWdljXm78y8kB20 XhsCy35EckLAxNnvKHMNB9QQyRiEE03/73fcSi3CDIIVoFyGjHGebouB74EJUV5z4QSV XGKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n3Eqaf0JpcfE9VphQ2k45PLVkc2qGy56bLUTBAo+DzE=; fh=0UIAGl0E4wRbBfdUoF7pqM3CUJarYucrbeDSpW3ZHvo=; b=dAlU8jdP6CaSSh8gWICaZw0TIMz3OSeifRDATbT7cqM4sHetREzfIr3VIfHZM/YqKC VbONT0VzG2UicR96CWtX9LKRMMfHa45+fkh1U6/isxdEoPkMOUOjddPifnXQ4kWwfGck 81/Dm/nny431gneB/ub7WBXVhcR+jV8Kpfi2oJ+WGI/aPA9pur0BMrNdJJ1LU+90EpHL erayITfhoJzRENB6vc2N7fwypBRCN+x+ANZKwrDn8xnmFTdFfl3vLOZeLWaqAbNfyWkU yKQsgfZmiTo2Tz0LHofOluLST0HmxUffkbe6FzFAGp2TXNs83gzhp8y8kc3RusPyO8at u4lQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=F4KkgIgm; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-40977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k26-20020ae9f11a000000b00783376514b6si2548594qkg.366.2024.01.26.18.01.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 18:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=F4KkgIgm; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-40977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 334BC1C23261 for ; Sat, 27 Jan 2024 02:01:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0933E1173E; Sat, 27 Jan 2024 02:01:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="F4KkgIgm" Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98EBEB66C for ; Sat, 27 Jan 2024 02:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706320886; cv=none; b=Hdx0T3LsdcngWewZSCtr1etObgJKJFD8jvB36ReiuEtgDHFknVVnOjV6Y/oMhAookpCcRysGJU4XrAYkVuqcXGjZ4yhCTuvgw29zYhc8djyn6Gb4PpjXpaBFYvgdogNsP3LXs9U6kx+55PzNVdOISFxG2L+Srl48QFmL89JtD8E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706320886; c=relaxed/simple; bh=pn08eJXs7OnPxSN3c37dEpPPa01CX6MaTgxVEqfxj/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kPol6E0KcYMMqSExB+AlN3Fh+rFj+yThAOWKHz7iMyKizYrGi9+o2dsZLt1e7oceWuET/LZAmqWSTf/RIuXRKxGkwkkHeQD2zt5VSbPQ6o1u6xexGH9+ZmDZqH2X5V2myhYDf632z5HX4U+FKUBzphnWoXoXAIleGlW08lQfXCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=F4KkgIgm; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1706320882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n3Eqaf0JpcfE9VphQ2k45PLVkc2qGy56bLUTBAo+DzE=; b=F4KkgIgmy9OcwE8R7133eu10UjSiwQ1vtF3lEAuLstprPg8mmQNw459i07XrtJKuoEInSd KGODWGEyybcTIMH1FA+OsjO/ieWDxnXaJhcyoe+XjVAVJ0I3CNUQzvkdYv50vlcGnx4t4B m87eQSBMwzmxcmk73I7VnSpOFATmdnc= From: Kent Overstreet To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vgerkernel.org Cc: Kent Overstreet , peterz@infradead.org, boqun.feng@gmail.com Subject: [PATCH 3/4] net: Convert sk->sk_peer_lock to lock_set_cmp_fn_ptr_order() Date: Fri, 26 Jan 2024 21:01:07 -0500 Message-ID: <20240127020111.487218-4-kent.overstreet@linux.dev> In-Reply-To: <20240127020111.487218-1-kent.overstreet@linux.dev> References: <20240127020111.487218-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Cc: netdev@vger.kernel.org Signed-off-by: Kent Overstreet --- net/core/sock.c | 1 + net/unix/af_unix.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 158dbdebce6a..da7360c0f454 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3474,6 +3474,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid) sk->sk_peer_pid = NULL; sk->sk_peer_cred = NULL; spin_lock_init(&sk->sk_peer_lock); + lock_set_cmp_fn_ptr_order(&sk->sk_peer_lock); sk->sk_write_pending = 0; sk->sk_rcvlowat = 1; diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ac1f2bc18fc9..d013de3c5490 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -706,10 +706,10 @@ static void copy_peercred(struct sock *sk, struct sock *peersk) if (sk < peersk) { spin_lock(&sk->sk_peer_lock); - spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING); + spin_lock(&peersk->sk_peer_lock); } else { spin_lock(&peersk->sk_peer_lock); - spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING); + spin_lock(&sk->sk_peer_lock); } old_pid = sk->sk_peer_pid; old_cred = sk->sk_peer_cred; -- 2.43.0