writev() call writes only 2147479552 bytes (2GB minus 4KB) and returns even if the size of data passed is bigger

Solution Verified - Updated -

Issue

  • In Red Hat Enterprise Linux 6.4 and earlier writev() system call is able to write more than 2 gigabytes of data in a single call and return the size of data written equal to the size of data passed. In Red Hat Enterprise Linux 6.5 and later writev() system call does a short-write of only 2147479552 bytes (2GB minus 4KB) even if the size of data buffers passed is bigger, thus other calls to writev() are needed to write the rest of the data.

  • A simple test program shows this difference in writev() behaviour:

    [root@serv ~]# uname -a
    Linux serv.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
    [root@serv ~]# ./writev_test
    writev() returned 2147487744
    successfully wrote >2GB buffer 2147487744, bytes written: 2147487744
    
    [root@serv ~]# uname -a
    Linux serv.localdomain 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
    [root@rhel64 ~]# ./writev_test
    writev() returned 2147479552
    failed to write >2GB buffer 2147487744, bytes written: 2147479552
    

Environment

Red Hat Enterprise Linux 6.5 and later

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content