Skip to content

Commit

Permalink
lustre: fix checks for lustre_user.h header
Browse files Browse the repository at this point in the history
Fix the configure check if --with-lustre is specified, but
the linux/lustre/lustre_user.h header is not present.  Only
one of the headers needs to be included if both are found.

In some cases, FASYNC is not defined, but forms part of the
O_LOV_DELAY_CREATE value, add a #define in that case.

Fixes #115.

Fixes: cb88c4c19a831d94b864c49a162e2635730540e5
Signed-off-by: Andreas Dilger <[email protected]>
  • Loading branch information
adilger authored and glennklockwood committed Dec 15, 2018
1 parent 11469ac commit 1ee2c37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ AM_MAINTAINER_MODE

# We can't do anything without a working MPI
AX_PROG_CC_MPI(,,[
AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.])
AC_MSG_FAILURE([MPI compiler requested, but could not use MPI.])
])

AC_PROG_RANLIB
Expand Down Expand Up @@ -72,7 +72,9 @@ AC_ARG_WITH([lustre],
[], [with_lustre=check])
AS_IF([test "x$with_lustre" != xno], [
AC_CHECK_HEADERS([linux/lustre/lustre_user.h lustre/lustre_user.h], break, [
if test "x$with_lustre" != xcheck; then
if test "x$with_lustre" != xcheck -a \
"x$ac_cv_header_linux_lustre_lustre_user_h" = "xno" -a \
"x$ac_cv_header_lustre_lustre_user_h" = "xno" ; then
AC_MSG_FAILURE([--with-lustre was given, <lustre/lustre_user.h> not found])
fi
])
Expand Down
14 changes: 10 additions & 4 deletions src/aiori-POSIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
#include <assert.h>


#ifdef HAVE_LUSTRE_LUSTRE_USER_H
# include <lustre/lustre_user.h>
#endif
#ifdef HAVE_LINUX_LUSTRE_LUSTRE_USER_H
# include <linux/lustre/lustre_user.h>
#elif defined(HAVE_LUSTRE_LUSTRE_USER_H)
# include <lustre/lustre_user.h>
#endif
#ifdef HAVE_GPFS_H
# include <gpfs.h>
Expand Down Expand Up @@ -278,6 +277,12 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param)
set_o_direct_flag(&fd_oflag);

#ifdef HAVE_LUSTRE_LUSTRE_USER_H
/* Add a #define for FASYNC if not available, as it forms part of
* the Lustre O_LOV_DELAY_CREATE definition. */
#ifndef FASYNC
#define FASYNC 00020000 /* fcntl, for BSD compatibility */
#endif

if (param->lustre_set_striping) {
/* In the single-shared-file case, task 0 has to creat the
file with the Lustre striping options before any other processes
Expand All @@ -298,7 +303,8 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param)
opts.lmm_stripe_count = param->lustre_stripe_count;

/* File needs to be opened O_EXCL because we cannot set
Lustre striping information on a pre-existing file. */
* Lustre striping information on a pre-existing file.*/

fd_oflag |=
O_CREAT | O_EXCL | O_RDWR | O_LOV_DELAY_CREATE;
*fd = open64(testFileName, fd_oflag, 0664);
Expand Down

0 comments on commit 1ee2c37

Please sign in to comment.