Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

namazu has error when using O_DIRECT #181

Open
hxl1987 opened this issue Dec 16, 2016 · 3 comments
Open

namazu has error when using O_DIRECT #181

hxl1987 opened this issue Dec 16, 2016 · 3 comments

Comments

@hxl1987
Copy link

hxl1987 commented Dec 16, 2016

Hello:
I wrote a program to verify the NAMAZU file system fault injection.
./nmz inspectors fs -mount-point /tmp/nmzfs-mnt -original-dir /tmp/nmzfs-orig -autopilot config.toml

The program are as follows:
test_fs.txt

I open a file that uses a direct IO option.
If the normal directory below /tmp/nmzfs-orig for write operation, you can write.But in the /tmp/nmzfs-mnt directory below operation, write will be wrong.
The error is:
write ./direct_io.data failed: Invalid argument
write ./direct_io.data failed: Invalid argument
write ./direct_io.data failed: Invalid argument

I checked the source code, found finally mounted by fusermount.So I added the direct_io option to fusermount in namazu/vendor/github.com/osrg/hookfs/hookfs/server.go.

pathFs := pathfs.NewPathNodeFs(hookfs, nil)
conn := nodefs.NewFileSystemConnector(pathFs.Root(), opts)
originalAbs, _ := filepath.Abs(hookfs.Original)
var the_opt = []string{"nonempty","direct_io"}
mOpts := &fuse.MountOptions{
AllowOther: true,
Name: hookfs.FsName,
FsName: originalAbs,
Options: the_opt,
}

But fusermount does not support the direct_io option.The error is:

[NMZ-INF] 16:34:40.02: fusermount the cmd is [/bin/fusermount /tmp/nmzfs-mnt -o nonempty,direct_io,allow_other,subtype=hookfs,fsname=/tmp/nmzfs-orig]
(at mount_linux.go:50)
[NMZ-WRN] 16:34:40.02: ignoring restPort: -1 (at endpoint.go:86)
[NMZ-WRN] 16:34:40.02: ignoring pbPort: -1 (at endpoint.go:97)
/bin/fusermount: mount failed: Invalid argument
[NMZ-CRT] 16:34:40.02: fusermount exited with code 256
(at fs.go:103)
[NMZ-CRT] 16:34:40.02: PANIC: fusermount exited with code 256
(at coreutil.go:49)
[NMZ-INF] 16:34:40.02: Hint: For debug info, please set "NMZ_DEBUG" to 1. (at coreutil.go:53)

Can you help me solve the problem? Looking forward to your early reply, thank you very much.

`

@AkihiroSuda
Copy link
Member

Thank you a lot for reporting this issue.

AFAIK, FUSE does not support O_DIRECT.
https://sourceforge.net/p/fuse/mailman/message/27377600/
hanwen/go-fuse#146

So maybe we should support non-FUSE inspector as well (kprobes? NBD? iSCSI?)

PTAL @mitake

@AkihiroSuda
Copy link
Member

If you are just interesting in injecting an error or non-interruptible sleeps (i.e. makes whole the system sleep, not single LWP), I suggest using "guru"-mode SystemTap

e245f5a

PTAL @mitake what do you suggest for injecting interruptible sleeps for filesystem operations, with support for O_DIRECT?

@mitake
Copy link
Contributor

mitake commented Dec 16, 2016

@AkihiroSuda I think the approach based on block device (nbd, iSCSI, qemu, etc) is too costly because correspondence between file accesses and block requests will be hard to be analyzed. kprobe based approach would be suitable for the case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants