Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows fio: failed to create dir (d:): 22 #870

Closed
Gt3pccb opened this issue Dec 2, 2019 · 30 comments
Closed

Windows fio: failed to create dir (d:): 22 #870

Gt3pccb opened this issue Dec 2, 2019 · 30 comments
Labels
needreporterinfo Waiting on information from the issue reporter

Comments

@Gt3pccb
Copy link

Gt3pccb commented Dec 2, 2019

I am having this issue with FIO compiled from the latest branch because we need the fix for first allocations.
This command used to work used fine and FIO is being run as Admin and permissions are everyone full
--directory=d\:\

PS D:> FIO --thread --direct=1 --ioengine=windowsaio --filesize=500GB --rw=write --iodepth=256 --bs=1MB --nrfiles=1 --name=XR2-4-Node --numjobs=1 --directory=d\:\

XR2-4-Node: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=windowsaio, iodepth=256
fio-3.16
Starting 1 thread
fio: failed to create dir (d:): 22

Run status group 0 (all jobs):

Any help would be great!

@sitsofe
Copy link
Collaborator

sitsofe commented Dec 3, 2019

This sounds very similar to #784. One trick is change the code to do a stat and then check the stat said it was a directory and if so there's nothing more to do and only try and do the mkdir if the stat says it failed (or wasn't a directory).

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 3, 2019 via email

@axboe
Copy link
Owner

axboe commented Dec 3, 2019

One trick is change the code to do a stat and then check the stat said it was a directory and if so there's nothing more to do and only try and do the mkdir if the stat says it failed (or wasn't a directory)

I really like that idea, and it improves the usability of the directory function a lot.

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 3, 2019 via email

@axboe
Copy link
Owner

axboe commented Dec 3, 2019

I'm guessing it's this commit:

commit 95af8dd57a7a9a564f99492bb1e04bb6d13b95b1
Author: Kyle Zhang <kyle@smartx.com>
Date:   Thu Apr 11 23:01:55 2019 +0800

    filesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO

You could try and run git revert on that, recompile, and see if that works for you.

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 5, 2019 via email

@axboe
Copy link
Owner

axboe commented Dec 5, 2019

I've pushed a branch out, issue-870, which has the revert. Can you build and try that one?

BTW, love your username, I'm a fan :-)

@vincentkfu
Copy link
Collaborator

You can find an installer for the build among the artifacts saved by appveyor. Choose the 64- or 32-bit build and then click on the artifacts tab:

https://ci.appveyor.com/project/axboe/fio/builds/29343692

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 5, 2019 via email

@axboe
Copy link
Owner

axboe commented Dec 5, 2019

I have one blush

Nice, me too :-). Which one?

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 5, 2019 via email

@axboe
Copy link
Owner

axboe commented Dec 5, 2019

Nice! I've got an '18 GT3 Touring (pccb, buckets, etc), and also a '19 GT2RS. Planning on some kind of aftermarket exhaust in the spring for the GT3, undecided as of yet. The dundon headers+exhaust is a sweet combo.

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 5, 2019 via email

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 5, 2019 via email

@axboe
Copy link
Owner

axboe commented Dec 6, 2019

Well, doesn't sound like you are hurting with a Pista!

Back to the issue at hand, do you have any way to build fio, or do you solely rely on pre-built binaries? Reason I ask is that we can do a git bisect if you can build on your own, if not I'll have to take a look at the repo. I don't have access to Windows, so I have a hard time testing that side of things.

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 6, 2019 via email

sitsofe added a commit to sitsofe/fio that referenced this issue Dec 8, 2019
Fix the wrong variable being passed into mkdir and enhance Windows mkdir
emulation to be more robust against multiple slashes and dealing drive
letters.

This makes the following command line work on Windows

fio --name=dirtest --directory='D\:\' --size=4k --bs=4k --rw=read

Fixes axboe#784 and
axboe#870

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
@sitsofe
Copy link
Collaborator

sitsofe commented Dec 8, 2019

I've made a crude PoC that might address this issue over on https://github.com/sitsofe/fio/tree/windows_mkdir . It's still got debugging and is kinda ugly but it might serve as a start... Binaries are available via CI on https://ci.appveyor.com/project/sitsofe/fio/builds/29398964 .

@sitsofe
Copy link
Collaborator

sitsofe commented Dec 9, 2019

On further investigation even with my hack I think we're getting double directory path concatenation.

fio/filesetup.c

Line 1606 in fd9882f

if (td->o.directory)
has code (via set_name_idx() (

fio/options.c

Line 1238 in fd9882f

len = snprintf(target, tlen, "%s/", fname);
) which always uses a forward slash rather than FIO_OS_PATH_SEPARATOR) that tries to add a directory prefix to filenames. However we then try and add the directory prefix again to the new with-directory filename over in

fio/filesetup.c

Line 922 in fd9882f

