From: Dmitrii Tcvetkov <me@demsh.org>
To: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Song Liu <song@kernel.org>,
linux-raid@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [bisected] RAID1 direct IO redirecting sector loop since 6.0
Date: Wed, 2 Nov 2022 07:57:03 +0300 [thread overview]
Message-ID: <20221102075703.63ec7876@xps.demsh.org> (raw)
In-Reply-To: <20221102010826.12dcb4bb@xps.demsh.org>
On Wed, 2 Nov 2022 01:08:26 +0300
Dmitrii Tcvetkov <me@demsh.org> wrote:
> On Tue, 1 Nov 2022 15:18:20 -0600
> Keith Busch <kbusch@kernel.org> wrote:
> > Oh shoot, sorry about that! Should have been this:
> >
> > @@ -703,6 +702,7 @@ void disk_stack_limits(struct gendisk *disk,
> > struct block_device *bdev, pr_notice("%s: Warning: Device %pg is
> > misaligned\n", disk->disk_name, bdev);
> >
> > + blk_queue_dma_alignment(t, queue_logical_block_size(t) - 1);
> > disk_update_readahead(disk);
> > }
> > EXPORT_SYMBOL(disk_stack_limits);
>
> This didn't change behaviour, second guest still hangs.
Managed to write a program in C, which allows to reproduce this without
Qemu.
# cat test.c
#define _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#define THREADCOUNT 8
#define PATHLIMIT 256
#define BUFSIZE 4096
#define LV1 "/dev/lvmraid/zfs"
#define LV2 "/dev/lvmraid/wrk"
struct params {
char path[PATHLIMIT];
char buffer[BUFSIZE];
};
struct params alloc_params(char *path) {
struct params out;
if (strlen(path) >= PATHLIMIT) {
printf("supplied path too long\n");
abort();
}
strncpy(&out.path[0], path, PATHLIMIT);
memset(&out.buffer, 0, BUFSIZE);
return out;
}
void *worker(void *data) {
struct params *p = (struct params *) data;
int counter = 0;
ssize_t n = 0;
int fd = open(p->path, O_RDONLY|O_DIRECT|O_CLOEXEC);
if (fd == -1) return NULL;
while (counter < 2048) {
pread(fd, p->buffer, BUFSIZE, 0);
counter++;
}
close(fd);
return NULL;
}
int main(void) {
struct params parray[THREADCOUNT] = {
alloc_params(LV1),
alloc_params(LV1),
alloc_params(LV1),
alloc_params(LV1),
alloc_params(LV2),
alloc_params(LV2),
alloc_params(LV2),
alloc_params(LV2),
};
pthread_t threads[THREADCOUNT];
for (int i = 0; i < THREADCOUNT; i++) {
int ret = pthread_create(&threads[i], NULL, worker, (void *)
&parray[i]); if (ret!=0) {
printf("failed to create thread: %d", ret);
abort();
}
}
for (int i = 0; i < THREADCOUNT; i++) {
int ret = pthread_join(threads[i], NULL);
if(ret!=0) {
printf("failed to join thread: %d", ret);
abort();
}
}
return 0;
}
# gcc -O2 -pthread test.c
# for i in $(seq 1 64); do ./a.out;done
prev parent reply other threads:[~2022-11-02 4:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 21:15 [bisected] RAID1 direct IO redirecting sector loop since 6.0 Dmitrii Tcvetkov
2022-11-01 6:45 ` Paul Menzel
2022-11-01 17:22 ` Keith Busch
2022-11-01 20:51 ` Dmitrii Tcvetkov
2022-11-01 21:18 ` Keith Busch
2022-11-01 22:08 ` Dmitrii Tcvetkov
2022-11-02 4:57 ` Dmitrii Tcvetkov [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=20221102075703.63ec7876@xps.demsh.org \
--to=me@demsh.org \
--cc=axboe@kernel.dk \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.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