summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/vnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/fs/vnode.c')
-rw-r--r--usr/src/uts/common/fs/vnode.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c
index c57884a940..3babdbecdb 100644
--- a/usr/src/uts/common/fs/vnode.c
+++ b/usr/src/uts/common/fs/vnode.c
@@ -51,6 +51,7 @@
#include <sys/vfs.h>
#include <sys/vfs_opreg.h>
#include <sys/vnode.h>
+#include <sys/filio.h>
#include <sys/rwstlock.h>
#include <sys/fem.h>
#include <sys/stat.h>
@@ -1254,6 +1255,22 @@ top:
if ((error = VOP_SETATTR(vp, &vattr, 0, CRED(), NULL)) != 0)
goto out;
}
+
+ /*
+ * Turn on directio, if requested.
+ */
+ if (filemode & FDIRECT) {
+ if ((error = VOP_IOCTL(vp, _FIODIRECTIO, DIRECTIO_ON, 0,
+ CRED(), NULL, NULL)) != 0) {
+ /*
+ * On Linux, O_DIRECT returns EINVAL when the file
+ * system does not support directio, so we'll do the
+ * same.
+ */
+ error = EINVAL;
+ goto out;
+ }
+ }
out:
ASSERT(vp->v_count > 0);