Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp716057ybn; Wed, 2 Oct 2019 05:11:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKT5GM+pedS0xj/z4LDj+GXnit8aXicPQ6Ja2m88RvWic/T15g4keQUT5/vrXP2bBpAkhC X-Received: by 2002:a05:6402:a4b:: with SMTP id bt11mr3310058edb.175.1570018264703; Wed, 02 Oct 2019 05:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570018264; cv=none; d=google.com; s=arc-20160816; b=hMBI5KOBCexIYad726hwyosAdxqHi5b97wj4mllnqR3TIkbtHh1cxZoDRcDxrXa1zP UAWPDKk3OI/LKTqU/aOrHboc8AEEtzXb8Zyjcp86WA58LEBroJ7SUuQvgurQkkPmvxRw tovOW8El5x8hngQTOtHFT6txfdx+9rxv5FeFIzh4JCqy8jcbOgk2wDa3SM+eowhrbBCl BqLUljX8hx7EsvQ3EfXkL5JkjnkUxTX0jPIiCLYolJoFCxkLUf1BiGmXr2YkqhFYiHuO k6SZDq0DTZZTS8UzaQ8LsKAVz/j7m6PbUrbixpfdBK1aJRvbQh/UKiVQKH6uqrk7iHss yJ4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=V683Hv1H2LhtDO8EBncayJ/7IpA1VgANRc29S+w7JNc=; b=yPtYR/Ip3beHh0qpcYuZMeCbdzMl3kV3FA4GDIOvvqJnpZcDF7HO23cQ3UD0gvnys2 5gHcS2ABS5ugCrIqp7NNPUx48acbjMTFo7z+8fHfhtn2EOU4RfXHAbMspxKCgMPMzMBS Py/1JX3J2HapPSlArl4st3mOPE7yk/R4sEW5vcUSyL2/vmG9VTycIBRAowwCdDyG8DSd H1QDME2EcuPyY62BOzpu0S6DR38+/pMNuTCyK2S8nTHEXFDm1O68qfVJjN6uT4tCeiTQ /gzThWOA+1y4qCELCHpFza6rxiv1a0+07xs0+gkpmv8qkn6S2fFCFTJuaDp8Pc2iPaPD R6gA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q35si12181125eda.122.2019.10.02.05.10.27; Wed, 02 Oct 2019 05:11:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbfJBKlo (ORCPT + 99 others); Wed, 2 Oct 2019 06:41:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53094 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfJBKlo (ORCPT ); Wed, 2 Oct 2019 06:41:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 162ED10C094C; Wed, 2 Oct 2019 10:41:44 +0000 (UTC) Received: from [172.16.176.1] (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80F5A1001B08; Wed, 2 Oct 2019 10:41:43 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: Anna.Schumaker@netapp.com, linux-nfs@vger.kernel.org, jamespharvey20@gmail.com Subject: Re: [PATCH] SUNRPC: fix race to sk_err after xs_error_report Date: Wed, 02 Oct 2019 06:41:44 -0400 Message-ID: <605DFB04-3686-4CCE-A87E-905E91E01F50@redhat.com> In-Reply-To: References: <9796ba15d926f65923965c2aedf777aaa59861e8.1569954618.git.bcodding@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Wed, 02 Oct 2019 10:41:44 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 1 Oct 2019, at 15:38, Trond Myklebust wrote: > On Tue, 2019-10-01 at 14:30 -0400, Benjamin Coddington wrote: >> ... >> diff --git a/include/linux/sunrpc/xprtsock.h >> b/include/linux/sunrpc/xprtsock.h >> index 7638dbe7bc50..8ffae73dea6c 100644 >> --- a/include/linux/sunrpc/xprtsock.h >> +++ b/include/linux/sunrpc/xprtsock.h >> @@ -56,6 +56,7 @@ struct sock_xprt { >> */ >> unsigned long sock_state; >> struct delayed_work connect_worker; >> + int xprt_err; > > Perhaps move this down just after srcport so we don't create an > unnecessary hole in the structure? Ok! >> struct work_struct error_worker; >> struct work_struct recv_worker; >> struct mutex recv_mutex; >> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c >> index e2176c167a57..7fe77eef7080 100644 >> --- a/net/sunrpc/xprtsock.c >> +++ b/net/sunrpc/xprtsock.c >> @@ -1250,12 +1250,12 @@ static void xs_error_report(struct sock *sk) >> goto out; >> >> transport = container_of(xprt, struct sock_xprt, xprt); >> - err = -sk->sk_err; >> - if (err == 0) >> + transport->xprt_err = -sk->sk_err; > > Doesn't this need a smp write barrier to ensure it isn't reordered with > the set_bit() in xs_run_error_worker()? Yes, it does need that or the error_worker may clear the bit without seeing the error. Ben