Launchpad has imported 5 comments from the remote bug at
https://bugzilla.kernel.org/show_bug.cgi?id=218049.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2023-10-27T13:53:48+00:00 colin.i.king wrote:

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
sudo mount -t tmpfs -o size=1G,nr_inodes=10k,mode=777 tmpfs /mnt/tmpfs
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

Reply at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2041670/comments/0

------------------------------------------------------------------------
On 2023-10-27T14:30:36+00:00 colin.i.king wrote:

See also: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2041670

Reply at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2041670/comments/3

------------------------------------------------------------------------
On 2023-10-27T14:36:29+00:00 colin.i.king wrote:

Also occurs on ramfs too.

Seems to occur on kernels from 4.4.x to current 6.6-rc6 (not tested
anything newer).

Reply at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2041670/comments/4

------------------------------------------------------------------------
On 2023-10-27T14:48:49+00:00 aros wrote:

Confirming and CC'ing Christian Brauner.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2041670/comments/5

------------------------------------------------------------------------
On 2023-10-27T14:50:39+00:00 aros wrote:

Actually Hugh Dickins added O_DIRECT support, CC'ing him as well.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2041670/comments/6


** Changed in: linux
       Status: Unknown => Confirmed

** Changed in: linux
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/2041670

Title:
   tmpfs: O_DIRECT | O_CREATE open reports open failure but actually
  creates a file.

Status in Linux:
  Confirmed
Status in linux package in Ubuntu:
  New

Bug description:
  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 and fails on:
  mantic amd64: 6.5.0-10-generic
  lunar amd64: 6.2.0-35-generic
  jammie amd64: 5.15.0-generic
  focal: 5.4.0-165-generic
  bionic: 4.15.0-213-generic
  trusty: 4.4.0-148-generic

  
  sudo mkdir /mnt/tmpfs
  sudo mount -t tmpfs -o size=1G,nr_inodes=10k,mode=777 tmpfs /mnt/tmpfs
  sudo chmod 666 /mnt/tmpfs
  gcc reproducer.c -o reproducer
  sudo ./reproducer

  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/linux/+bug/2041670/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to