Seeing 'Short read' error in Samba-plugin's pwrite() while reading data from socket data.

sandeep nag sandeepnagamalli at gmail.com
Mon May 12 12:26:59 MDT 2014


I am seeing 'Short read' errors in pwrite() call of our Samba-VFS plugin
while reading data from socket data. Please suggest me the function to
debug in samba code and tell me, what could be the possible reasons for
'Short read' errors and how can it be fixed.


 bytes_read = 0;
    while(bytes_read != n)
    {
        read_ret = read(wd->u.rfd, buf + bytes_read, n - bytes_read);
        if (read_ret == 0)
        {
            read_ret = -1;
            CIFS_NOTICE("%s: Short read from socket, n %ld, bytes_read
%ld,"    <==== This error is seen in  logs.
                        " errno %d", __FUNCTION__, n, bytes_read, errno);
            if (errno == 0)
            {
                errno = EIO;
            }
        }

        if (read_ret == -1)
        {
            if (errno == EINTR)
                continue;

            assert(errno);
            err = ERRNO_TO_CIFS_ERROR(errno);
            CIFS_ERROR_DONE(err, "%s: Error reading file data from socket",
                                __FUNCTION__);
        }

        bytes_read += read_ret;
    }


Thanks,
Sandeep.


More information about the samba-technical mailing list