1
1

fs/ufs: ensure that the never-lock flag is set if not on NFS

Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
Этот коммит содержится в:
Edgar Gabriel 2017-10-18 09:36:08 -05:00
родитель f66c55f77a
Коммит e62f9d2e52

Просмотреть файл

@ -28,9 +28,11 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "mpi.h" #include "mpi.h"
#include "ompi/constants.h" #include "ompi/constants.h"
#include "ompi/mca/fs/base/base.h"
#include "ompi/mca/fs/fs.h" #include "ompi/mca/fs/fs.h"
#include "ompi/communicator/communicator.h" #include "ompi/communicator/communicator.h"
#include "ompi/info/info.h" #include "ompi/info/info.h"
#include "opal/util/path.h"
/* /*
* file_open_ufs * file_open_ufs
@ -101,5 +103,34 @@ mca_fs_ufs_file_open (struct ompi_communicator_t *comm,
*/ */
fh->f_fs_block_size = 4096; fh->f_fs_block_size = 4096;
/* Need to check for NFS here. If the file system is not NFS but a regular UFS file system,
we do not need to enforce locking. A regular XFS or EXT4 file system can only be used
within a single node, local environment, and in this case the OS will already ensure correct
handling of file system blocks;
*/
char *fstype=NULL;
bool bret = opal_path_nfs ( (char *)filename, &fstype );
if ( false == bret ) {
char *dir;
mca_fs_base_get_parent_dir ( (char *)filename, &dir );
bret = opal_path_nfs (dir, &fstype);
free(dir);
}
if ( true == bret ) {
if ( 0 == strncasecmp(fstype, "nfs", sizeof("nfs")) ) {
/* Nothing really to be done in this case. Locking can stay */
}
else {
fh->f_flags |= OMPIO_LOCK_NEVER;
}
}
else {
fh->f_flags |= OMPIO_LOCK_NEVER;
}
free (fstype);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }