public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: brauner@kernel.org, linux-ext4@vger.kernel.org,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	gabriel@krisman.be, hch@lst.de, amir73il@gmail.com
Subject: Re: [PATCH 6/6] ext4: convert to new fserror helpers
Date: Tue, 6 Jan 2026 09:30:36 -0800	[thread overview]
Message-ID: <20260106173036.GC191481@frogsfrogsfrogs> (raw)
In-Reply-To: <lhvwanmjakwkrpugrhg6qjjv5nvsywr2nlbqmwrt76jqijmkgv@fqpzmao4zknr>

On Mon, Dec 22, 2025 at 04:34:48PM +0100, Jan Kara wrote:
> On Wed 17-12-25 18:04:14, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Use the new fserror functions to report metadata errors to fsnotify.
> > Note that ext4 inconsistently passes around negative and positive error
> > numbers all over the codebase, so we force them all to negative for
> > consistency in what we report to fserror, and fserror ensures that only
> > positive error numbers are passed to fanotify, per the fanotify(7)
> > manpage.
> > 
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> 
> We need to cleanup those error numbers passing - we should have mostly
> negative ones AFAIK - where do we end up passing positive ones? But it's
> unrelated to this patch so feel free to add:

Here and there:

$ git grep 'ext4_error.*[[:space:]]E[A-Z]' fs/ext4/
fs/ext4/balloc.c:582:           ext4_error_err(sb, EIO, "Cannot read block bitmap - "
fs/ext4/ialloc.c:201:           ext4_error_err(sb, EIO, "Cannot read inode bitmap - "
fs/ext4/inode.c:4952:           ext4_error_inode_block(inode, err_blk, EIO,
fs/ext4/inode.c:4967:           ext4_error_inode_block(inode, err_blk, EIO,
fs/ext4/inode.c:5188:           __ext4_error(sb, function, line, false, EFSCORRUPTED, 0,
fs/ext4/inode.c:5728:                   ext4_error_inode_block(inode, iloc.bh->b_blocknr, EIO,
fs/ext4/mmp.c:218:                              ext4_error_err(sb, EBUSY, "abort");

> Reviewed-by: Jan Kara <jack@suse.cz>

Thanks!

--D

> 
> 								Honza
> 
> > ---
> >  fs/ext4/ioctl.c |    2 ++
> >  fs/ext4/super.c |   13 +++++++++----
> >  2 files changed, 11 insertions(+), 4 deletions(-)
> > 
> > 
> > diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> > index 7ce0fc40aec2fb..ea26cd03d3ce28 100644
> > --- a/fs/ext4/ioctl.c
> > +++ b/fs/ext4/ioctl.c
> > @@ -26,6 +26,7 @@
> >  #include <linux/fsmap.h>
> >  #include "fsmap.h"
> >  #include <trace/events/ext4.h>
> > +#include <linux/fserror.h>
> >  
> >  typedef void ext4_update_sb_callback(struct ext4_sb_info *sbi,
> >  				     struct ext4_super_block *es,
> > @@ -844,6 +845,7 @@ int ext4_force_shutdown(struct super_block *sb, u32 flags)
> >  		return -EINVAL;
> >  	}
> >  	clear_opt(sb, DISCARD);
> > +	fserror_report_shutdown(sb, GFP_KERNEL);
> >  	return 0;
> >  }
> >  
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index 87205660c5d026..a6241ffb8639c3 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -48,6 +48,7 @@
> >  #include <linux/fsnotify.h>
> >  #include <linux/fs_context.h>
> >  #include <linux/fs_parser.h>
> > +#include <linux/fserror.h>
> >  
> >  #include "ext4.h"
> >  #include "ext4_extents.h"	/* Needed for trace points definition */
> > @@ -824,7 +825,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);
> > +	fserror_report_metadata(sb, error ? -abs(error) : -EFSCORRUPTED,
> > +				GFP_ATOMIC);
> >  
> >  	ext4_handle_error(sb, force_ro, error, 0, block, function, line);
> >  }
> > @@ -856,7 +858,9 @@ 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);
> > +	fserror_report_file_metadata(inode,
> > +				     error ? -abs(error) : -EFSCORRUPTED,
> > +				     GFP_ATOMIC);
> >  
> >  	ext4_handle_error(inode->i_sb, false, error, inode->i_ino, block,
> >  			  function, line);
> > @@ -896,7 +900,7 @@ 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);
> > +	fserror_report_file_metadata(inode, -EFSCORRUPTED, GFP_ATOMIC);
> >  
> >  	ext4_handle_error(inode->i_sb, false, EFSCORRUPTED, inode->i_ino, block,
> >  			  function, line);
> > @@ -965,7 +969,8 @@ 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);
> > +	fserror_report_metadata(sb, errno ? -abs(errno) : -EFSCORRUPTED,
> > +				GFP_ATOMIC);
> >  
> >  	ext4_handle_error(sb, false, -errno, 0, 0, function, line);
> >  }
> > 
> -- 
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
> 

  reply	other threads:[~2026-01-06 17:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18  2:02 [PATCHSET V4 1/2] fs: generic file IO error reporting Darrick J. Wong
2025-12-18  2:02 ` [PATCH 1/6] uapi: promote EFSCORRUPTED and EUCLEAN to errno.h Darrick J. Wong
2025-12-18  5:17   ` Christoph Hellwig
2025-12-18 11:04     ` Alejandro Colomar
2025-12-18 18:45       ` Darrick J. Wong
2025-12-18  9:33   ` Gao Xiang
2025-12-22 15:01   ` Jan Kara
2025-12-18  2:03 ` [PATCH 2/6] fs: report filesystem and file I/O errors to fsnotify Darrick J. Wong
2025-12-18  5:21   ` Christoph Hellwig
2025-12-18 18:44     ` Darrick J. Wong
2025-12-24 12:29       ` Christian Brauner
2026-01-06 16:42         ` Darrick J. Wong
2026-01-12 13:17           ` Christian Brauner
2026-01-12 18:50             ` Darrick J. Wong
2025-12-18 23:32   ` [PATCH V4.1 " Darrick J. Wong
2025-12-22 15:36   ` [PATCH " Jan Kara
2026-01-06 17:35     ` Darrick J. Wong
2025-12-18  2:03 ` [PATCH 3/6] iomap: report file I/O errors to the VFS Darrick J. Wong
2025-12-18  5:22   ` Christoph Hellwig
2025-12-22 15:30   ` Jan Kara
2025-12-18  2:03 ` [PATCH 4/6] xfs: report fs metadata errors via fsnotify Darrick J. Wong
2025-12-18  5:22   ` Christoph Hellwig
2025-12-18  2:03 ` [PATCH 5/6] xfs: translate fsdax media errors into file "data lost" errors when convenient Darrick J. Wong
2025-12-18  5:23   ` Christoph Hellwig
2025-12-18  2:04 ` [PATCH 6/6] ext4: convert to new fserror helpers Darrick J. Wong
2025-12-18  5:23   ` Christoph Hellwig
2025-12-22 15:34   ` Jan Kara
2026-01-06 17:30     ` Darrick J. Wong [this message]
2026-01-06 23:33 ` [PATCH 7/6] fs: improve comment in fserror_alloc_event Darrick J. Wong
2026-01-07  9:19   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2026-01-13  0:31 [PATCHSET v5] fs: generic file IO error reporting Darrick J. Wong
2026-01-13  0:32 ` [PATCH 6/6] ext4: convert to new fserror helpers Darrick J. Wong
2026-01-13  0:56   ` Gabriel Krisman Bertazi
2026-01-13  1:26     ` Darrick J. Wong
2026-01-15 15:29   ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260106173036.GC191481@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=gabriel@krisman.be \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox