Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp487754pxf; Thu, 8 Apr 2021 07:12:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXnslHgpC57dD5zRSY6SxP7w/nO3LZvyI/3UUh+2zetHqDbKzgG4Zpoq6h7cf3uJmI0xWS X-Received: by 2002:a17:90a:a108:: with SMTP id s8mr8622286pjp.199.1617891128704; Thu, 08 Apr 2021 07:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617891128; cv=none; d=google.com; s=arc-20160816; b=EgJ9rLgAUaqKVs8f4vrmcdsREcXCVyG0BO3bmrriqCj38oKkeCSmSg99Jw6vYBRJTl /FHHypvPJ++q80nqOkx5O+fXUjtM18yIb21ix+aHfjwHhCFZzob3E1uMXUhCe+1u0O2A M076l7IYCArbXtCMHmkB/7L7qT5cgmITb3ENyH2Bs9VkaXKHR9r1eD3+jugn2ju3A19W zVjVH6sfPsKBaMbK46ajIiN8dffTUcMJLSmbS89BPU7kaTKrA0M4dxSXx26jNheWT436 DX/pDgCStX6IeRw7b5lD8F75cN3nu+lPVbHbttHnIsHznQJ34bQ9hf5W5wp2v14iOJ9P Iepw== 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=Yg1OCBqNYt5+6/EeS3SScne7ImQnVnrehlG+83Qk3C8=; b=v4dkBqgDwlMoe37pMqZETNLMYb4hMMQoDtA3odwgxFxDwGAcPWk+zeJwVnD3RUipeu xeLssaqyG5n1PCJPYg5LdbBfsjB4TZot/ZDPUsxhhdbr4vz0aYMwUD1k3yQuiYwt9G9n GlWGHaHncs9iIjUBRwLpWB0vh7aW5jtNB4hiwBvdlnvkNFrqMa8hpX4H3nxksAIdg8tj u54Dv1JpkYVNwJiMAo5UjbNcFTZKd0KY30v/u67Bp4r236qoZbaowNGOB6ddd2q3UfpE IRx0Bbp5hz/fcHb6WTtca39Hf3M2oiuzRPyEPVt0PDsLso+9Pwkn/hu+mO0tWWhpjSIm CtFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QWPf7gbP; 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 m4si18155490pgh.548.2021.04.08.07.11.51; Thu, 08 Apr 2021 07:12:08 -0700 (PDT) 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=QWPf7gbP; 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 S231970AbhDHOLy (ORCPT + 99 others); Thu, 8 Apr 2021 10:11:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29270 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232233AbhDHOKW (ORCPT ); Thu, 8 Apr 2021 10:10:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617891010; 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=Yg1OCBqNYt5+6/EeS3SScne7ImQnVnrehlG+83Qk3C8=; b=QWPf7gbPQVB0pE8tYNBqVPaLqo3yPB89st3NYubMb1zyANy8bvsqm1HJEFElh+aXINrpRr LrrSR5th9D5agQBn5iq+AGeUchRagFL3wzETgwwKIek7KFDQ0qaQ0cLUBL1rPM8ckNA5I3 7IPEP83GK/LETWnXH3ZX0z8KQl7D8qw= 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-370-L5VnelBFPh-D7ydPl8ZeSw-1; Thu, 08 Apr 2021 10:10:09 -0400 X-MC-Unique: L5VnelBFPh-D7ydPl8ZeSw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58B26C73A1; Thu, 8 Apr 2021 14:10:07 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-119-35.rdu2.redhat.com [10.10.119.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id C89E66BC0C; Thu, 8 Apr 2021 14:10:00 +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 v6 28/30] afs: Use the fs operation ops to handle FetchData completion From: David Howells To: linux-fsdevel@vger.kernel.org Cc: linux-afs@lists.infradead.org, linux-cachefs@redhat.com, dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , 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-kernel@vger.kernel.org, linux-mm@kvack.org Date: Thu, 08 Apr 2021 15:09:59 +0100 Message-ID: <161789099994.6155.473719823490561190.stgit@warthog.procyon.org.uk> In-Reply-To: <161789062190.6155.12711584466338493050.stgit@warthog.procyon.org.uk> References: <161789062190.6155.12711584466338493050.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.79 on 10.5.11.11 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 Link: https://lore.kernel.org/r/160588541471.3465195.8807019223378490810.stgit@warthog.procyon.org.uk/ # rfc Link: https://lore.kernel.org/r/161118157260.1232039.6549085372718234792.stgit@warthog.procyon.org.uk/ # rfc Link: https://lore.kernel.org/r/161161052647.2537118.12922380836599003659.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/161340417106.1303470.3502017303898569631.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/161539560673.286939.391310781674212229.stgit@warthog.procyon.org.uk/ # v4 Link: https://lore.kernel.org/r/161653816367.2770958.5856904574822446404.stgit@warthog.procyon.org.uk/ # v5 --- 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 edf21c8708a3..2db810467d3f 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -254,6 +254,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; @@ -262,6 +275,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) @@ -275,6 +289,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 71c58723763d..2cb0951acca6 100644 --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -198,8 +198,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 9629b6430a52..ee283e3ebc4d 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; }