Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5038324pxb; Mon, 15 Feb 2021 08:00:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxD2PADEGFNcFTWr1XLvMI9HJutxC9V9qK39fXNHCE9GT7/QxXZPXkXeb4XGgtZcCuOx/CJ X-Received: by 2002:a17:906:90d9:: with SMTP id v25mr14276912ejw.271.1613404811692; Mon, 15 Feb 2021 08:00:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404811; cv=none; d=google.com; s=arc-20160816; b=kXZ7FM+u9zF2Qffp4wW4pcCMk0oEk8c9knCt+QFuVxjEHh7Mpim9wuuOPUIHWMQjsc 9jQ4Q7G9w6ZtrMhgLlzuxQAW53K2I+RPYKdQym20YF4WgIJ1/twVT1RPgyOwC8lawLOs eJzQ4jMMalHAoDpUqL8ctdbCOk/VgCwSFrqeHvyVsYKcuMZZn9GfteOpqyROPAbZambh IQm3sGXj96Tv4JQnZVxABHTBEqXbTO1X3X9pNErcgE4MwTPRwdcmr8J0zJbtV80FX4Lz EsZj33cmq2QIIMOOF0M85SBxmgGeBUqM9y5HoepaXKrUc3WVNJB2W4YFK6GyQox0ZgQR BE1g== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=vuZXYEE8ytAOGmfVdwJVAq5rI3wrIYL1qJesDqmdOFg=; b=fTD+ZyYaFC0kBV2JZwh0uTTihwL8a64tpmxtK+FhGsy9tpBiWxs/i+rvz71Uvch/Ya 8paeyD6BNwiJ2FZpfRf4tYz2J4VLrT6NIjbZiGnzIDO+ZshlJ/dpOWv/jzRd/paxP23U gvRATCexGXLKaqDfsFW81ke44hS3FequD2r8SNX79J5i7ASyqlRa3iY9dJIQJQ3AnIia geKhnvhtkqYArn/a2kdeX0zK8gstjcsZPVzvKDpZpfvXb0tzA+UUzyr22CugyW4yzXw2 SZN1bVQ9l7Lr7K6iHUTIw+ulzolH/OrP5iT1Q0vBSqxLXshHUmbD0AeES5gQrk99YUyF x/Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bPj+BHaU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si11648904eje.331.2021.02.15.07.59.47; Mon, 15 Feb 2021 08:00:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bPj+BHaU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbhBOP6N (ORCPT + 99 others); Mon, 15 Feb 2021 10:58:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36355 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbhBOPvP (ORCPT ); Mon, 15 Feb 2021 10:51:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613404188; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vuZXYEE8ytAOGmfVdwJVAq5rI3wrIYL1qJesDqmdOFg=; b=bPj+BHaUTkNMLiFnV+quL4fr8FAwXD8qVngM3O93MB8IpHy+2wrwiRyvmS5bJw9C+Mr1Jn J2IJZMmZemo27S3HJu4CDcs9j49QlmQeEOCdw3mv1wFnIQC6l7BcIEemPOYf7m4gmpvLrN LTtZGV80J3mjjkCUqAt4fBGL7xiRGyw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-ROeColdsMi66sMBRwjE3-A-1; Mon, 15 Feb 2021 10:49:44 -0500 X-MC-Unique: ROeColdsMi66sMBRwjE3-A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 292D9107ACE3; Mon, 15 Feb 2021 15:49:42 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-119-68.rdu2.redhat.com [10.10.119.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E67F719D9F; Mon, 15 Feb 2021 15:49:31 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 26/33] afs: Use the fs operation ops to handle FetchData completion From: David Howells To: Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet Cc: linux-afs@lists.infradead.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, dhowells@redhat.com, Jeff Layton , David Wysochanski , "Matthew Wilcox (Oracle)" , Alexander Viro , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 15 Feb 2021 15:49:31 +0000 Message-ID: <161340417106.1303470.3502017303898569631.stgit@warthog.procyon.org.uk> In-Reply-To: <161340385320.1303470.2392622971006879777.stgit@warthog.procyon.org.uk> References: <161340385320.1303470.2392622971006879777.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Use the 'success' and 'aborted' afs_operations_ops methods and add a 'failed' method to handle the completion of an AFS.FetchData, AFS.FetchData64 or YFS.FetchData64 RPC operation rather than directly calling the done func pointed to by the afs_read struct from the call delivery handler. This means the done function will be called back on error also, not just on successful completion. This allows motion towards asynchronous data reception on data fetch calls and allows any error to be handed off to the fscache read helper in the same place as a successful completion. Signed-off-by: David Howells cc: linux-afs@lists.infradead.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org --- fs/afs/file.c | 15 +++++++++++++++ fs/afs/fs_operation.c | 4 +++- fs/afs/fsclient.c | 3 --- fs/afs/internal.h | 1 + fs/afs/yfsclient.c | 3 --- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/fs/afs/file.c b/fs/afs/file.c index f6282ac0d222..231e9fd7882b 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -255,6 +255,19 @@ void afs_put_read(struct afs_read *req) } } +static void afs_fetch_data_notify(struct afs_operation *op) +{ + struct afs_read *req = op->fetch.req; + int error = op->error; + + if (error == -ECONNABORTED) + error = afs_abort_to_error(op->ac.abort_code); + req->error = error; + + if (req->done) + req->done(req); +} + static void afs_fetch_data_success(struct afs_operation *op) { struct afs_vnode *vnode = op->file[0].vnode; @@ -263,6 +276,7 @@ static void afs_fetch_data_success(struct afs_operation *op) afs_vnode_commit_status(op, &op->file[0]); afs_stat_v(vnode, n_fetches); atomic_long_add(op->fetch.req->actual_len, &op->net->n_fetch_bytes); + afs_fetch_data_notify(op); } static void afs_fetch_data_put(struct afs_operation *op) @@ -276,6 +290,7 @@ static const struct afs_operation_ops afs_fetch_data_operation = { .issue_yfs_rpc = yfs_fs_fetch_data, .success = afs_fetch_data_success, .aborted = afs_check_for_remote_deletion, + .failed = afs_fetch_data_notify, .put = afs_fetch_data_put, }; diff --git a/fs/afs/fs_operation.c b/fs/afs/fs_operation.c index 97cab12b0a6c..938e28a00101 100644 --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -195,8 +195,10 @@ void afs_wait_for_operation(struct afs_operation *op) case -ECONNABORTED: if (op->ops->aborted) op->ops->aborted(op); - break; + fallthrough; default: + if (op->ops->failed) + op->ops->failed(op); break; } diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c index 31e6b3635541..5e34f4dbd385 100644 --- a/fs/afs/fsclient.c +++ b/fs/afs/fsclient.c @@ -392,9 +392,6 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) break; } - if (req->done) - req->done(req); - _leave(" = 0 [done]"); return 0; } diff --git a/fs/afs/internal.h b/fs/afs/internal.h index daf5339ae316..d46389406021 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -742,6 +742,7 @@ struct afs_operation_ops { void (*issue_yfs_rpc)(struct afs_operation *op); void (*success)(struct afs_operation *op); void (*aborted)(struct afs_operation *op); + void (*failed)(struct afs_operation *op); void (*edit_dir)(struct afs_operation *op); void (*put)(struct afs_operation *op); }; diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c index 363d6dd276c0..2b35cba8ad62 100644 --- a/fs/afs/yfsclient.c +++ b/fs/afs/yfsclient.c @@ -449,9 +449,6 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) break; } - if (req->done) - req->done(req); - _leave(" = 0 [done]"); return 0; }