snprintf(path, PATH_MAX, "%s%c%s", td->o.directory,
...

sitsofe added a commit to sitsofe/fio that referenced this issue Dec 9, 2019
- Fix double directory prefix concatnationn that was happening after
  95af8dd ("filesetup: don't call
  create_work_dirs() for ioengine with FIO_DISKLESSIO") refactored some
  code.
- Enhance Windows mkdir emulation to be more robust against multiple
  slashes and dealing with drive letters.

This makes the following command line work on Windows:

fio --name=dirtest --directory='D\:\1' --filename='2\fio.tmp' \
  --size=4k --bs=4k --rw=read

Fixes axboe#784 and
axboe#870

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
@sitsofe
Copy link
Collaborator

sitsofe commented Dec 9, 2019

OK I've pushed an experimental change to https://github.com/sitsofe/fio/tree/windows_mkdir to address that too. This might also fix #864 ...

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 9, 2019 via email

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 9, 2019 via email

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 9, 2019 via email

@sitsofe
Copy link
Collaborator

sitsofe commented Dec 10, 2019

@Gt3pccb OK I need to clean the patch up a bit more before submitting (hopefully in the next week) but can I include your name/address as a tested-by line in the commit?

(FYI: I've also edited your replies in the Github web issue tracker to remove the email footer and quotes to make them a bit easier to read).

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 10, 2019 via email

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 10, 2019 via email

@Gt3pccb
Copy link
Author

Gt3pccb commented Dec 11, 2019

FIO errors
fio --overwrite=1 --thread --direct=1 --ioengine=windowsaio --directory=v:\ --size=40GB --rw=write --iodepth=128 --bs=1024K --nrfiles=1 --name=4xXR2 --numjobs=10 --fallocate=truncate --group_reporting=1

4xXR2: Laying out IO file (1 file / 40960MiB)
path = v:, dwAttr = 48
path = v:, dwAttr = 48
path = v:\, dwAttr = 48
path = v:, dwAttr = 48
path = v:, dwAttr = 48
path = v:\, dwAttr = 48
path = v:, dwAttr = 48
path = v:, dwAttr = 48
path = v:\, dwAttr = 48
path = v:, dwAttr = 48
path = v:, dwAttr = 48
path = v:\, dwAttr = 48
path = v:, dwAttr = 48
path = v:, dwAttr = 48
path = v:\, dwAttr = 48
path = v:, dwAttr = 48
path = v:, dwAttr = 48
path = v:\, dwAttr = 48
fio: pid=1256, err=27/file:filesetup.c:106, func=ftruncate, error=File too large
fio: pid=13240, err=27/file:filesetup.c:106, func=ftruncate, error=File too large
fio: pid=10380, err=27/file:filesetup.c:106, func=ftruncate, error=File too large
fio: pid=11084, err=27/file:filesetup.c:106, func=ftruncate, error=File too large

there is plenty of space on the volume

sitsofe added a commit to sitsofe/fio that referenced this issue Dec 16, 2019
- Fix double directory prefix concatenation that was happening after
  95af8dd ("filesetup: don't call
  create_work_dirs() for ioengine with FIO_DISKLESSIO") refactored some
  code
- Stop always using '/' and switch to using FIO_OS_PATH_SEPARATOR when
  concatanating directory to filename in set_name_idx()
- Change the permissions directories are created with to have the execute
  bit so they can be entered(!)
- Fix bug where filenames that were absolute unix paths would create
  extra directories
- Remove the configure mkdir test and introduce fio_mkdir to hide mkdir
  platform differences
- Make Windows mkdir emulation more robust against multiple slashes and
  dealing with drive letters

This commit makes the following command line work on Windows when the
D:\1 directory exists:

./fio --name=dirtest --directory='D\:\1' --filename='2\\fio.tmp' \
 --size=4k --bs=4k --rw=read

And the following now works on macOS/Linux when the /tmp/1 directory
exists:

./fio --name=dirtest --directory='/tmp/1' --filename='2//fio.tmp' \
 --size=4k --bs=4k --rw=read

Fixes axboe#784 ,
axboe#864 and
axboe#870

Tested-by: Astolfo Rueda <astolfor@microsoft.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
sitsofe added a commit to sitsofe/fio that referenced this issue Dec 16, 2019
- Fix double directory prefix concatenation that was happening after
  95af8dd ("filesetup: don't call
  create_work_dirs() for ioengine with FIO_DISKLESSIO") refactored some
  code
- Stop always using '/' and switch to using FIO_OS_PATH_SEPARATOR when
  concatanating directory to filename in set_name_idx()
- Change the permissions directories are created with to have the execute
  bit so they can be entered(!)
- Fix bug where filenames that were absolute unix paths would create
  extra directories
- Remove the configure mkdir test and introduce fio_mkdir to hide mkdir
  platform differences
- Make Windows mkdir emulation more robust against multiple slashes and
  dealing with drive letters

This commit makes the following command line work on Windows when the
D:\1 directory exists:

./fio --name=dirtest --directory='D\:\1' --filename='2\\fio.tmp' \
 --size=4k --bs=4k --rw=read

And the following now works on macOS/Linux when the /tmp/1 directory
exists:

./fio --name=dirtest --directory='/tmp/1' --filename='2//fio.tmp' \
 --size=4k --bs=4k --rw=read

Fixes axboe#784 ,
axboe#864 and
axboe#870

Tested-by: Astolfo Rueda <astolfor@microsoft.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
sitsofe added a commit to sitsofe/fio that referenced this issue Dec 16, 2019
- Fix double directory prefix concatenation that was happening after
  95af8dd ("filesetup: don't call
  create_work_dirs() for ioengine with FIO_DISKLESSIO") refactored some
  code
- Stop always using '/' and switch to using FIO_OS_PATH_SEPARATOR when
  concatenating the directory value to the filename in set_name_idx()
- Change the permissions directories are created with to have the
  execute bit so they can be entered(!)
- Fix bug where filenames that were absolute unix paths would prevent
  the creation of intermediate directories
- Remove the configure mkdir test and introduce fio_mkdir to hide mkdir
  platform differences
- Make Windows mkdir emulation more robust against multiple slashes
  after the drive letter and when dealing dealing with with paths
  containing drive letters in general

This commit makes the following work on Windows:
./fio --thread --name=doubleslashtest \
 --filename='C\:\\Windows\Temp\fio.tmp' --size=4k --bs=4k --rw=read

The next example now works when D:\1\ exists but D:\1\2\ doesn't:

./fio --thread --name=mkdirtest --directory='D\:\1' \
 --filename='2\fio.tmp' --size=4k --bs=4k --rw=read

The following now works on macOS/Linux when /tmp/1/ exists but /tmp/1/2/
doesn't:

./fio --name=mkdirtest --directory='/tmp/1' \
 --filename='2/fio.tmp' --size=4k --bs=4k --rw=read

Fixes axboe#784 ,
axboe#864 and
axboe#870

Tested-by: Astolfo Rueda <astolfor@microsoft.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
@sitsofe
Copy link
Collaborator

sitsofe commented Dec 16, 2019

@Gt3pccb I don't think your latest error is related to this issue and I'm going to guess you can't hit it when you make a file that is 31GBytes or less in size... Can you spin off separately?

sitsofe added a commit to sitsofe/fio that referenced this issue Dec 18, 2019
- Fix double directory prefix concatenation that was happening after
  95af8dd ("filesetup: don't call
  create_work_dirs() for ioengine with FIO_DISKLESSIO") refactored some
  code
- Stop always using '/' and switch to using FIO_OS_PATH_SEPARATOR when
  concatenating the directory value to the filename in set_name_idx()
- Change the permissions directories are created with to have the
  execute bit so they can be entered(!)
- Fix bug where filenames that were absolute unix paths would prevent
  the creation of intermediate directories
- Remove the configure mkdir test and introduce fio_mkdir to hide mkdir
  platform differences
- Make Windows mkdir emulation more robust against multiple slashes
  after the drive letter and when dealing dealing with with paths
  containing drive letters in general

This commit makes the following work on Windows:
./fio --thread --name=doubleslashtest \
 --filename='C\:\\Windows\Temp\fio.tmp' --size=4k --bs=4k --rw=read

The next example now works when D:\1\ exists but D:\1\2\ doesn't:

./fio --thread --name=mkdirtest --directory='D\:\1' \
 --filename='2\fio.tmp' --size=4k --bs=4k --rw=read

The following now works on macOS/Linux when /tmp/1/ exists but /tmp/1/2/
doesn't:

./fio --name=mkdirtest --directory='/tmp/1' \
 --filename='2/fio.tmp' --size=4k --bs=4k --rw=read

Fixes axboe#784 ,
axboe#864 and
axboe#870

Tested-by: Astolfo Rueda <astolfor@microsoft.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
@sitsofe
Copy link
Collaborator

sitsofe commented Dec 19, 2019

I think the main part of the original issue is fixed by 5e52534 ...

@sitsofe
Copy link
Collaborator

sitsofe commented Dec 21, 2019

@Gt3pccb just to be clear - has the original issue in the description been resolved with master of fio? If so could you close this issue? Thanks!

@sitsofe sitsofe added the needreporterinfo Waiting on information from the issue reporter label Dec 21, 2019
@sitsofe
Copy link
Collaborator

sitsofe commented Jan 12, 2020

Closing due to lack of reply from @Gt3pccb. If this issue is still happening with the latest fio (see https://github.com/axboe/fio/releases to find out which version that is) please reopen. Thanks!

@sitsofe sitsofe closed this as completed Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needreporterinfo Waiting on information from the issue reporter
Projects
None yet
Development

No branches or pull requests

4 participants