Re: [PATCH 1/1] generic: test fsnotify filesystem error reporting

Darrick J. Wong
2026-03-16T16:21:48Z

On Mon, Mar 16, 2026 at 02:08:11AM -0700, Christoph Hellwig wrote:
> On Mon, Mar 09, 2026 at 08:50:08PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Test the fsnotify filesystem error reporting.
>
> Still would be helpful to explain what is being tested and how and
> the source of the test tool.

"Use dmerror to inject a media error for a file's storage, then run some
IO and make sure that fanotify reports the IO errors."

(I'm not sure what the process is for updating commit messages once
something's in patches-in-queue...)

> > +#ifndef FILEID_INO32_GEN
> > +#define FILEID_INO32_GEN 1
> > +#endif
> > +
> > +#ifndef FILEID_INVALID
> > +#define FILEID_INVALID 0xff
> > +#endif
> > +
> > +static void print_fh(struct file_handle *fh)
> > +{
> > + int i;
> > + uint32_t *h = (uint32_t *) fh->f_handle;
> > +
> > + printf("\tfh: ");
> > + for (i = 0; i < fh->handle_bytes; i++)
> > + printf("%hhx", fh->f_handle[i]);
> > + printf("\n");
> > +
> > + printf("\tdecoded fh: ");
> > + if (fh->handle_type == FILEID_INO32_GEN)
> > + printf("inode=%u gen=%u\n", h[0], h[1]);
> > + else if (fh->handle_type == FILEID_INVALID && !fh->handle_bytes)
> > + printf("Type %d (Superblock error)\n", fh->handle_type);
> > + else
> > + printf("Type %d (Unknown)\n", fh->handle_type);
>
>
> Isn't this always going to print unknown for normal xfs mounts without
> inode32?

Yes, though generic/791 filters out the file handle and (TBH) I don't
really want people getting ideas about cracking file handles. Probably
we should just eliminate this whole part of the function, but that would
make future forklift upgrades from the kernel harder.

--D