hdf5 icon indicating copy to clipboard operation
hdf5 copied to clipboard

Use fcntl() when filesystem does not support flock().

Open mnijhuis-tos opened this issue 1 year ago • 0 comments

When opening a file read-only on a "dvs" filesystem, HDF5 will complain that it cannot lock the file and it reports (among others):

#006: H5Fint.c line 1898 in H5F_open(): unable to lock the file #007: H5FD.c line 1625 in H5FD_lock(): driver lock request failed #008: H5FDsec2.c line 1002 in H5FD__sec2_lock(): unable to lock file, errno = 524, error message = 'Unknown error 524'

I found that error 524 corresponds to ENOTSUPP (Not supported). According to https://manualzz.com/doc/12737309/dvs-administration-guide#p39, using flock() on a "dvs" filesystem indeed is not supported and returns this error.

The dvs manual reports that locking using fcntl() is supported, so it would be nice if HDF5 would try using fcntl() when flock() returns ENOTSUPP.

As a workaround, I will disable locking using the HDF5_USE_FILE_LOCKING=FALSE environment variable for now. In my case, I only open the files in read-only mode so locks are not needed.

mnijhuis-tos avatar Jul 31 '23 13:07 mnijhuis-tos