Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't allow O_DIRECT (issue 110)

9p does not preserve O_DIRECT alignment when it breaks up requests
into msize-chunks.

Fix up tests:
kern/t35: interrupt a dd, not a 'scrub', which uses O_DIRECT
kern/t40: scrub a file demonstrating fallback to non-O_DIRECT works
  • Loading branch information...
commit f8396ddf953d7c8e2ce0f6d04fee998be4431d3d 1 parent 25a071c
@garlick garlick authored
View
9 diod/ops.c
@@ -634,6 +634,10 @@ diod_lopen (Npfid *fid, u32 flags)
flags = _remap_oflags (flags);
+ if (flags & O_DIRECT) {
+ np_uerror (EINVAL); /* O_DIRECT not allowed - see issue 110 */
+ goto error_quiet;
+ }
if ((flags & O_CREAT)) /* can't happen? */
flags &= ~O_CREAT; /* clear and allow to fail with ENOENT */
@@ -677,8 +681,13 @@ diod_lcreate(Npfid *fid, Npstr *name, u32 flags, u32 mode, u32 gid)
flags = _remap_oflags (flags);
+ if (flags & O_DIRECT) {
+ np_uerror (EINVAL); /* O_DIRECT not allowed - see issue 110 */
+ goto error_quiet;
+ }
if (!(flags & O_CREAT)) /* can't happen? */
flags |= O_CREAT;
+
if (f->ioctx != NULL) {
np_uerror (EINVAL);
goto error;
View
2  tests/kern/Makefile.am
@@ -23,7 +23,7 @@ TESTS_ENVIRONMENT += "./runtest"
TESTS = t05 t06 t07 t12 t13 t14 t15 t16 t17 t18 t19 t22 \
t23 t24 t25 t26 t27 t28 t29 t30 t31 t32 t33 \
- t34 t35 t36 t37 t38 t39
+ t34 t35 t36 t37 t38 t39 t40
#XFAIL_TESTS =
View
2  tests/kern/README
@@ -44,3 +44,5 @@ t35 Trigger a tflush by aborting a streaming write.
t36 List a long directory that will be broken into multiple P9_READDIRs
t37 Run fsx.
t38 Run fsstress.
+t39 Run fsstress out of 9p, against host fs.
+t40 Run "scrub" (scrub < v2.5 O_SYNC; scrub >= v2.5 O_DIRECT+fsync)
View
4 tests/kern/runtest
@@ -58,8 +58,8 @@ if [ "`basename $TEST`" = "t34" ] && ! which svnadmin >/dev/null 2>&1; then
echo "svnadmin is not installed" >$TEST.out
exit 77
fi
-# t35 requires scrub
-if [ "`basename $TEST`" = "t35" ] && ! which scrub >/dev/null 2>&1; then
+# t40 requires scrub
+if [ "`basename $TEST`" = "t40" ] && ! which scrub >/dev/null 2>&1; then
echo "scrub is not installed" >$TEST.out
exit 77
fi
View
6 tests/kern/t35
@@ -1,9 +1,7 @@
#!/bin/bash
-echo creating 100mb file
-dd if=/dev/zero of=$PATH_MNTDIR/file bs=1024k count=100 status=noxfer
-echo scrubbing
-scrub -s 100m $PATH_MNTDIR/file >/dev/null &
+echo dding to 500mb file
+dd if=/dev/zero of=$PATH_MNTDIR/file bs=1024k count=500 status=noxfer &
echo interrupting
sleep 0.5
kill -15 %1
View
5 tests/kern/t35.exp
@@ -1,8 +1,5 @@
kconjoin: diodmount exited with rc=0
-creating 100mb file
-100+0 records in
-100+0 records out
-scrubbing
+dding to 500mb file
interrupting
kconjoin: t35 exited with rc=0
kconjoin: diod exited with rc=0
View
8 tests/kern/t40
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+echo creating 100mb file
+dd if=/dev/zero of=$PATH_MNTDIR/file bs=1024k count=100 status=noxfer
+echo scrubbing
+scrub -s 100m $PATH_MNTDIR/file >/dev/null
+
+exit 0
View
7 tests/kern/t40.exp
@@ -0,0 +1,7 @@
+kconjoin: diodmount exited with rc=0
+creating 100mb file
+100+0 records in
+100+0 records out
+scrubbing
+kconjoin: t40 exited with rc=0
+kconjoin: diod exited with rc=0
Please sign in to comment.
Something went wrong with that request. Please try again.