Date: Mon, 8 Sep 2008 21:34:36 +0400 (MSD) From: Anton Yuzhaninov <citrin@citrin.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/127213: sendfile on tmpfs data corruption Message-ID: <20080908173436.6F01C5C3B@mx3.rambler.ru> Resent-Message-ID: <200809081750.m88Ho24h029038@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 127213
>Category: kern
>Synopsis: sendfile on tmpfs data corruption
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Sep 08 17:50:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Anton Yuzhaninov
>Release: FreeBSD 7.1-PRERELEASE amd64
>Organization:
Rambler
>Environment:
System: FreeBSD mx3.rambler.ru 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #1: Fri Sep 5 21:15:43 MSD 2008 root@mx3.rambler.ru:/usr/obj/usr/src/sys/MAIL amd64
>Description:
sendfile(2) currupts data for files on tmpfs
>How-To-Repeat:
1. Create tmpfs and write test file
# mount -t tmpfs tmpfs /spool/tmpfs
# echo 'this is test file' > /spool/tmpfs/tt
# cat /spool/tmpfs/tt
this is test file
2. Transfer this file using sendfile. E. g. using web server from port www/nginx
# cat nginx.conf
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
access_log off;
sendfile on;
server {
listen 8081;
location / {
root /spool/tmpfs;
}
}
}
# nginx -c nginx.conf
Content of fetched file will be different garbage on each request:
# fetch -qo - http://127.0.0.1:8081/tt | hd
00000000 d4 98 7a 00 08 00 00 00 dc 98 7a 00 08 00 00 00 |Ԙz.....ܘz.....|
00000010 e4 98 |ä˜|
00000012
# fetch -qo - http://127.0.0.1:8081/tt | md5
ff035bff2dcf972ee7dfd023455997ef
# fetch -qo - http://127.0.0.1:8081/tt | md5
bb07cd1a0ede3c7af24e4a86a14b0493
# fetch -qo - http://127.0.0.1:8081/tt | md5
e84539257c2650da866a186435acc93d
With sendfile disbled in nginx.conf file is not corrupted,
but we need sendfile support for other application (where only sendfile supported).
>Fix:
Not known.
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080908173436.6F01C5C3B>
