Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp929569pxj; Fri, 21 May 2021 02:26:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb9OllwzFa024hKq6RVGeuwucQwrmqXTQ/L5xf5MELrz1Zt/2zZFnESZRUyHRGAWXH3nxl X-Received: by 2002:a17:906:7f13:: with SMTP id d19mr9450770ejr.134.1621589195892; Fri, 21 May 2021 02:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621589195; cv=none; d=google.com; s=arc-20160816; b=xYWluDI5jlmHW4Mhoh2YShob/H1uLOnfOCkXGryB8B4kpZHRUvRd21CrQRJPjdIFgB hBNZhMKgooO2Q/SDb3zJ/Eti713E6r6w2rZmtffp8ah0i3vM/JXsir9S7VLhWEPDC2dI dVI+Xml1AIBy6GyB1in0SRwZGgpe0Xuui7p/0BCcxS6qntcWo7TMXpvKufh7/8Qo8jxm yiu+LrH3to713HYUrg4hvpmkvcVbEDrubJ1QoGxb0vjiFHB7KlR5DiIjJSducUjS4TrT A9CGihCjKBl9zPDTTeNDpHswnpzGTjNEgsB2mZ/p9H083NYiWEneXjScxnVAyZfKbuaa ZAWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nCMpvgDsdW/84fcB65NDwsm7EjLHdROcQ7XHF6Y2nFA=; b=Spg48fkk/hx5qI1xNkmLTMfkVUpy8YWLh+zGEtUIMAqfiafSwZPtPrvAywTJ8nfxus svw8uikyaDx+t1fukK6qwA22vYSOeXnGRG9mEZuNub7DtibFspQlFdfG6mMThpcjc5Ui c0YLh+Yd/edbF397oMSVZk1xVfGKqd5aYYcNB3XO7eRPHUeNKIkf9xqan3Wd9JgJdRy0 PP9inKdPnmFJ23JgSkWw00hOPDT+Y/57VjTwUUT6/5rzjry/AVnFFmlS7igZE9YSCzyP Nhbu0nzEaJz0tafzbhzeQqe+1pxvKCsdg3BJeiSk0c2HwnGcgPJOq9eazyJAB97VoZcn OgqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb19si5498457ejc.581.2021.05.21.02.26.12; Fri, 21 May 2021 02:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238713AbhEUCoC (ORCPT + 99 others); Thu, 20 May 2021 22:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbhEUCoC (ORCPT ); Thu, 20 May 2021 22:44:02 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EEAEC061574; Thu, 20 May 2021 19:42:40 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id BAB551F43D3C From: Gabriel Krisman Bertazi To: amir73il@gmail.com Cc: Gabriel Krisman Bertazi , kernel@collabora.com, "Darrick J . Wong" , Theodore Ts'o , Dave Chinner , jack@suse.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH 11/11] Documentation: Document the FAN_ERROR event Date: Thu, 20 May 2021 22:41:34 -0400 Message-Id: <20210521024134.1032503-12-krisman@collabora.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210521024134.1032503-1-krisman@collabora.com> References: <20210521024134.1032503-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Signed-off-by: Gabriel Krisman Bertazi --- .../admin-guide/filesystem-monitoring.rst | 52 +++++++++++++++++++ Documentation/admin-guide/index.rst | 1 + 2 files changed, 53 insertions(+) create mode 100644 Documentation/admin-guide/filesystem-monitoring.rst diff --git a/Documentation/admin-guide/filesystem-monitoring.rst b/Documentation/admin-guide/filesystem-monitoring.rst new file mode 100644 index 000000000000..81e632f8e1de --- /dev/null +++ b/Documentation/admin-guide/filesystem-monitoring.rst @@ -0,0 +1,52 @@ +.. SPDX-License-Identifier: GPL-2.0 + +==================================== +File system Monitoring with fanotify +==================================== + +fanotify supports the FAN_ERROR mark for file system-wide error +reporting. It is meant to be used by file system health monitoring +daemons who listen on that interface and take actions (notify sysadmin, +start recovery) when a file system problem is detected by the kernel. + +By design, A FAN_ERROR notification exposes sufficient information for a +monitoring tool to know a problem in the file system has happened. It +doesn't necessarily provide a user space application with semantics to +verify an IO operation was successfully executed. That is outside of +scope of this feature. Instead, it is only meant as a framework for +early file system problem detection and reporting recovery tools. + +At the time of this writing, the only file system that emits this +FAN_ERROR notifications is ext4. + +A user space example code is provided at ``samples/fanotify/fs-monitor.c``. + +Usage +===== + +Notification structure +====================== + +A FAN_ERROR Notification has the following format:: + + [ Notification Metadata (Mandatory) ] + [ Generic Error Record (Mandatory) ] + +With the exception of the notification metadata and the generic +information, all information records are optional. Each record type is +identified by its unique ``struct fanotify_event_info_header.info_type``. + +Generic error Location +---------------------- + +The Generic error record provides enough information for a file system +agnostic tool to learn about a problem in the file system, without +requiring any details about the problem.:: + + struct fanotify_event_info_error { + struct fanotify_event_info_header hdr; + int error; + __kernel_fsid_t fsid; + unsigned long inode; + __u32 error_count; + }; diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst index dc00afcabb95..1bedab498104 100644 --- a/Documentation/admin-guide/index.rst +++ b/Documentation/admin-guide/index.rst @@ -82,6 +82,7 @@ configure specific aspects of kernel behavior to your liking. edid efi-stub ext4 + filesystem-monitoring nfs/index gpio/index highuid -- 2.31.0