From patchwork Thu Nov 9 15:39:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 16420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp521372vqs; Thu, 9 Nov 2023 07:42:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2UuwzLVK2ZOvmd13ufzgkzDDKFvlyx2u+DXxTcNIPMnJT21YCLOuKXtCdMC7HateWy9np X-Received: by 2002:a17:903:48e:b0:1cc:7100:2d6c with SMTP id jj14-20020a170903048e00b001cc71002d6cmr4872422plb.27.1699544560939; Thu, 09 Nov 2023 07:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699544560; cv=none; d=google.com; s=arc-20160816; b=Fm3B+CRWgOjjFVpk6ZBokvQnT1Yq8kyIqJsuKsmoFVZrCLm1UrSc842dZRrwv70yWb JegigK73FlTPdGiwSt2RB2IR0pqLVa5T9Au2Q7QSmJ1noVv5QMI7z3lMETJpj+OYToeq 4W10Cn09w/yy6WHSa3ixuWDfbiynL6S5quDKmwC1EGjfU1iOlY53PCMkVQzx5BF2dhUn e001QRw1iTPLA6FjO3KiR97bbZkTzX1hpNsW6hBWPExwuiyqzVOF6aE4TWaILm3s7Htz e7hsuy3ZHQ7vDF3/KCE/7vFXFJLUi2Fq60rtrDEbvy57W+esJXBoOI+hgoyXOqKs6Q2N 2oAw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8brjlfcAMIw//yWNXtytcgIkgS9J4vnjqU05PUI8g5c=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=loTSwgkZfArFvipDyTVtFR43vuJnoQ9jOSgWuitM9tw5zPaOrW8XrhU9noVz4lRkQ1 DRyxHLqWY4nZopki0FaPa3JvdixbBC5oDTX0WXM5k/shxqItNssg9KSiM1Gd87bUxycp lGRXljIoAlVky7h3fXBXTwWZNL2O0Es4CxhoJkmri7sQt9Ev8l8Qm1bh75ZyRmtR0EbX Ctz8XtGAhWuL2IFaWGacDgvLlx3BvAFD1/Li3w/G0/9TBjUBQD0ghCK610L7Dt3NydGW lM/7Pi44jw6ClZk+hWUDzFVoRixohm+5W7Agug0hlGShPsw39vPZRK4dRGVsL8NzLVOZ Rceg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QA8Rb+9J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jf7-20020a170903268700b001cc08c9d692si4667251plb.559.2023.11.09.07.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 07:42:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QA8Rb+9J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3339C806CF7E; Thu, 9 Nov 2023 07:41:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234440AbjKIPlC (ORCPT + 31 others); Thu, 9 Nov 2023 10:41:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbjKIPlB (ORCPT ); Thu, 9 Nov 2023 10:41:01 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A4501BEC for ; Thu, 9 Nov 2023 07:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699544412; 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; bh=8brjlfcAMIw//yWNXtytcgIkgS9J4vnjqU05PUI8g5c=; b=QA8Rb+9JyhP1OR3m40TZWq7YPRnuAhkyJrxCkTQMpvwDQdCLZVLV/G3WEkrRa8ZFxsWoch 7/wJipoYF8xJprtRCNKaQEP4hIWcSoTEVjZOUdZI0WcT60sQGHuZAYo0winP1t3/2UWLZY BruLgNp3jn7/PhXa3dVlFyV51xYQ3qg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-fj2ZUaj8O7m6J0Vlu21oUw-1; Thu, 09 Nov 2023 10:40:10 -0500 X-MC-Unique: fj2ZUaj8O7m6J0Vlu21oUw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 50E48821AE1; Thu, 9 Nov 2023 15:40:10 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85858492BE7; Thu, 9 Nov 2023 15:40:09 +0000 (UTC) From: David Howells To: Marc Dionne Cc: David Howells , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 00/41] afs: Fix probe handling, server rotation and RO volume callback handling Date: Thu, 9 Nov 2023 15:39:23 +0000 Message-ID: <20231109154004.3317227-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 07:41:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782101637700974368 X-GMAIL-MSGID: 1782101637700974368 Hi Marc, Here are a set of patches to make some substantial fixes to the afs filesystem including: (1) Fix fileserver probe handling so that the next round of probes doesn't break ongoing server/address rotation by clearing all the probe result tracking. Instead, detach the probe results into a separate struct and allocate a new one each time we start probing and update the pointer to it. Probes are also sent in order of address preference to try and improve the chance that the preferred one will complete first. (2) Fix server rotation so that it uses configurable address preferences across on the probes that have completed so far than ranking them by RTT as the latter doesn't necessarily give the best route. The preference list can be altered by echoing commands into /proc/net/afs/addr_prefs. (3) Fix the handling of Read-Only (and Backup) volume callbacks as there is one per volume, not one per file, so if someone performs a command that, say, offlines the volume but doesn't change it, when it comes back online we don't spam the server with a status fetch for every vnode we're using. Instead, check the Creation timestamp in the VolSync record when prompted by a callback break. (4) Handle volume regression (ie. a RW volume being restored from a backup) by scrubbing all cache data for that volume. This is detected from the VolSync creation timestamp. (5) Adjust abort handling and abort -> error mapping to match better with what other AFS clients do. (6) Handle file locking locally on RO volumes rather than trying to get them on the server. Exclusive locks aren't really handled in a RO volume. (7) Set RO volumes to be RO superblocks. (8) Fix offline and busy volume state handling as they only apply to individual server instances and not entire volumes and the rotation algorithm should go and look at other servers if available. Also make it sleep briefly before each retry if all the volume instances are unavailable. In addition there are a number of small fixes in rxrpc and afs included here so that those problems don't affect testing. The patches can be found here: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=afs-fixes Thanks, David --- %(shortlog)s %(diffstat)s David Howells (41): rxrpc: Fix RTT determination to use PING ACKs as a source rxrpc: Fix two connection reaping bugs rxrpc: Fix some minor issues with bundle tracing afs: Fix afs_server_list to be cleaned up with RCU afs: Make error on cell lookup failure consistent with OpenAFS afs: Remove whitespace before most ')' from the trace header afs: Automatically generate trace tag enums afs: Add comments on abort handling afs: Turn the afs_addr_list address array into an array of structs rxrpc, afs: Allow afs to pin rxrpc_peer objects afs: Don't skip server addresses for which we didn't get an RTT reading afs: Rename addr_list::failed to probe_failed afs: Handle the VIO abort explicitly afs: Use op->nr_iterations=-1 to indicate to begin fileserver iteration afs: Return ENOENT if no cell DNS record can be found afs: Wrap most op->error accesses with inline funcs afs: Don't put afs_call in afs_wait_for_call_to_complete() afs: Simplify error handling afs: Add a tracepoint for struct afs_addr_list afs: Rename some fields afs: Use peer + service_id as call address afs: Fold the afs_addr_cursor struct in rxrpc: Create a procfile to display outstanding clien conn bundles afs: Add some more info to /proc/net/afs/servers afs: Remove the unimplemented afs_cmp_addr_list() afs: Provide a way to configure address priorities afs: Mark address lists with configured priorities afs: Dispatch fileserver probes in priority order afs: Dispatch vlserver probes in priority order afs: Keep a record of the current fileserver endpoint state afs: Combine the endpoint state bools into a bitmask afs: Fix file locking on R/O volumes to operate in local mode afs: Mark a superblock for an R/O or Backup volume as SB_RDONLY afs: Make it possible to find the volumes that are using a server afs: Defer volume record destruction to a workqueue afs: Move the vnode/volume validity checking code into its own file afs: Apply server breaks to mmap'd files in the call processor afs: Parse the VolSync record in the reply of a number of RPC ops afs: Overhaul invalidation handling to better support RO volumes afs: Fix fileserver rotation afs: Fix offline and busy handling fs/afs/Makefile | 2 + fs/afs/addr_list.c | 224 +++++------ fs/afs/addr_prefs.c | 531 +++++++++++++++++++++++++ fs/afs/afs.h | 4 + fs/afs/callback.c | 138 ++++--- fs/afs/cell.c | 5 +- fs/afs/cmservice.c | 5 +- fs/afs/dir.c | 55 +-- fs/afs/dir_silly.c | 2 +- fs/afs/dynroot.c | 4 +- fs/afs/file.c | 20 +- fs/afs/fs_operation.c | 86 ++-- fs/afs/fs_probe.c | 323 ++++++++------- fs/afs/fsclient.c | 56 ++- fs/afs/inode.c | 198 +--------- fs/afs/internal.h | 355 +++++++++++------ fs/afs/main.c | 1 + fs/afs/misc.c | 10 +- fs/afs/proc.c | 102 ++++- fs/afs/rotate.c | 495 ++++++++++++++++------- fs/afs/rxrpc.c | 107 ++--- fs/afs/server.c | 130 +++--- fs/afs/server_list.c | 126 +++++- fs/afs/super.c | 11 +- fs/afs/validation.c | 376 ++++++++++++++++++ fs/afs/vl_alias.c | 69 +--- fs/afs/vl_list.c | 29 +- fs/afs/vl_probe.c | 60 ++- fs/afs/vl_rotate.c | 223 +++++++---- fs/afs/vlclient.c | 124 ++++-- fs/afs/volume.c | 66 +++- fs/afs/write.c | 6 +- fs/afs/yfsclient.c | 6 +- include/net/af_rxrpc.h | 15 +- include/trace/events/afs.h | 742 +++++++++++++++++++---------------- include/trace/events/rxrpc.h | 3 + net/rxrpc/af_rxrpc.c | 62 ++- net/rxrpc/ar-internal.h | 6 +- net/rxrpc/call_object.c | 17 +- net/rxrpc/conn_client.c | 17 +- net/rxrpc/conn_object.c | 2 +- net/rxrpc/input.c | 4 + net/rxrpc/local_object.c | 2 +- net/rxrpc/net_ns.c | 4 + net/rxrpc/peer_object.c | 56 ++- net/rxrpc/proc.c | 76 ++++ net/rxrpc/sendmsg.c | 11 +- 47 files changed, 3304 insertions(+), 1662 deletions(-) create mode 100644 fs/afs/addr_prefs.c create mode 100644 fs/afs/validation.c