Bug 563492 - fallocate() always fails on ext4 with x86_64 arch
fallocate() always fails on ext4 with x86_64 arch
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.4
x86_64 Linux
low Severity medium
: rc
: ---
Assigned To: Eric Sandeen
Red Hat Kernel QE team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-10 07:18 EST by Roman
Modified: 2010-02-10 14:06 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-02-10 14:06:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test.c (477 bytes, text/x-csrc)
2010-02-10 07:18 EST, Roman
no flags Details

  None (edit)
Description Roman 2010-02-10 07:18:32 EST
Created attachment 389979 [details]
test.c

Description of problem:

fallocate() syscall always fails with EOPNOTSUPP on ext4 with x86_64 arch

Version-Release number of selected component (if applicable):
kernel-2.6.18-164.11.1.el5.x86_64
kernel-2.6.18-186.el5.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. vi test.c:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <fcntl.h>
#include <unistd.h>

#include <asm/unistd.h>

int fallocate(int fd, int mode, loff_t offset, loff_t len)
{
        return syscall(__NR_fallocate, fd, mode, offset, len);
}

int main()
{
        int fd = open("test.dat", O_RDWR | O_CREAT, 0666);
        if (fd == -1) {
                perror("open");
                return 1;
        }
        if (fallocate(fd, 0, 0, 1048576)) {
                perror("fallocate");
        }
        close(fd);
        return 0;
}

2. gcc -Wall -o test test.c
3. ./test
  
Actual results:
fallocate: Operation not supported

Expected results:
test.dat file 1MB length

Additional info:
tried the same kernels but i686 arch: work as expected
Comment 1 Eric Sandeen 2010-02-10 12:13:45 EST
I'll take a look, I thought this was working fine but will double check.
Comment 2 Eric Sandeen 2010-02-10 12:27:30 EST
Are you certain you're testing on ext4?

# ./bz-fallocate 
# ls -lh test.dat
-rw-r--r-- 1 root root 1.0M Feb 10 11:19 test.dat
# du -hc test.dat
1.0M	test.dat
1.0M	total
# unmae -a
Linux $HOST #1 SMP Wed Jan 27 18:11:22 EST 2010 x86_64 x86_64 x86_64 GNU/Linux

-Eric
Comment 3 Roman 2010-02-10 14:01:44 EST
Sorry, this is my fault.

I've created filesystem with the command
# mke4fs -j <block-device>

recreating filesystem with the command
# mkfs.ext4 <block-device>
resolved this issue.
Comment 4 Eric Sandeen 2010-02-10 14:06:04 EST
Ok, that mke4fs business is a little confusing, sorry about that.  It's just a newer, parallel-installable version of mke2fs, and behaves just as mke2fs does - so yes, you got an ext3 filesystem that way, and fallocate is not supported by ext3 - so everything is working as expected.

Thanks,
-Eric

Note You need to log in before you can comment on or make changes to this bug.