Re: [PATCH v9 02/17] fs: add generic FS_IOC_SHUTDOWN definitions
From: Darrick J. Wong
Date: Sat Feb 21 2026 - 02:10:51 EST
On Sat, Feb 21, 2026 at 03:17:30PM +0900, David Timber wrote:
> > +/*
> > + * Shutdown the filesystem.
> > + */
> > +#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32)
> Should've been _IOW, not _IOR. This is rather unfortunate.
Yep, it's too bad that this has been encoded in XFS like this for
decades. :/
You /could/ send patches to add an _IOW definition and make
fstests/xfsprogs prefer the new ioctl number over the old one.
--D
> Documentation/userspace-api/ioctl/ioctl-number.rst:
> > ====== ===========================
> > macro parameters
> > ====== ===========================
> > _IO none
> > _IOW write (read from userspace)
> > _IOR read (write to userspace)
> > _IOWR write and read
> > ====== ===========================
> >
> > 'Write' and 'read' are from the user's point of view, just like the
> > system calls 'write' and 'read'. For example, a SET_FOO ioctl would
> > be _IOW, although the kernel would actually read data from user space;
> > a GET_FOO ioctl would be _IOR, although the kernel would actually write
> > data to user space.
> All the *_ioctl_shutdown() do get_user(..., arg).
>