From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 8DCD91D90DB for ; Thu, 21 Nov 2024 15:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732201907; cv=none; b=Su1pH1BOf1NQm0BRHlH3TN2WAkZfvgXn7uG/QSFG2QD1haLrCjxtQfempJpJuQ1tFVg3tQLsUBe7ZiBvnlacMvAPoaDX5ll8Vdh4+WesDIwggbSCs9ho6DVKSb5p3lpU0k7Us94nZU2ezrK5kdgaH2U9yhnoCA4j9oaE0nVyuu8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732201907; c=relaxed/simple; bh=CdOIvr7HSZq5NjuQtJdpoEDTI6rFxBrvraKUALHoG8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kDpSVrlG22DhUZgcbZGwyCNujONfl6cuxRn7+YXxHJblx4RyitnurGf6zmAtBF/TiJjZUnyro8wMEoXuUnM4xHIWCzyaRoqCUeIiWzHGYMCqlw87dAsKTkX99uLYd7kgZpCCoimou16iE8oYEDIzxqh4sfzBK3dSfQfzoUJbKLo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iGyevH2X; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iGyevH2X" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732201904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AAU5tspYcdCNEP7up2zgoXRaM3KJXFMONMxQMY8ZH2k=; b=iGyevH2Xu8rpsVXOpdZxtJz4wlY2KsLkn+Q/TKRwz6RGIYy0EuljAuRwrsGCvTf1jl02o/ vuGgFMtqKWq+9sAuIFPn1sI3i14t7oqK6ioy5/GyG90EcxuBCT/bdJGo5cjn6+fvXnhijJ KLSDyZR3KfC6Elw9HXnsgJ5AHpAPhEI= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-JYyy3iZsMlmkA76rTkVtaQ-1; Thu, 21 Nov 2024 10:11:39 -0500 X-MC-Unique: JYyy3iZsMlmkA76rTkVtaQ-1 X-Mimecast-MFC-AGG-ID: JYyy3iZsMlmkA76rTkVtaQ Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C8C819560AF; Thu, 21 Nov 2024 15:11:37 +0000 (UTC) Received: from [192.168.37.1] (unknown [10.22.74.7]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D97711955E99; Thu, 21 Nov 2024 15:11:35 +0000 (UTC) From: Benjamin Coddington To: Chuck Lever Cc: Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH 2/2] nfs/blocklayout: Limit repeat device registration on failure Date: Thu, 21 Nov 2024 10:11:33 -0500 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 On 20 Nov 2024, at 10:22, Chuck Lever wrote: > On Wed, Nov 20, 2024 at 09:09:35AM -0500, Benjamin Coddington wrote: >> If we're unable to register a SCSI device, ensure we mark the device as >> unavailable so that it will timeout and be re-added via GETDEVINFO. This >> avoids repeated doomed attempts to register a device in the IO path. >> >> Add some clarifying comments as well. >> >> Fixes: d869da91cccb ("nfs/blocklayout: Fix premature PR key unregistration") >> Signed-off-by: Benjamin Coddington >> Reviewed-by: Christoph Hellwig >> --- >> fs/nfs/blocklayout/blocklayout.c | 12 +++++++++++- >> 1 file changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c >> index 0becdec12970..b36bc2f4f7e2 100644 >> --- a/fs/nfs/blocklayout/blocklayout.c >> +++ b/fs/nfs/blocklayout/blocklayout.c >> @@ -571,19 +571,29 @@ bl_find_get_deviceid(struct nfs_server *server, >> if (!node) >> return ERR_PTR(-ENODEV); >> >> + /* >> + * Devices that are marked unavailable are left in the cache with a >> + * timeout to avoid sending GETDEVINFO after every LAYOUTGET, or >> + * constantly attempting to register the device. Once marked as >> + * unavailable they must be deleted and never reused. >> + */ >> if (test_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags)) { >> unsigned long end = jiffies; >> unsigned long start = end - PNFS_DEVICE_RETRY_TIMEOUT; >> >> if (!time_in_range(node->timestamp_unavailable, start, end)) { >> + /* Force a new GETDEVINFO for this LAYOUT */ > > Or perhaps: "Uncork subsequent GETDEVINFO operations for this device" > Sure, ok! >> nfs4_delete_deviceid(node->ld, node->nfs_client, id); >> goto retry; >> } >> goto out_put; >> } >> >> - if (!bl_register_dev(container_of(node, struct pnfs_block_dev, node))) >> + /* If we cannot register, treat this device as transient */ > > How about "Make a negative cache entry for this device" Hmm - that's closer to the dentry language rather than how we refer to temporary error cases in device land. For me the "transient" has some hopeful meaning as in we expect this might work in the future - but I'm ok changing this comment. There will be some NFS clients that might try to do pNFS SCSI but will never actually have the devices locally, and so that's not a "transient" situation. This can only fixed today with export policy. > >> + if (!bl_register_dev(container_of(node, struct pnfs_block_dev, node))) { >> + nfs4_mark_deviceid_unavailable(node); >> goto out_put; >> + } >> >> return node; >> >> -- >> 2.47.0 >> > > It took me a bit to understand what this patch does. It is like > setting up a negative dentry so the local device cache absorbs > bursts of checks for the device. OK. Yes, its like the layout error handling, but for devices. Its not obvious at this layer, but every IO wants to do LAYOUTGET, then figure out which device GETDEVINFO, then here we need to prep the device with a reservation. Its a lot of slow work that makes a mess of IO latencies if one of the later steps is going to fail for awhile. > Just an observation: Negative caching has some consequences too. > For instance, there will now be a period where, if the device > happens to become available, the layout is still unusable. I wonder > if that's going to have some undesirable operational effects. It sure does, but I don't think there's a simple way to get notified that a SCSI device has re-appeared or has started supporting persistent reservations. Ben