From patchwork Thu Dec 16 16:16:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 12681767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C95A9C433F5 for ; Thu, 16 Dec 2021 16:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239312AbhLPQQ3 (ORCPT ); Thu, 16 Dec 2021 11:16:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21984 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239310AbhLPQQY (ORCPT ); Thu, 16 Dec 2021 11:16:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639671383; 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=DTFADvxW6K+uploxHCYf16/vP1e4p++hJtQZL543b5Q=; b=FckGhAqXyuVGDEHng++Aon8uRDofyUU7JQrvLTkQFzn0RAa/a5TetNajQv7li71ZGRTEf9 4H/tqV2+9GygZX+ToS7G539tDJOe2UQb90LTgK1zIh6V28wNdFGpbue10JXjlRip4Drqbr uzX4+zo8ConZ2FtqjuLqFV5brRazljg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-PbNwcjW-MKqqPH9Ujk3EHw-1; Thu, 16 Dec 2021 11:16:18 -0500 X-MC-Unique: PbNwcjW-MKqqPH9Ujk3EHw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 25CD2100CC89; Thu, 16 Dec 2021 16:16:16 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA0F55ED42; Thu, 16 Dec 2021 16:16:12 +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 v3 34/68] cachefiles: Add cache error reporting macro From: David Howells To: linux-cachefs@redhat.com Cc: dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , Matthew Wilcox , Alexander Viro , Omar Sandoval , JeffleXu , Linus Torvalds , 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: Thu, 16 Dec 2021 16:16:11 +0000 Message-ID: <163967137158.1823006.2065038830569321335.stgit@warthog.procyon.org.uk> In-Reply-To: <163967073889.1823006.12237147297060239168.stgit@warthog.procyon.org.uk> References: <163967073889.1823006.12237147297060239168.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Add a macro to report a cache I/O error and to tell fscache that the cache is in trouble. Also add a pointer to the fscache cache cookie from the cachefiles_cache struct as we need that to pass to fscache_io_error(). Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/163819626562.215744.1503690975344731661.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906927235.143852.13694625647880837563.stgit@warthog.procyon.org.uk/ # v2 --- fs/cachefiles/internal.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index b51146a29aca..b2adcb59b4ce 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h @@ -30,6 +30,7 @@ struct cachefiles_object { * Cache files cache definition */ struct cachefiles_cache { + struct fscache_cache *cache; /* Cache cookie */ struct vfsmount *mnt; /* mountpoint holding the cache */ struct file *cachefilesd; /* manager daemon handle */ const struct cred *cache_cred; /* security override for accessing cache */ @@ -103,6 +104,16 @@ static inline int cachefiles_inject_remove_error(void) return cachefiles_error_injection_state & 2 ? -EIO : 0; } +/* + * Error handling + */ +#define cachefiles_io_error(___cache, FMT, ...) \ +do { \ + pr_err("I/O Error: " FMT"\n", ##__VA_ARGS__); \ + fscache_io_error((___cache)->cache); \ + set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ +} while (0) + /* * Debug tracing