linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Naresh Kamboju" <naresh.kamboju@linaro.org>,
	"LTP List" <ltp@lists.linux.it>,
	"open list" <linux-kernel@vger.kernel.org>,
	lkft-triage@lists.linaro.org, linux-fsdevel@vger.kernel.org,
	linux-block <linux-block@vger.kernel.org>
Cc: "Anders Roxell" <anders.roxell@linaro.org>,
	"Dan Carpenter" <dan.carpenter@linaro.org>,
	"Benjamin Copeland" <benjamin.copeland@linaro.org>,
	"Petr Vorel" <pvorel@suse.cz>, chrubis <chrubis@suse.cz>,
	rbm@suse.com, "Jens Axboe" <axboe@kernel.dk>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Anuj Gupta" <anuj20.g@samsung.com>,
	"Kanchan Joshi" <joshi.k@samsung.com>,
	"Christoph Hellwig" <hch@lst.de>,
	"Christian Brauner" <brauner@kernel.org>
Subject: Re: LTP: syscalls: TWARN ioctl(/dev/loop0, LOOP_SET_STATUS, test_dev.img) failed EOPNOTSUPP (95)
Date: Wed, 09 Jul 2025 16:09:38 +0200	[thread overview]
Message-ID: <61787165-8559-4ad6-90db-5ab6ee5e6fd9@app.fastmail.com> (raw)
In-Reply-To: <CA+G9fYs=3LHdf1ge1MiCoCOUpW=VjPdVWrNJX8+wi7u6N18j3Q@mail.gmail.com>

On Wed, Jul 9, 2025, at 15:48, Naresh Kamboju wrote:
> On Tue, 8 Jul 2025 at 18:28, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
>>
>> Regressions were observed while testing LTP syscalls cachestat01 and
>> other related tests on the next-20250702 Linux kernel across several devices.
>>
>> The issue appears to be related to the inability to configure /dev/loop0
>> via the LOOP_SET_STATUS ioctl, which returned EOPNOTSUPP
>> (Operation not supported). This results in a TBROK condition,
>> causing the test to fail.
>
> Anders, bisected this down to this commit id,
>    # first bad commit:
>        [9eb22f7fedfc9eb1b7f431a5359abd4d15b0b0cd]
>        fs: add ioctl to query metadata and protection info capabilities

I see the problem now in

+       if (_IOC_NR(cmd) == _IOC_NR(FS_IOC_GETLBMD_CAP))
+               return blk_get_meta_cap(bdev, cmd, argp);
+

This only compares _IOC_NR() but not _IOC_TYPE, so LOOP_SET_STATUS
is treated the same as FS_IOC_GETLBMD_CAP, since both use '2' in
the lower 8 bit.

include/uapi/linux/fs.h:#define FS_IOC_GETLBMD_CAP              _IOWR(0x15, 2, struct logical_block_metadata_cap)
include/uapi/linux/loop.h:#define LOOP_SET_STATUS               0x4C02

I checked a couple of other drivers using _IOC_NR(), and it seems
that they many of them have the same bug, e.g.:

drivers/accel/habanalabs/common/habanalabs_ioctl.c
drivers/block/ublk_drv.c
drivers/dma-buf/dma-heap.c

    Arnd

      reply	other threads:[~2025-07-09 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 12:58 LTP: syscalls: TWARN ioctl(/dev/loop0, LOOP_SET_STATUS, test_dev.img) failed EOPNOTSUPP (95) Naresh Kamboju
2025-07-09 13:48 ` Naresh Kamboju
2025-07-09 14:09   ` Arnd Bergmann [this message]

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=61787165-8559-4ad6-90db-5ab6ee5e6fd9@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=anders.roxell@linaro.org \
    --cc=anuj20.g@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=benjamin.copeland@linaro.org \
    --cc=brauner@kernel.org \
    --cc=chrubis@suse.cz \
    --cc=dan.carpenter@linaro.org \
    --cc=hch@lst.de \
    --cc=joshi.k@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=ltp@lists.linux.it \
    --cc=martin.petersen@oracle.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=pvorel@suse.cz \
    --cc=rbm@suse.com \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).