pmem / pmemfile

Userspace implementation of file APIs using persistent memory.
Other
34 stars 21 forks source link

Wrong flag returned by fcntl(F_GETFL) for file with O_RDWR flag #359

Closed llugin closed 7 years ago

llugin commented 7 years ago

Occurs in LTP tests fcntl04 and fcntl04_64. Test output:

FAIL: fcntl(fcntl04_9592, F_GETFL, 0) returned wrong access mode 3, expected 2

Reproducing:

int fd = open("my_file", O_RDWR|O_CREAT, 0700);
fcntl(fd, F_GETFL);

Intercept log excerpt for code execution under pf:

/lib/x86_64-linux-gnu/libc.so.6 0xf700e -- open("my_file", O_RDWR | O_CREAT, 0700) = ?
/lib/x86_64-linux-gnu/libc.so.6 0xf700e -- open("my_file", O_RDWR | O_CREAT, 0700) = 4
/lib/x86_64-linux-gnu/libc.so.6 0xf76b5 -- fcntl(4, 3 (F_GETFL), 0x1c0) = ?
/lib/x86_64-linux-gnu/libc.so.6 0xf76b5 -- fcntl(4, 3 (F_GETFL), 0x1c0) = 3

Strace log excerpt for code execution under ext4:

open("my_file", O_RDWR|O_CREAT, 0700) = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
llugin commented 7 years ago

Previously failing LTP tests fcntl04 and fcntl04_64 now passing.