Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp504086pxb; Mon, 25 Oct 2021 12:34:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLJ3h0hWNiLG99Sw1B91CmJnunDFuuVfFw9v+Tbsn3dHlKj0P1mokV4C0w5zlY4mN8T7mI X-Received: by 2002:a63:d017:: with SMTP id z23mr15196434pgf.108.1635190486752; Mon, 25 Oct 2021 12:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635190486; cv=none; d=google.com; s=arc-20160816; b=HB2Cj6lcdfgLg9RNlS2a28sJvglNvd+fMVbDxkurQJ1thLUPQ2jAXJoKwZywnFd8lG 4UsnbrVGTFFrHS/KYaFzXW7/CGUmXt7jdHYgbOx/4swtPnTAAYGxba4llKkLGSU7x4vo ZbhX7IgwhuB0f86lLTGnUmq4zGTklNxpG1DDv4Dwh1yXWZybD3uK52MHICNXs6ccRuOy zM9mZonXNXmCpduQ7/37AlGsLRqjcvssQbWi7q6FCW/lbkOrVBDqS4lnPWBCMYiIkvXN +j7Y8li8rfyRrGyzeyGzJ3r52WR/86jwQQNe455R/oK/laEavOlXE2AeKBFn2yDZI6cF Hfdw== 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=9VOqFsvAUJ5ChPTRHXj8CelKvUZOF5YeoiBVo5cpNA4=; b=k5ycGGd/9lCfq4x0VSNn+BLRrtKehyXNhOwE7PW3GMWb1u9nlaAOCstKQGLg34s5Ws B4OgylaAfVC3LYLowxrp2c/q/uwtFBGI6QO+xvvcmASFyKWK0hsW776fEXEPjzuuoz/Z DfGJgJRqiSkq1ILRyakYMbU535tWBwYI0od/hrzMkC7tfMMFpVCgbB9SHQLuWqashC4e mFT8m+SQRAefmVsMGDAPiVX4a5yrzcAOyN5QLllctJidimvwzuWTUNytNllmO5t4Obm9 AqiiaxGEn2o26kg2pp8qYGrns48XvNnRN7KyYYP0Pu1am4K91Yx9/TRTHqAGS8PkPhIX TMIg== 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 q18si4190525pfk.48.2021.10.25.12.34.33; Mon, 25 Oct 2021 12:34:46 -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 S235291AbhJYTfz (ORCPT + 99 others); Mon, 25 Oct 2021 15:35:55 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58790 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236106AbhJYTdb (ORCPT ); Mon, 25 Oct 2021 15:33:31 -0400 Received: from localhost (unknown [IPv6:2804:14c:124:8a08::1002]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 62AA31F4341F; Mon, 25 Oct 2021 20:31:07 +0100 (BST) From: Gabriel Krisman Bertazi To: amir73il@gmail.com, jack@suse.com Cc: djwong@kernel.org, tytso@mit.edu, david@fromorbit.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH v9 29/31] ext4: Send notifications on error Date: Mon, 25 Oct 2021 16:27:44 -0300 Message-Id: <20211025192746.66445-30-krisman@collabora.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211025192746.66445-1-krisman@collabora.com> References: <20211025192746.66445-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Send a FS_ERROR message via fsnotify to a userspace monitoring tool whenever a ext4 error condition is triggered. This follows the existing error conditions in ext4, so it is hooked to the ext4_error* functions. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v8: - Report always report non-zero errno (Jan, Amir, Ted) Changes since v6: - Report ext4_std_errors agains superblock (jan) --- fs/ext4/super.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 88d5d274a868..1a766c68a55e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "ext4.h" #include "ext4_extents.h" /* Needed for trace points definition */ @@ -759,6 +760,8 @@ void __ext4_error(struct super_block *sb, const char *function, sb->s_id, function, line, current->comm, &vaf); va_end(args); } + fsnotify_sb_error(sb, NULL, error ? error : EFSCORRUPTED); + ext4_handle_error(sb, force_ro, error, 0, block, function, line); } @@ -789,6 +792,8 @@ void __ext4_error_inode(struct inode *inode, const char *function, current->comm, &vaf); va_end(args); } + fsnotify_sb_error(inode->i_sb, inode, error ? error : EFSCORRUPTED); + ext4_handle_error(inode->i_sb, false, error, inode->i_ino, block, function, line); } @@ -827,6 +832,8 @@ void __ext4_error_file(struct file *file, const char *function, current->comm, path, &vaf); va_end(args); } + fsnotify_sb_error(inode->i_sb, inode, EFSCORRUPTED); + ext4_handle_error(inode->i_sb, false, EFSCORRUPTED, inode->i_ino, block, function, line); } @@ -894,6 +901,7 @@ void __ext4_std_error(struct super_block *sb, const char *function, printk(KERN_CRIT "EXT4-fs error (device %s) in %s:%d: %s\n", sb->s_id, function, line, errstr); } + fsnotify_sb_error(sb, NULL, errno ? errno : EFSCORRUPTED); ext4_handle_error(sb, false, -errno, 0, 0, function, line); } -- 2.33.0