Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796306233; b=i0Kg6Y3oJnCn5xhmlUjoQANQFsFnqij3n3zFV4XltNqGT7APSBnl2WDR+mHLBGykL0zy +XiOoNBRTPF9niwYVpWR9i6cYr4yfnSqV9pgUnc+tsOYS4eDmjZIo/57mmsGsznL2QeCm Lm56Sq1g+gVgNjbaVfspJ9WgD8dA7UcEIB/jpkz0kQ/EMR+t069Apu7kttfFIHbSNjXgr +g8OcRkBo3bVRPcJs/U69UtCYF6CMOkzgWyn1Xd++kF6avJupMUnWZPbNlHnR+2VXaz/n KQID6OdWvVqp5W7GGYTiUsuAlI1jjLu0Yff7tveBKHzpZ2PQB4z/lR6S4riLoiGnq0Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796306233; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=toqNiy+RHWx0PTuSwA7GHdm1Xt0iqk2vd0KZH4zFdW8=; b=yexSoPXdUcxLd9HyrBsnwy+nW4yGKPhIlRgv1rlczljLIjv+miVxj6r11qaQYMoPE3Qv BSljQ4TDGFNRwK1OWn5hyN+Vz/QY/puQqjns6jVmTRhDExfPjD+xtGBWfzCUPpfdulsdJ oE5w7DEcd9k4Sd3/bv55hLLU6Y9E7hfl3U0TSppNjYeRdEXXdtAH8SfP0vGf9V/27d4FS IarNZHKuD6DFXv0I1xLfSF78MYW5dY9GyIllqQ8Eiz2XhPGxBjMvyy+g2vI6iP2Dsj9sX GP5W94fIDdGdfIkUIwQxVGdV7KufLZaFIkPf2y6NTi3PchHFh2Y7tB+8qHAHOj8QFCA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=hammerspace.com; spf=pass smtp.mailfrom=hammerspace.com; dkim=pass header.d=hammerspace.com header.i=@hammerspace.com header.a=rsa-sha256 header.s=google header.b="Aa/4+OFI"; arc=none smtp.remote-ip=209.85.167.179 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAD15606A333 for ; Thu, 3 Dec 2026 13:57:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AAD15606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=hammerspace.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hammerspace.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hammerspace.com header.i=@hammerspace.com header.a=rsa-sha256 header.s=google header.b=Aa/4+OFI Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-57297329b3eso7243496b6e.0 for ; Thu, 03 Dec 2026 05:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hammerspace.com; s=google; t=1796306231; x=1796911031; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=toqNiy+RHWx0PTuSwA7GHdm1Xt0iqk2vd0KZH4zFdW8=; b=Aa/4+OFIr5lM6DsBpQI1Cg6YnSktZHEo/IywaRoSl6Mn1TtGUhhOYVYHInvpyuual/ 4iGNeljAxj90vc9fZesTM6XE3HqvMyu7xcxdqvMnfoE33czoBgGKM5tuiyV5bbj14tS2 OIlwQ3rXnoIy88v6gO9l4mUCdV+tGHfg8urFyeNn7RF5D7KEsuoVhDCrQv3ToFGd40am 2MukPCZxsXQPGIk1qsFxsPX9ACaKHofhMpR9EVOaEjMLjxaUMqqyHuxKqjTkFe1vcoP8 NtKi1Ea2GHNsI/uN9Zry74Tu14DhG10DEI4z2VJj6kKlLUwDULDLxF5wENv+lMo5guxh /iyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796306231; x=1796911031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=toqNiy+RHWx0PTuSwA7GHdm1Xt0iqk2vd0KZH4zFdW8=; b=Yra4xR1umK0QyGnVMXe6vNUCyzkiG5nbVtpTdQerhUpiUOvsT37NKW9PrjDGcBJfiF xPilKqE9lFVLXvTvgkUdf+tKNnuZAeICUOmp9Oge0PU9onTJuxr5GzMQcrG+dEvDpCa6 nrN5M0hEh91HSdOdHruQ9p62fCS2H/Ux0QjRutPK2HJL1y2M/iZYLcRrNh86S7VpmpJD XgHcajO4UyOjBYwUVT3UqiodZnkQss7O5WCT5NS+r9QOEyn36hHixPNC2IZ3FzT/rW4K afK4m/ZM79b5dsEdgMC1dSeSyZUAuKE6GcChpTir3IORjdFWDzIBErkeot39LzwpubeW YgYw== X-Forwarded-Encrypted: i=1; AL+hErHdIrWS8+qcjSHTbAwWQv6eh/5UAJ47xNufu0PUXHDmmkhutO0nOFWz5GgYyedOjg6NcPkwzYSiMyE=@vger.kernel.org X-Gm-Message-State: APuU4Z8HX6EelU83IEusK0r/+5hiazLrsVbLbftEdhoJs1cyl0RSQDm0 1D7Z2FXYpNzeCV+EQgwYQNB1eNqmmwNTBvKwFkLW1FUOX5qE3FD85KbpHLNZMwLMIVPXgy0lQkM gXzs0 X-Gm-Gg: AZFdTZdQOiOl5cMN22woYvmls9B1dpXe9EiAn3LdcmzmdQJfJVoH6UkpyiIpege5+cI MD8tES396806vq09JKhB4w8EQ/ui8Wx7eY5sl+Ezkx84WlOOkwXzsv/c6MPxHTpbFrzpaU+25HT TJMRPZtAdFKjqc0nR4wwtaWqlZ6LeiDcS6Ke8xkKD03qnzcmL8Gt6F2AyCSOsyrf5rLT2Tik1x+ gWztBG0mn48khRMESoXeoEcp/RpOiHuNekOTpGcgW316vldp/Oae3HVGgIkqjxdg8I83jKEJ2h0 tKx9GSNlqUI0JS7Q6nwY90k2O36xfnlLW805+1kMdqw+7+ePaZfkv5Ht/w5j/lfFUweXrZpl2fN alApDXTwVrxGDDPqqecmwP7FNfu74qUDVh0ny2Bbqd0mNEprtkxiTnrBByUEFtT0/Vcwdwld1Dy HM2S6E8ejIy6YbP+ze8EL7nKMBWfzKb2LG9dijyj5DfFli+Y8lQTYQG6tvgynC7WsHWgMvIKAcU sa3oR1mNaiqSaGp7AOI3/KYZqP9D0DFx4hdTcv/5dv/zM6qQ5k390gYX/IJLG+XvphCU6rMnhZD DrXYq7FNngV4wsIhIrMqBy5N4ZZ90Ictk/NgL7ZColkK9OudwaDH9fzC14JsMOvnQVrRFYln X-Received: by 2002:a05:6808:14c3:b0:564:5fe0:dd60 with SMTP id 5614622812f47-57a06c1b043mr50633199b6e.9.1796306231194; Thu, 03 Dec 2026 05:57:11 -0800 (PST) Received: from bcodding.csb.hammerspace.com ([66.97.168.37]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57a350548ffsm30973955b6e.11.2026.12.03.05.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 05:57:10 -0800 (PST) From: Benjamin Coddington To: Trond Myklebust , Anna Schumaker , Mike Snitzer Cc: Olga Kornievskaia , linux-nfs@vger.kernel.org Subject: [PATCH v4 03/11] NFS: send every mirror when one of them can take no more Date: Thu, 3 Dec 2026 08:56:58 -0500 Message-ID: <488fc1f761086e35b76e7d9061f28e30ae379e7d.1796306148.git.bcodding@hammerspace.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Benjamin Coddington When a request doesn't fit, __nfs_pageio_add_request() sends only the current mirror. The other mirrors keep their requests until they fill too or the descriptor completes, so a pg_init for the next request runs while they still hold the previous ones. If that pg_init has to give up the mirrors, as flexfiles does when the next range has no layout segment and its write falls back to the MDS, the requests still queued on them are stranded. Send every mirror at that point. With the same wsize on each data server the mirrors fill at the same request, so the copies go out together and the next pg_init finds the descriptor empty. With different sizes a mirror may be sent before it is full, or with its copy of the request that didn't fit on another; a later pg_init can then still find a request queued. If the current mirror asks for a retry, leave the others queued: it is recoalesced first, and the mirrors are sent together when the request that didn't fit comes round again. Only the current mirror is recoalesced on this path, so if sending another mirror requeues its requests for a retry, fail the descriptor with -EAGAIN; error cleanup then redirties or requeues the requests of every mirror for the next pass. Fixes: a7d42ddb3099 ("nfs: add mirroring support to pgio layer") Cc: stable@vger.kernel.org # v4.0+ Signed-off-by: Benjamin Coddington --- fs/nfs/pagelist.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 0bb18acaf872..504b880f15a0 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -1202,6 +1202,42 @@ static void nfs_pageio_doio(struct nfs_pageio_descriptor *desc) } } +/* + * When one mirror can take no more, send every mirror: with the same wsize + * on each the copies stay in step, and a pg_init for the next request finds + * the descriptor empty. + */ +static void nfs_pageio_doio_mirrors(struct nfs_pageio_descriptor *desc) +{ + u32 cur = desc->pg_mirror_idx; + u32 midx, restore_idx; + + nfs_pageio_doio(desc); + /* A single mirror can have a nonzero pg_mirror_idx (flexfiles reads) */ + if (desc->pg_mirror_count == 1) + return; + /* It is recoalesced first; the mirrors go out together after that */ + if (nfs_pgio_current_mirror(desc)->pg_recoalesce) + return; + for (midx = 0; midx < desc->pg_mirror_count; midx++) { + if (desc->pg_error < 0) + break; + if (midx == cur) + continue; + restore_idx = nfs_pgio_set_current_mirror(desc, midx); + nfs_pageio_doio(desc); + /* + * Only the current mirror is recoalesced from here, so fail a + * retry on another one; error cleanup then redirties or + * requeues the requests of every mirror. + */ + if (desc->pg_error >= 0 && + nfs_pgio_current_mirror(desc)->pg_recoalesce) + desc->pg_error = -EAGAIN; + nfs_pgio_set_current_mirror(desc, restore_idx); + } +} + static void nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, struct nfs_page *req) @@ -1263,7 +1299,7 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, /* Can't coalesce any more, so do I/O */ nfs_page_group_unlock(req); desc->pg_moreio = 1; - nfs_pageio_doio(desc); + nfs_pageio_doio_mirrors(desc); if (desc->pg_error < 0 || mirror->pg_recoalesce) return 0; /* retry add_request for this subreq */ -- 2.53.0