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

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 2024-03-07T13:09:02+00:00 colin.i.king wrote:

Summary:

create hfs file system, loop-back mount it, run filename stressor with
stress-ng to exercise filename create/stat/unlink and we get unexpected -EEXIST 
errors.
This can be worked around by adding a sync() call after the unlink() to ensure
metadata is sync'd.

Kernel: 6.8.0-11-generic

test case:
sudo apt-get install hfsprogs

dd if=/dev/zero of=fs.img bs=1M count=2048
mkfs.hfs fs.img
sudo mount fs.img /mnt
sudo mkdir /mnt/x
sudo stress-ng --temp-path /mnt/x --filename 8 --filename-opts posix -t 20
stress-ng: info: [132412] setting to a 20 secs run per stressor
stress-ng: info: [132412] dispatching hogs: 8 filename
stress-ng: fail: [132424] filename: open failed on file of length 1 bytes, 
errno=17 (File exists)
stress-ng: fail: [132428] filename: open failed on file of length 20 bytes, 
errno=17 (File exists)
stress-ng: fail: [132423] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
stress-ng: fail: [132421] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
stress-ng: fail: [132428] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
stress-ng: fail: [132426] filename: open failed on file of length 23 bytes, 
errno=17 (File exists)
stress-ng: fail: [132425] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
stress-ng: fail: [132428] filename: open failed on file of length 1 bytes, 
errno=17 (File exists)
stress-ng: fail: [132423] filename: open failed on file of length 7 bytes, 
errno=17 (File exists)
stress-ng: fail: [132423] filename: open failed on file of length 11 bytes, 
errno=17 (File exists)
stress-ng: fail: [132426] filename: open failed on file of length 24 bytes, 
errno=17 (File exists)

adding a sync() call in the stress-ng stressor fixes the issue:

git diff
diff --git a/stress-filename.c b/stress-filename.c
index a64898fb1..b8266f91e 100644
--- a/stress-filename.c
+++ b/stress-filename.c
@@ -308,6 +308,7 @@ static void stress_filename_test(
                VOID_RET(int, shim_stat(filename, &buf));

                (void)shim_unlink(filename);
+ (void)sync();
        }

        /* exercise dcache lookup of non-existent filename */

sudo stress-ng --temp-path /mnt/x --filename 8 --filename-opts posix -t 20
stress-ng: info: [132461] setting to a 20 secs run per stressor
stress-ng: info: [132461] dispatching hogs: 8 filename
stress-ng: info: [132461] skipped: 0
stress-ng: info: [132461] passed: 8: filename (8)
stress-ng: info: [132461] failed: 0
stress-ng: info: [132461] metrics untrustworthy: 0
stress-ng: info: [132461] successful run completed in 20.05 secs

The sync should not be required by the way, I just added it to
illustrate that there is a racy metadata sync issue in hfs.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2056451/comments/1


** 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/2056451

Title:
  hfs: concurrent create/unlink can trip -EEXIST on non-existent files

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

Bug description:
  Summary:

  create hfs file system, loop-back mount it, run filename stressor with
  stress-ng to exercise filename create/stat/unlink and we get unexpected 
-EEXIST errors.
  This can be worked around by adding a sync() call after the unlink() to ensure
  metadata is sync'd.  

  Kernel: 6.8.0-11-generic

  test case:
  sudo apt-get install hfsprogs

  dd if=/dev/zero of=fs.img bs=1M count=2048
  mkfs.hfs fs.img 
  sudo mount fs.img /mnt
  sudo mkdir /mnt/x
  sudo stress-ng --temp-path /mnt/x --filename 8 --filename-opts posix -t 20
  stress-ng: info:  [132412] setting to a 20 secs run per stressor
  stress-ng: info:  [132412] dispatching hogs: 8 filename
  stress-ng: fail:  [132424] filename: open failed on file of length 1 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132428] filename: open failed on file of length 20 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132423] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132421] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132428] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132426] filename: open failed on file of length 23 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132425] filename: open failed on file of length 30 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132428] filename: open failed on file of length 1 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132423] filename: open failed on file of length 7 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132423] filename: open failed on file of length 11 bytes, 
errno=17 (File exists)
  stress-ng: fail:  [132426] filename: open failed on file of length 24 bytes, 
errno=17 (File exists)

  adding a sync() call in the stress-ng stressor fixes the issue:

  git diff
  diff --git a/stress-filename.c b/stress-filename.c
  index a64898fb1..b8266f91e 100644
  --- a/stress-filename.c
  +++ b/stress-filename.c
  @@ -308,6 +308,7 @@ static void stress_filename_test(
                  VOID_RET(int, shim_stat(filename, &buf));
   
                  (void)shim_unlink(filename);
  +               (void)sync();
          }
   
          /* exercise dcache lookup of non-existent filename */

  
  sudo stress-ng --temp-path /mnt/x --filename 8 --filename-opts posix -t 20
  stress-ng: info:  [132461] setting to a 20 secs run per stressor
  stress-ng: info:  [132461] dispatching hogs: 8 filename
  stress-ng: info:  [132461] skipped: 0
  stress-ng: info:  [132461] passed: 8: filename (8)
  stress-ng: info:  [132461] failed: 0
  stress-ng: info:  [132461] metrics untrustworthy: 0
  stress-ng: info:  [132461] successful run completed in 20.05 secs

  The sync should not be required by the way, I just added it to
  illustrate that there is a racy metadata sync issue in hfs.

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


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to