Re: INFO: rcu detected stall in blkdev_ioctl

From: Tetsuo Handa
Date: Sat May 05 2018 - 07:58:30 EST


If various stall reports regarding loop_set_fd() are hitting below sequence, a patch
was proposed at https://groups.google.com/d/msg/syzkaller-bugs/5pzXJ8yQFR0/vWeRytaQBAAJ .

----------
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/loop.h>

int main(int argc, char *argv[])
{
const int fd = open("/tmp/file", O_RDWR | O_CREAT | O_TRUNC, 0600);
const int fd0 = open("/dev/loop0", O_RDONLY);
const int fd1 = open("/dev/loop1", O_RDONLY);
ioctl(fd0, LOOP_SET_FD, fd);
ioctl(fd0, LOOP_CHANGE_FD, fd0);
ioctl(fd1, LOOP_SET_FD, fd0);
return 0;
}
----------