NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/45829: writing to vnd on sparse file blocks on pager_map



>Number:         45829
>Category:       kern
>Synopsis:       writing to vnd on sparse file blocks on pager_map
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 13 04:45:00 +0000 2012
>Originator:     Takahiro Hayashi
>Release:        NetBSD 5.99.59 201201110930Z
>Organization:
>Environment:
System: NetBSD ruin 5.99.59 NetBSD 5.99.59 (MONOLITHIC) #0: Wed Jan 11
16:24:49 UTC 2012
builds%b8.netbsd.org@localhost:/home/builds/ab/HEAD/i386/201201110930Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/MONOLITHIC
i386
Architecture: i386
Machine: i386
>Description:
        Writing to vnd created on sparse file may block on wait channel
        pager_map.
        I created 1 giga byte sparse file, configured vnd on it,
        newfs, mount, and did "dd if=/dev/zero bs=32k of=/mnt/foo".
        (see How-To-Repeat)
        The dd command does not return and ps (on other tty) shows
        that dd is blocked in wait channel pager_map.  sync, df and
        ls /mnt/ freeze on wchan tstile.
        The problem happens even if bs=4k but it takes several seconds.
        However, does not happen if bs=512.

        Originally found on Xen amd64 when installing i386 tree into
        domU image.

        Here is the output from crash:

# ps l
UID PID PPID  CPU PRI NI  VSZ  RSS WCHAN    STAT TTY      TIME COMMAND
  0 316  365    0  85  0 2544 2240 pause    S    tty00 0:00.06 -tcsh
  0 365    1    0  85  0 6336 2672 wait     Is   tty00 0:00.07 login
  0 379  316 2048  85  0 3188  992 pager_ma D    tty00 0:00.27 dd if=/dev/zero
  0 401  316 1024  43  0 3196 1104 -        O+   tty00 0:00.00 ps -l
