From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: brauner@kernel.org, linux-ext4@vger.kernel.org, jack@suse.cz,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
gabriel@krisman.be, amir73il@gmail.com
Subject: Re: [PATCH 2/6] fs: report filesystem and file I/O errors to fsnotify
Date: Thu, 18 Dec 2025 10:44:29 -0800 [thread overview]
Message-ID: <20251218184429.GX7725@frogsfrogsfrogs> (raw)
In-Reply-To: <aUOPcNNR1oAxa1hC@infradead.org>
On Wed, Dec 17, 2025 at 09:21:52PM -0800, Christoph Hellwig wrote:
> > long s_min_writeback_pages;
> > +
> > + /* number of fserrors that are being sent to fsnotify/filesystems */
> > + refcount_t s_pending_errors;
>
> Use the same tab-alignment as the fields above? Also is this really
Will fix.
> a refcount? It's a counter, but not really a reference? I guess
> that doesn't matter too much.
<shrug> It does count pending events, but you could also look upon it as
a count of weak "references" to the super_block since the fserror_event
object does point to the super_block.
(Not sure what happens if we get more than 2^31 errors...)
> > +static inline void fserror_unmount(struct super_block *sb)
> > +{
> > + /*
> > + * If we don't drop the pending error count to zero, then wait for it
> > + * to drop below 1, which means that the pending errors cleared or
> > + * that we saturated the system with 1 billion+ concurrent events.
> > + */
> > + if (!refcount_dec_and_test(&sb->s_pending_errors))
> > + wait_var_event(&sb->s_pending_errors,
> > + refcount_read(&sb->s_pending_errors) < 1);
> > +}
>
> Should this be out of line?
Yes, it's better to hide these details (particularly since there's a fat
comment about the refcount bias) in fserror.c.
> > +/**
> > + * fserror_report - report a filesystem error of some kind
> > + *
> > + * Report details of a filesystem error to the super_operations::report_error
> > + * callback if present; and to fsnotify for distribution to userspace. @sb,
> > + * @gfp, @type, and @error must all be specified. For file I/O errors, the
> > + * @inode, @pos, and @len fields must also be specified. For file metadata
> > + * errors, @inode must be specified. If @inode is not NULL, then @inode->i_sb
> > + * must point to @sb.
> > + *
> > + * Reporting work is deferred to a workqueue to ensure that ->report_error is
> > + * called from process context without any locks held. An active reference to
> > + * the inode is maintained until event handling is complete, and unmount will
> > + * wait for queued events to drain.
> > + *
> > + * @sb: superblock of the filesystem
>
> The normal convention is to have the arguments documented above the
> long description. Any reason to deviate from that here?
Nope. Fixed.
--D
next prev parent reply other threads:[~2025-12-18 18:44 UTC|newest]
Thread overview: 32+ 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 [this message]
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
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:31 ` [PATCH 2/6] fs: report filesystem and file I/O errors to fsnotify Darrick J. Wong
2026-01-13 8:24 ` Christoph Hellwig
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=20251218184429.GX7725@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=gabriel@krisman.be \
--cc=hch@infradead.org \
--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