[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aG92abpCeyML01E1@infradead.org>
Date: Thu, 10 Jul 2025 01:14:33 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Christian Brauner <brauner@...nel.org>
Cc: Arnd Bergmann <arnd@...nel.org>, linux-fsdevel@...r.kernel.org,
linux-block@...r.kernel.org, Anuj Gupta <anuj20.g@...sung.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Kanchan Joshi <joshi.k@...sung.com>, ltp@...ts.linux.it,
dan.carpenter@...aro.org, benjamin.copeland@...aro.org,
rbm@...e.com, Arnd Bergmann <arnd@...db.de>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
Anders Roxell <anders.roxell@...aro.org>,
Jens Axboe <axboe@...nel.dk>,
Pavel Begunkov <asml.silence@...il.com>,
Alexey Dobriyan <adobriyan@...il.com>,
"Darrick J. Wong" <djwong@...nel.org>,
Eric Biggers <ebiggers@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: fix FS_IOC_GETLBMD_CAP parsing in
blkdev_common_ioctl()
On Thu, Jul 10, 2025 at 10:00:48AM +0200, Christian Brauner wrote:
> + switch (_IOC_NR(cmd)) {
> + case _IOC_NR(FS_IOC_GETLBMD_CAP):
> + if (_IOC_DIR(cmd) != _IOC_DIR(FS_IOC_GETLBMD_CAP))
> + break;
> + if (_IOC_TYPE(cmd) != _IOC_TYPE(FS_IOC_GETLBMD_CAP))
> + break;
> + if (_IOC_NR(cmd) != _IOC_NR(FS_IOC_GETLBMD_CAP))
> + break;
> + if (_IOC_SIZE(cmd) < LBMD_SIZE_VER0)
> + break;
> + if (_IOC_SIZE(cmd) > PAGE_SIZE)
> + break;
> + return blk_get_meta_cap(bdev, cmd, argp);
> + }
Yikes. I really don't get why we're trying change the way how ioctls
worked forever. We can and usually do use the size based macro already.
And when we introduce a new size (which should happen rarely), we add a
new entry to the switch using the normal _IO* macros, and either
rename the struct, or use offsetofend in the _IO* entry for the old one.
Just in XFS which I remember in detail we've done that to extend
structures in backwards compatible ways multiple times.
Powered by blists - more mailing lists