From: Jens Axboe <axboe@kernel.dk>
To: Andrey Kuzmin <andrey.v.kuzmin@gmail.com>
Cc: fio@vger.kernel.org
Subject: Re: Shared files with thread=1: func=xfer, err=Bad file descriptor
Date: Tue, 01 Apr 2014 12:24:27 -0600 [thread overview]
Message-ID: <533B045B.9070607@kernel.dk> (raw)
In-Reply-To: <CANvN+emPxK2FmEAsbdruCMR0jDdjE-s6N6wovHtAqowFprJH4g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]
On 04/01/2014 09:56 AM, Andrey Kuzmin wrote:
> Thanks. On a separate (or may be related) note, shared files handling
> in dup_files seems to be broken (unless I'm missing the logic behind
> dropping non-shared files). The patch below has fixed it for me.
>
> diff --git a/init.c b/init.c
> index 9b0666d..99038b2 100644
> --- a/init.c
> +++ b/init.c
> @@ -1160,17 +1161,20 @@ static int add_job(struct thread_data *td, const char *j
> td_new->o.new_group = 0;
>
> if (file_alloced) {
> - td_new->files_index = 0;
> - td_new->files_size = 0;
> if (td_new->files) {
> struct fio_file *f;
> for_each_file(td_new, f, i) {
> if (f->file_name)
> - free(f->file_name);
> - free(f);
> + sfree(f->file_name);
> + sfree(f);
> }
> + free(td_new->files);
> td_new->files = NULL;
> }
> + td_new->files_index = 0;
> + td_new->files_size = 0;
> if (td_new->o.filename) {
> free(td_new->o.filename);
> td_new->o.filename = NULL;
Thanks, I'll add this, definitely looks like a missing conversion at
some point...
And while this isn't the bug, I think it's touching in the right area.
Can you try with this one-liner and see if that fixes your issues with
EBADF?
--
Jens Axboe
[-- Attachment #2: file-close-race-shadow.patch --]
[-- Type: text/x-patch, Size: 315 bytes --]
diff --git a/filesetup.c b/filesetup.c
index db80a8b7e28b..ecbe3a5fb41b 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -1421,6 +1459,7 @@ void dup_files(struct thread_data *td, struct thread_data *org)
assert(0);
}
__f->fd = -1;
+ __f->shadow_fd = -1;
fio_file_reset(td, __f);
if (f->file_name) {
next prev parent reply other threads:[~2014-04-01 18:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 1:08 Shared files with thread=1: func=xfer, err=Bad file descriptor Andrey Kuzmin
2014-04-01 14:31 ` Jens Axboe
2014-04-01 15:56 ` Andrey Kuzmin
2014-04-01 18:24 ` Jens Axboe [this message]
2014-04-01 18:56 ` Andrey Kuzmin
2014-04-01 18:59 ` Jens Axboe
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=533B045B.9070607@kernel.dk \
--to=axboe@kernel.dk \
--cc=andrey.v.kuzmin@gmail.com \
--cc=fio@vger.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