Hi,

During a randomized test I discovered that ntfs_create() can fail with ENOSPC
when adding a file to a directory that has many named data streams,
independently of the size of the volume.  I am still investigating the problem,
but I thought I'd post some reproducing code.  The problem is very sensitive to
the length of the directory name and the number of named data streams; it even
goes away if the number of named data streams is *increased*.  So far I am
thinking that the bug has to do with the MFT record filling up just as the child
file is added and the existing attribute records not being correctly moved to an
AT_ATTRIBUTE_LIST attribute.

The problem can be reproduced on a FUSE mount using the script below:

#!/bin/bash

set -e

dirname="rgclucukwqvcoheicmlkgmshlqddqnrxebzrftwndexmfxulbrqiqxeqxxyhjgyprdpekooto"
fallocate -l 1G ntfs.img
mkntfs --fast --force ntfs.img 
mkdir -p mnt
ntfs-3g ntfs.img mnt
echo "Creating directory mnt/$dirname"
mkdir mnt/$dirname
for stream_name in {a..p}; do
        echo "Creating named stream mnt/$dirname:$stream_name"
        setfattr -n user.$stream_name -v 0x mnt/$dirname
done
pathname="mnt/$dirname/a"
echo "Creating file $pathname"
touch $pathname  # Fails with "No space left on device"

------------------------------------------------------------------------------
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to