Created attachment 305300
C reproducer of the problem. Run it on a tmpfs file system mounted on /mnt/tmpfs
creating a file on tmpfs with open(filename, O_RDWR | O_DIRECT | O_CREAT, 0666) reports an open failure error EINVAL, but still creates the file. The file should not be created if we hit such an error.
Tested this on 6.6.0-rc7 and 6.1.0-13 mainline kernels, x86-64.
Created attachment 305300
C reproducer of the problem. Run it on a tmpfs file system mounted on /mnt/tmpfs
creating a file on tmpfs with open(filename, O_RDWR | O_DIRECT | O_CREAT, 0666) reports an open failure error EINVAL, but still creates the file. The file should not be created if we hit such an error.
Tested this on 6.6.0-rc7 and 6.1.0-13 mainline kernels, x86-64.
mkdir /mnt/tmpfs nr_inodes= 10k,mode= 777 tmpfs /mnt/tmpfs
sudo mount -t tmpfs -o size=1G,
sudo chmod 666 /mnt/tmpfs
Run the attached program. It reports an open failure (errno 22, EINVAL) but still manages to create the file.
Note this was original discovered by running stress-ng on tmpfs with the open stressor: stress-ng --open 1