Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp994239pxb; Tue, 26 Oct 2021 00:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYIGErEiDMfedmn9jw6Cp4xe8Zgi+SIpN0khl8/RqyioxBE/nkfZShXpzUOrm82ReiUiQr X-Received: by 2002:a17:906:a217:: with SMTP id r23mr18299650ejy.548.1635233139770; Tue, 26 Oct 2021 00:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635233139; cv=none; d=google.com; s=arc-20160816; b=jWDgWJ6izr/0A39rGiaoUAD50GiiALqB6Q4tD39jvrZhAEkY5ecZw8qUpXyUtBmQQm fDzswIeOGzIGVYEaVsgOCct0KAPIlBaiDir3gnZW3EW4wbAAe1Jl4gEr5AkLhMt0ndBr DCigDyed5QzJiHTEMgToXPJv2NpRVYvzhhsJwzcLgOFZstguYRnwiGwZ4fLpbWXYrXt6 OJ8lajqBy1hR9sMUQ5uS45gXBpVOOJPMp1mDMTdlWQuRc9+lyLtBHOIJE3DIB48bzhP8 hjDaiZE3oC3k/XOIJKLtzog7xBrYKOCZyTIqVDAY84DW6Hjqth58GW+hsFZUYX1/azSe Mn4w== 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=J6ya56Qt8Frw/lGfkXq3MuIPZzFJiXTaiX1cCAIXijQ=; b=UAfwrSVuTWRksoC5wgBzDUgzo4Z3uQ+KTldznmfEPC4LI1MOz+K/pHbqckxm0J4k8y TVnY6PlswEylXStmza/4lBKxpWVCVuWhyctYM9cJVf15+kg6Cx/h7QnVuDsSE1D84skS UYNSgwwYoYvPVykUiwkgng0+fMH10prD33KPAtRV84yy+LPiEpW8cND/p+OUFJxTqE9+ H+bjuEjARt4cD4Fl2Gncd8Ul7FcNhYs18h+6vIZZyby0v05nWRXGekS/3rMforPhrQ3r uEbL7iMDskZ5Bcr2bs0KUbRXuxRKtix86kDp0/GDnvMDW3VzWcVO45Ag13C3F+LRWmBe RUDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CTFHJKoM; 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 j1si24715321edf.29.2021.10.26.00.25.11; Tue, 26 Oct 2021 00:25:39 -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=20210112 header.b=CTFHJKoM; 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 S229540AbhJZHIY (ORCPT + 99 others); Tue, 26 Oct 2021 03:08:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbhJZHIX (ORCPT ); Tue, 26 Oct 2021 03:08:23 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41BC2C061745; Tue, 26 Oct 2021 00:06:00 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id v65so7265923ioe.5; Tue, 26 Oct 2021 00:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=J6ya56Qt8Frw/lGfkXq3MuIPZzFJiXTaiX1cCAIXijQ=; b=CTFHJKoM0Wp+8eKK7/GFuMJSAcksP6Wtpn2J2AwYFbn529gKkA+YNLG3WZ/CeU9Ml8 RSrFhpaz+QhW3Y+2SfW+jSSTxAbB2dK8DJ9qWuAx7wM4cRcY7ObZG59OfbBlRBjdh96q OOvld9O5ZpAAKopUxibhiAouDndggLM7vHRhtid4MRHLJ+jkoqtGkUXvzzAXwIhlauMx +MuW03Vkj1YtpCLBsIK4cJrtEy/mKjuknvmSPl0Gr1V2pYTAeB+PaLZ7FiUhl0PtyaN9 Qg1b+DbumDVccVNyfkDl0gHQtMAPBiVaIb3n98roa/M7MusE+gJTWreFkKhlelu+PPQ5 HjIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J6ya56Qt8Frw/lGfkXq3MuIPZzFJiXTaiX1cCAIXijQ=; b=n3bSHiK5eifcaEVf01rak5paTZwrelndNCp3Mf83OwiMujKYiJC9eYFPtwJSSldgpr LJM9ZvMj/0Em6Q6tFYyRdmYCiZ9rY63rBxkqzicOplCPVzGvbQnz/JWNYMOI2Gi8XZXS cElpbL/ZRQohENA8S2f0KnCfBLxG5PGjDyeENtmTbVfUzgZj1Gy7ybZTCszDpZxB+tqZ RG2hrCGL3ws9PA9ls3l7/nFpI1G4Es4RiS3l0BKfOUllJ5C5DSw7vHWfnD1jcpP25W1X ilXp4ZUrrqqKuFyworER0dBSlyNUa3Ras2A8j1Hvg9NNIno+i6kztnOfV+2MdIlBkiIn EkIw== X-Gm-Message-State: AOAM531MgWJsO8h9sB5lw5l70Eq2wyVRQGFnLTUybU/ITUYvpwVquWkG OvzsfDZM2hrTDB1eJVD1AThBTutzf8K/0ZVpEao= X-Received: by 2002:a5e:c018:: with SMTP id u24mr13884841iol.197.1635231959682; Tue, 26 Oct 2021 00:05:59 -0700 (PDT) MIME-Version: 1.0 References: <20211025192746.66445-1-krisman@collabora.com> <20211025192746.66445-30-krisman@collabora.com> In-Reply-To: <20211025192746.66445-30-krisman@collabora.com> From: Amir Goldstein Date: Tue, 26 Oct 2021 10:05:48 +0300 Message-ID: Subject: Re: [PATCH v9 29/31] ext4: Send notifications on error To: Gabriel Krisman Bertazi Cc: Jan Kara , "Darrick J. Wong" , Theodore Tso , Dave Chinner , David Howells , Khazhismel Kumykov , linux-fsdevel , Linux API , Ext4 , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Oct 25, 2021 at 10:31 PM 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. > > Signed-off-by: Gabriel Krisman Bertazi > Reviewed-by: Amir Goldstein > --- > 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 >