# crash
Crash version 5.99.59, image version 5.99.59.
Output from a running system is unreliable.
crash> ps/l
PID    LID S CPU     FLAGS       STRUCT LWP *               NAME WAIT
402  >   1 7   1         0           cbcc62c0              crash
379      1 3   0         0           cbcc6d40                 dd pager_map
316      1 3   0        80           cbcc6aa0               tcsh pause
365      1 3   1        80           cbbcc000              login wait
335      1 3   0        80           cbd322a0               sshd select
295      1 3   1        80           cbd32000             powerd kqueue
287      1 3   0        80           cbd32540               ntpd pause
153      1 3   1        80           cbd32d20            syslogd kqueue
1        1 3   1        80           cbbccd20               init wait
0       54 3   1       200           cbcc6800               vnd0 pager_map
0       53 3   1       200           cbd32a80            physiod physiod
0       52 3   0       200           cbbcc2a0           aiodoned aiodoned
0       51 3   1       200           cbbcc7e0            ioflush tstile
0       50 3   1       200           cbbcc540           pgdaemon pgdaemon
0       47 3   1       200           cbbc0d40          cryptoret crypto_w
0       45 3   1       200           caafe000               usb4 usbevt
0       44 3   1       200           caafe2a0               usb3 usbevt
0       43 3   1       200           caafe540               usb2 usbevt
0       42 3   1       200           caafe7e0               usb1 usbevt
0       41 3   1       200           cbbcca80         usbtask-dr usbtsk
0       40 3   1       200           cbbc0aa0         usbtask-hc usbtsk
0       39 3   1       200           cbbc0800               usb0 usbevt
0       38 3   1       200           cbbc0020              unpgc unpgc
0       37 3   1       200           cbbc0560        vmem_rehash vmem_rehash
0       36 3   1       200           cbbc02c0          coretemp0 coretemp0
0       27 3   1       200           caafea80               iic0 iicintr
0       26 3   1       200           caafed20            atabus2 atath
0       25 3   0       200           caafa020            atabus1 atath
0       24 3   0       200           caafa2c0            atabus0 atath
0       23 3   0       200           caafa560               apm0 apmev
0       22 3   1       200           caafa800            xcall/1 xcall
0       21 1   1       200           caafaaa0          softser/1
0       20 1   1       200           caafad40          softclk/1
0       19 1   1       200           caaf6000          softbio/1
0       18 1   1       200           caaf62a0          softnet/1
0       17 1   1       201           caaf6540             idle/1
0       16 3   0       200           caaf67e0             sysmon smtaskq
0       15 3   0       200           caaf6a80         pmfsuspend pmfsuspend
0       14 3   0       200           caaf6d20           pmfevent pmfevent
0       13 3   0       200           caaf2020         sopendfree sopendfr
0       12 3   0       200           caaf22c0           nfssilly nfssilly
0       11 3   1       200           caaf2560            cachegc cachegc
0       10 3   0       200           caaf2800              vrele vrele
0        9 3   0       200           caaf2aa0             vdrain vdrain
0        8 3   0       200           caaf2d40          modunload mod_unld
0        7 3   0       200           caaf0000            xcall/0 xcall
0        6 1   0       200           caaf02a0          softser/0
0        5 1   0       200           caaf0540          softclk/0
0        4 1   0       200           caaf07e0          softbio/0
0        3 1   0       200           caaf0a80          softnet/0
0    >   2 7   0       201           caaf0d20             idle/0
0        1 3   1       200           c0c86140            swapper uvm
crash> bt/al cbcc6d40   <-- lwp of dd
trace: pid 379 lid 1 at 0xcbcb771c
sleepq_block(0,0,c0c029dd,c0c86e48,cc1cda70,4,c111ad84,64f1001,18650,caaefd40)
at c054f8cf
mtsleep(c17ebe00,204,c0c029dd,0,c0d09804,ffffffff,0,4040000,cc1c73c0,1)
at c0552713
uvm_pagermapin(cbcb795c,10,1,6776001,10,f,f,cbcb799c,c193f630,0) at c08a6449
genfs_gop_write(cc1cda58,cbcb795c,10,21,cbcb7960,13,18650,cc1cda58,cc1cda58,3)
at c0337a5b
genfs_do_putpages(cc1cda58,3360000,0,3370000,0,21,0,c08ac465,cc1c73c0,6)
at c03375de
genfs_putpages(cbcb7a18,6,4000,0,cb424000,0,4,3370000,336c000,c0b4a2fc)
at c0337a29
VOP_PUTPAGES(cc1cda58,3360000,0,3370000,0,21,caaec000,1,cbba8000,cbfd90b4)
at c08e5015
ffs_write(cbcb7b80,cc1cda58,cbcb7b9c,c08c5be7,cc1cda58,cbcb0030,cbcb7b8c,c05372ba,caaefd00,2a)
at c030eda9
VOP_WRITE(cc1cda58,cbcb7c20,10,caaec000,0,0,0,8000,caaefd00,0) at c08e419e
vn_write(cbbd8600,cbbd8600,cbcb7c20,caaec000,1,cbbcc2a0,0,cbcc6d40,cbcb7c2c,cbcb7cf4)
at c08c6818
dofilewrite(4,cbbd8600,bb903000,8000,cbbd8600,1,cbcb7d1c,cbcc6d40,cbcc6d40,cbcb7d48)
at c07bce8b
sys_write(cbcc6d40,cbcb7cf4,cbcb7d1c,0,c0680a31,cbbcae94,cbcc6d40,cbbcae0c,c0680a31,cbbca83c)
at c07bcfb7
syscall(cbcb7d48,bbbb00b3,ab,bfbf001f,bbbb001f,bb903000,804d400,bfbfec98,bfbfec70,4)
at c07c941d
crash> bt/al cbcc6800   <- lwp of vnd0 thread
trace: pid 0 lid 54 at 0xcbce592c
sleepq_block(0,0,c0c029dd,c0c86e48,cc1cdf40,cbce596c,cbce59ac,c068331e,c111b18c,caaefc00)
at c054f8cf
mtsleep(c17ebe00,204,c0c029dd,0,c0d09804,ffffffff,0,4040000,cc1cdf28,1)
at c0552713
uvm_pagermapin(cbce5b6c,c,1,6778001,10,b,f,cbce5b9c,c18dad48,0) at c08a6449
genfs_gop_write(cc1cdf28,cbce5b6c,c,1b,cbce5b70,13,cbce5a7c,c08c2b5d,0,cc1c991c)
at c0337a5b
genfs_do_putpages(cc1cdf28,0,0,0,0,1b,0,cc1c4f00,1,0) at c0337295
genfs_putpages(cbce5c28,ffffffff,cbce5c1c,cbce5c2c,1,b33c000,0,0,1,c0b4a2fc)
at c0337a29
VOP_PUTPAGES(cc1cdf28,0,0,0,0,1b,1,1,cc1c4f00,cbce5d0c) at c08e5015
vndthread(cbce1300,e63000,e6c000,0,c0100307,0,0,0,0,0) at c08e347b
crash>

>How-To-Repeat:
        1. make a sparse 1 giga byte file
           (using tar, rsync -S, truncate(1) (from FreeBSD), i used truncate
           e.g. truncate -s1g imgfile)
        2. vnconfig -cv vnd0 sparse-file
        3. newfs -O2 /dev/rvnd0a
        4. mount /dev/vnd0a /mnt
        5. dd if=/dev/zero bs=32k of=/mnt/foo &
        6. ps l
>Fix:
        Not known.
        To avoid this problem please vnconfig non-sparse file.



Home | Main Index | Thread Index | Old Index