Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1003423pxj; Fri, 21 May 2021 04:19:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxSMc3wAr0MEX68B6jp5+PA84hvq9wtdAsfqlCmSpeiOJdydRvhbZXdw8DBBBLanNnTF2g X-Received: by 2002:a17:906:abcc:: with SMTP id kq12mr9952149ejb.97.1621595975577; Fri, 21 May 2021 04:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621595975; cv=none; d=google.com; s=arc-20160816; b=XYfnB2+NhYJBJ6ZSanKiM65Cu5mPGSKTjDiHsVqjXpSNRSBKfedk1WPQE213zxmOnx lL2nCYzt19iu+EwRZKgtP//V0xhqOu+vDo1gWRigsbry/MJh7Se70nNWPQ07uTrs2wX9 7JM0Pn+vYvDVZ5XxQnYPkaufdaE+eRiCo0N+YYElUL/KnPep5PDJP4o7GreFafwhyqxC bXCGVfdL4o3UkhOl6LZ089q4tm2Rupc5jTXi1hOtU6DoMWXXgfvsrqmXl8GfRbEPn+09 np8SChsb80vcm0F6PGzKgvwfppUMYqld4VOMEiKJm4jqhxTfm67azqUxAlai3mQyF8it zS+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=buVeB8WnFW23aOCded2ctcfxRFpFitusLk1LSIom5Wc=; b=LZo8nT3tHANpQ1SfxhjseeN0weXkHhvc0ps/remvVy/SGkLGS+rrXJexxChqTbsW6y 05kTOp4AAAhDRrM4CXMOwN8sdwPenJc0zcYXjh8H3FTi8TYQLCfJzWmbz9jbpbqAGPGA Zh3v69912zsBo0OZEcyiyqXFv/XBD4JetEE4KcKQD1bCiqm8zT9hgt2yUQ3BCTkYsdmu 1onfgRIX8QE7QOXIxbVXdd1SY6omWzsilPto4lZ5928TdaiMfiPhtDB40eLb8YMFsLvq 8B4S+xF47npKyC09QZfl6pmE9MI4kO8EtMqFyciIH5f2Es6rg05aIgKr6Po400nqhHka znng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="H4t/wza1"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si5135239ejj.29.2021.05.21.04.19.09; Fri, 21 May 2021 04:19: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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="H4t/wza1"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbhEUJqF (ORCPT + 99 others); Fri, 21 May 2021 05:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbhEUJqE (ORCPT ); Fri, 21 May 2021 05:46:04 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD65BC061574; Fri, 21 May 2021 02:44:40 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id z24so19526453ioi.3; Fri, 21 May 2021 02:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=buVeB8WnFW23aOCded2ctcfxRFpFitusLk1LSIom5Wc=; b=H4t/wza1JohzT+GyvbVlQW/F8/7ZgpenD/ltDTmZOq/iWk6DWhqlEzDtj/kba/QHES 6DMsBv6ajB8dQbMLf1w2qH+RQas6yEFin9tGJivo13lNQPuWy5N5Dq5BZGCBeold+5zY 1hYois3SWQGg3uBNrjIWLCiopvyaTjzLtwRPFxt1CBs+ZgFyoNAFzvWrFlhfmeC9fnXH H7fJNnP37orU4o3wkkQGDhEeY0yIzb2Bf7C65NXubCgp69ChiEgRktkt0wTabaMUMwZU UArovEWH5o63Tib6csCsZrtT52DWw1/R3RQs8ChJJLQ0QrdGOVAdwdBdAp5/gwERNXOw D4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=buVeB8WnFW23aOCded2ctcfxRFpFitusLk1LSIom5Wc=; b=fAd8U4AUo5ZcF1z5ZiEdo9EPxuofis7L+H8EgI7EZJd0P9YTxnjSQ9aK4f0S4ctuv2 isaKHrE8wI09WTCq+yWkZdqOhB9+6UE4XJfAaz0aEo5hwYLabDdwJKXRpzOxr7PWapJo A6Dtv82S4HNsSDDj5fQPcDmV473T6WFod2TJJMvtiya4X8noBnElLO47nbg8EuYPxMHv EZv/Oa6u4RvkoPTKpgKVxjRsmENUynwsshJwYGbSykA/65rlWrhetlk9QhkkMostAfej kO+NiVS/60Rl70BPNRFfE9DFCdPxsGKPa2cmMWo3yOrriRXDX1dFYTH0hJ9vvLu37eSN f0/Q== X-Gm-Message-State: AOAM53268Q0KunDUvkZ7TaL++adAydpKJHhFMQ+xlG+Z6HoU/8QkzUJ7 lgjQ8Hf2/bdXtRI/qeeG0gEns3FgVea6ujCt+i0= X-Received: by 2002:a5d:814d:: with SMTP id f13mr10157873ioo.203.1621590280276; Fri, 21 May 2021 02:44:40 -0700 (PDT) MIME-Version: 1.0 References: <20210521024134.1032503-1-krisman@collabora.com> <20210521024134.1032503-10-krisman@collabora.com> In-Reply-To: <20210521024134.1032503-10-krisman@collabora.com> From: Amir Goldstein Date: Fri, 21 May 2021 12:44:29 +0300 Message-ID: Subject: Re: [PATCH 09/11] ext4: Send notifications on error To: Gabriel Krisman Bertazi Cc: kernel@collabora.com, "Darrick J . Wong" , "Theodore Ts'o" , Dave Chinner , Jan Kara , David Howells , Khazhismel Kumykov , linux-fsdevel , Ext4 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, May 21, 2021 at 5:42 AM Gabriel Krisman Bertazi wrote: > > 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. > > It also follows the current dmesg reporting in the format. The > filesystem message is composed mostly by the string that would be > otherwise printed in dmesg. > > A new ext4 specific record format is exposed in the uapi, such that a > monitoring tool knows what to expect when listening errors of an ext4 > filesystem. > > Signed-off-by: Gabriel Krisman Bertazi Looks fine. Reviewed-by: Amir Goldstein > --- > fs/ext4/super.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 7dc94f3e18e6..a8c0ac2c3e4c 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 */ > @@ -752,6 +753,8 @@ void __ext4_error(struct super_block *sb, const char *function, > sb->s_id, function, line, current->comm, &vaf); > va_end(args); > } > + fsnotify_error_event(sb, NULL, error); > + > ext4_handle_error(sb, force_ro, error, 0, block, function, line); > } > > @@ -782,6 +785,8 @@ void __ext4_error_inode(struct inode *inode, const char *function, > current->comm, &vaf); > va_end(args); > } > + fsnotify_error_event(inode->i_sb, inode, error); > + > ext4_handle_error(inode->i_sb, false, error, inode->i_ino, block, > function, line); > } > @@ -820,6 +825,8 @@ void __ext4_error_file(struct file *file, const char *function, > current->comm, path, &vaf); > va_end(args); > } > + fsnotify_error_event(inode->i_sb, inode, EFSCORRUPTED); > + > ext4_handle_error(inode->i_sb, false, EFSCORRUPTED, inode->i_ino, block, > function, line); > } > @@ -887,6 +894,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_error_event(sb, sb->s_root->d_inode, errno); > > ext4_handle_error(sb, false, -errno, 0, 0, function, line); > } > -- > 2.31.0 >