2008-02-20 11:41:05     Remove a mounted usb stick (bf537 + ISP1160)

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-02-20 11:41:05     Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51365    Hi all,

 

Here is what I want to do :

 

- When an usb stick is inserted, automaticaly mount it

- When an usb stick is mounted, automaticaly play every mp3 file found

- When an usb stick is mounted, automaticaly display all jpeg file found

- When the usb stick is removed, automaticaly umount it

 

Here is what I done :

 

- A script which detect when key is inserted removed, and mount it / umount it

- A script which search every mp3 file in the usb stick and play it in loop

- A script which search every jpeg file in the usb stick and display it in loop

 

Here is my script which automatically mount/umount the key :

 

 

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

 

    #!/bin/sh

    #

    # Automatic mount/umount of the usb key

    #

 

    while true

    do

 

    # Sleep some time

    sleep 1

 

    # Umount the key by security

    umount /dev/sda1 > /dev/null 2>&1

 

    # Try to mount the key until a key is inserted

    mount -t vfat /dev/sda1 /mnt/ > /dev/null 2>&1

    if [ $? -ne 0 ]

    then

    continue

    fi

 

    echo "Key mounted"

 

    # Wait for key remove

 

    while true

    do

    sleep 1

    ls /mnt/* > /dev/null 2>&1

    if [ $? -ne 0 ]

    then

    break

    fi

    done

 

    # Key removed, umount it

 

    umount /dev/sda1 > /dev/null 2>&1

    echo "Key umounted"

 

    done

 

 

The problem is that sometime, a kernel error occur and the script is killed

Here is a log of some insert / remove of the key :

 

root:~> ./salonusb.sh

 

usb 1-1: new full speed USB device using isp116x-hcd and address 7

usb 1-1: configuration #1 chosen from 1 choice

scsi5 : SCSI emulation for USB Mass Storage devices

scsi 5:0:0:0: Direct-Access     USB007   mini-USB2TX      100  PQ: 0 ANSI: 2

sd 5:0:0:0: [sda] 253184 512-byte hardware sectors (130 MB)

sd 5:0:0:0: [sda] Write Protect is off

sd 5:0:0:0: [sda] Assuming drive cache: write through

sd 5:0:0:0: [sda] 253184 512-byte hardware sectors (130 MB)

sd 5:0:0:0: [sda] Write Protect is off

sd 5:0:0:0: [sda] Assuming drive cache: write through

sda: sda1

sd 5:0:0:0: [sda] Attached SCSI removable disk

 

Key mounted

 

usb 1-1: USB disconnect, address 7

scsi 5:0:0:0: rejecting I/O to dead device

FAT: Directory bread(block 545) failed

[.......]

scsi 5:0:0:0: rejecting I/O to dead device

FAT: Directory bread(block 576) failed

 

Key umounted

 

usb 1-1: new full speed USB device using isp116x-hcd and address 8

usb 1-1: configuration #1 chosen from 1 choice

scsi6 : SCSI emulation for USB Mass Storage devices

scsi 6:0:0:0: Direct-Access     USB007   mini-USB2TX      100  PQ: 0 ANSI: 2

sd 6:0:0:0: [sda] 253184 512-byte hardware sectors (130 MB)

sd 6:0:0:0: [sda] Write Protect is off

sd 6:0:0:0: [sda] Assuming drive cache: write through

sd 6:0:0:0: [sda] 253184 512-byte hardware sectors (130 MB)

sd 6:0:0:0: [sda] Write Protect is off

sd 6:0:0:0: [sda] Assuming drive cache: write through

sda: sda1

sd 6:0:0:0: [sda] Attached SCSI removable disk

 

Key mounted

 

usb 1-1: USB disconnect, address 8

scsi 6:0:0:0: rejecting I/O to dead device

FAT: Directory bread(block 545) failed

[.......]

scsi 6:0:0:0: rejecting I/O to dead device

FAT: Directory bread(block 576) failed

 

Data access CPLB miss

- Used by the MMU to signal a CPLB miss on a data access.

Defered Exception context

CURRENT PROCESS:

COMM=salonusb.sh PID=1075

TEXT = 0x00780040-0x007d1880  DATA = 0x007d1884-0x007e7b64

BSS = 0x007e7b64-0x007ef1a4   USER-STACK = 0x007f6f6c

 

return address: [0x007c16be]; contents of:

0x007c1690:  007e  e100  2978  e3fe  4379  6de6  6d26  0127

0x007c16a0:  6000  05bd  0010  e140  007e  300a  e100  296c

0x007c16b0:  e3fe  436c  2fcc  0000  3211  2002  6c0a [9911]

0x007c16c0:  0c01  1805  0801  17fb  6008  0010  6000  0010

 

SEQUENCER STATUS:

SEQSTAT: 00060026  IPEND: 0030  SYSCFG: 0006

  HWERRCAUSE: 0x18

  EXCAUSE   : 0x26

RETE: <0x00000000> /* Maybe null pointer? */

RETN: <0x001d8000> /* unknown address */

RETX: <0x007c16be> [ salonusb.sh + 0x4167e ]

RETS: <0x007c16ea> [ salonusb.sh + 0x416aa ]

PC  : <0x007c16be> [ salonusb.sh + 0x4167e ]

DCPLB_FAULT_ADDR: <0x65757274> /* unknown address */

ICPLB_FAULT_ADDR: <0x007c16be> [ salonusb.sh + 0x4167e ]

 

PROCESSOR STATE:

R0 : 00000024    R1 : 65757274    R2 : 00000017    R3 : 006211f4

R4 : 00000001    R5 : 007ed4ec    R6 : 0062014c    R7 : 65757274

P0 : 00620d44    P1 : 000002bc    P2 : 65757274    P3 : 007e7548

P4 : 007ed6be    P5 : 007e2ce8    FP : 007f6078    SP : 001d7f24

LB0: 0078017d    LT0: 00780170    LC0: 00000000

LB1: 007c4a43    LT1: 007c4a42    LC1: 00000000

B0 : 00000000    L0 : 00000000    M0 : 00000000    I0 : 007e7560

B1 : 00000000    L1 : 00000000    M1 : 00000000    I1 : 00621225

B2 : 00000000    L2 : 00000000    M2 : 00000000    I2 : 00000000

B3 : 00000000    L3 : 00000000    M3 : 00000000    I3 : 00000000

A0.w: 00000000   A0.x: 00000000   A1.w: 00000000   A1.x: 00000000

USP : 007f5da4  ASTAT: 02003004

 

No trace since you do not have CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled

 

Stack from 001d7f08:

        ffa00aec ffa00918 0018878c 0018878c 00000000 00000544 00201af4 007c16be

        00000030 00060026 00000000 001d8000 007c16be 007c16be 007c16ea 00000024

        02003004 007c4a43 0078017d 007c4a42 00780170 00000000 00000000 00000000

        00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

        00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

        00000000 00621225 007e7560 007f5da4 007f6078 007e2ce8 007ed6be 007e7548

 

Call Trace:

 

Bus error

root:~>

 

 

Anyone know how I can correct that, or use another method to do what I want to do ?

 

Regards,

Cyril HAENEL

 

 

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-02-20 12:21:58     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51373    msh has a memory leak when using "continue" inside of a while

 

but instead of writing a long running script, why not use hotplug ?

http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:hotplug

QuoteReplyEditDelete

 

 

2008-02-20 13:02:42     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51377    Yes it's an idea for hotplug, but I already have something called :

root:~> cat /proc/sys/kernel/hotplug

/bin/mdev

 

I can replace /bin/mdev by my own script without problem ?

 

But do you think it will solve my problem ? In other word, do you think the problem only come from the msh memory leak ?

 

Regards,

Cyril

TranslateQuoteReplyEditDelete

 

 

2008-02-20 13:09:29     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51378    I tryed manually :

 

mount the key --> mp3play --> remove the key

 

When mp3play needs data, I have some "scsi 3:0:0:0: rejecting I/O to dead device", and mp3play stop

 

So I umount the key, it's OK

 

I tryed 10 times, there is no error

 

Thus I hope it will be OK too with an hotplug script, I try to write it !

TranslateQuoteReplyEditDelete

 

 

2008-02-20 13:10:44     Re: Remove a mounted usb stick (bf537 + ISP1160)

Robin Getz (UNITED STATES)

Message: 51379    Mike:

 

Even if msh has a memory leak, and this is a bad idea (hotplug is what Cyril should be doing), I don't understand why this would give a Data access CPLB miss - not a OOM?

 

Cyril:

 

Two things - Can you enable CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE and see it crash again? And look at the hotplug that Mike pointed to?

 

Thanks

-Robin

QuoteReplyEditDelete

 

 

2008-02-20 13:13:04     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51380    you could add to the first line of your script:

/bin/mdev

and you'd retain functionality

 

i think the problem is the long running loop causes msh to crash ... by using hotplug, you dont have a loop, it only gets executed as needed ... so it's better on resources as well

 

the other option is that mdev allows you to execute scripts on a per-device basis ... i'll add that to the documentation

QuoteReplyEditDelete

 

 

2008-02-20 13:25:04     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51382    Mike, I agree for hotplug, it's better.

 

As I say, when I try manually, I have no crashes when I remove the mounted usb key, even if mp3play try to read data on it.

 

So now I am trying hotplug but it doesn't work

 

I done :

 

root:~>echo /salonusb.sh > /proc/sys/kernel/hotplug

root:~> cat /proc/sys/kernel/hotplug

/salonusb.sh

 

 

My script is present and with +x mode

 

My script is :

 

#!/bin/sh

echo "Hotplug Script"

 

But it not not called when I plug/unplug the key. hotplug support is selected in the kernel yet.

 

Any idea ?

 

Regards

TranslateQuoteReplyEditDelete

 

 

2008-02-20 14:03:11     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51386    please review the documentation about standard output

QuoteReplyEditDelete

 

 

2008-02-20 15:30:09     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51393    Sorry I have read to rapidly the hotplug explanation page....

TranslateQuoteReplyEditDelete

 

 

2008-02-21 04:17:06     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51412    This mornig I modified my script :

 

    #!/bin/sh

 

    output=/dev/ttyBF0

 

    /bin/mdev > $output

 

    echo "Hotplug Script" > $output

 

It works, the script is called when I insert/remove the key. But the script is called a lot of time !!!

 

When I insert the key :

 

    root:~> usb 1-1: new full speed USB device using isp116x-hcd and address 5

    usb 1-1: configuration #1 chosen from 1 choice

    scsi3 : SCSI emulation for USB Mass Storage devices

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    scsi 3:0:0:0: Direct-Access              USB 2.0          PMAP PQ: 0 ANSI: 0 CCS

    Hotplug Script

    Hotplug Script

    sd 3:0:0:0: [sda] 2014720 512-byte hardware sectors (1032 MB)

    sd 3:0:0:0: [sda] Write Protect is off

    sd 3:0:0:0: [sda] Assuming drive cache: write through

    sd 3:0:0:0: [sda] 2014720 512-byte hardware sectors (1032 MB)

    sd 3:0:0:0: [sda] Write Protect is off

    sd 3:0:0:0: [sda] Assuming drive cache: write through

     sda: sda1

    sd 3:0:0:0: [sda] Attached SCSI removable disk

    Hotplug Script

    Hotplug Script

    Hotplug Script

 

 

When I remove the key :

 

    root:~> usb 1-1: USB disconnect, address 5

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

    Hotplug Script

 

Now I try to get environnement variable to try to detect what happen and do the good thing (mount the key and launch my mp3 and jpeg script, or kill my mp3 and jpeg script and umount the key)

TranslateQuoteReplyEditDelete

 

 

2008-02-21 05:50:33     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51426    Great !

 

I tested this as hotplug script :

 

    #!/bin/sh

 

    /bin/mdev

 

    # Define where to put the output message

 

    output=/dev/ttyBF0

 

    # We only manage sda1 events

 

    echo $DEVPATH | grep sda1

    if [ $? -ne 0 ]

    then

    exit 0

    fi

 

    echo "Hotplug Script begin" > $output

 

    # If key inserted, mount it and play one mp3 file

 

    if [ $ACTION = "add" ]

    then

    mount -t vfat /dev/sda1 /mnt

    echo "Key mounted" > $output

    mp3play "/mnt/file1.mp3"

    fi

 

    # If key removed, umount it

    if [ $ACTION = "remove" ]

    then

    killall mp3play

    umount /dev/sda1

    echo "Key unmounted" > $output

    fi

 

    echo "Hotplug Script end" > $output

 

For now it works well, no crash when I insert/remove the key, even if mp3play is working !

 

Next step, launch 2 externals scripts which play every mp3 of the key in loop, and display every jpeg in the key in loop

TranslateQuoteReplyEditDelete

 

 

2008-02-21 08:13:29     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51429    you could set your mdev.conf to read something like:

sda1 0:0 660 */your-hotplug.sh

 

and then mdev would execute your script upon addition/removal

QuoteReplyEditDelete

 

 

2008-02-21 09:21:16     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51431    Yes, I saw that in the mdev doc.

 

But call directly my script works (and I call /bin/mdev at rhe beginning of my script).

But now I have another problem

 

Here is my script to read mp3 in loop :

 

    #!/bin/sh

    #

    # Play in loop MP3 files from usb key

    #

 

    echo "MP3 playing script"

 

    # Set volume

 

    mixer pcm 70 > /dev/null 2>&1

    mixer vol 5 > /dev/null 2>&1

 

    while true do

 

    find /mnt/ -name "*.mp3" | while read mp3file

    do

    mp3play "$mp3file"

    done

 

    done

 

This script is called in background in my hotplug script, juste after the key is mounted.

But after one complete loop it crashed, when launching a new mp3 (and my mp3 script stopped) :

 

    /mnt/cd10/file10.mp3: MPEG1-III (355125 ms)

    true: page allocation failure. order:7, mode:0x40d0

    Stack from 033b3d18:

            033b3d24 0002a906 000040d0 00e24e8c 00000007 000040d0 00000000 0018ba18

            00000000 000240d0 033b2000 00000000 00000000 00000077 0002a9d6 00077000

            00077000 001b66e0 00000000 00000002 00000000 00000000 00030502 00077000

            0018ba14 00030736 033b2000 00000000 035fd594 033b3e8c 02967548 00000004

            ffa019c0 033ed3c0 00000000 00000000 033b4000 00051880 000585ea 00000005

            00007640 0064b000 033b2000 000769fc 00000000 000162e0 0064b000 00000184

 

    Call Trace:

    [<0001fee8>] _futex_lock_pi+0x1fc/0x83c

    [<00003ba6>] _show_interrupts+0x9a/0xc4

    [............]

 

I done a cat /proc/meminfo, and mem free was close to 0.

I have unmounted the key and mem free became OK : ~45Mo

 

Is there another memory leak in my script ??

How can I do what I want to do if I cannot do a while loop in a script ?

 

Regards,

Cyril

TranslateQuoteReplyEditDelete

 

 

2008-02-21 13:25:32     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51434    you would have to look at the cache files and the maps (/proc/maps) to see who is taking up what memory

 

my guess is the hard drive page cache is sucking up the free pages and when you unmount the drive, all those pages get freed up

 

you could also double check by doing:

echo 3 > /proc/sys/vm/drop_caches

QuoteReplyEditDelete

 

 

2008-02-21 15:59:20     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51449    I changed the way to play mp3 to display jpeg in loop :

 

mp3play have the -R option, to play in loop all the files.

 

So related code is :

 

    find /mnt/ -name  "*.mp3" | while read file

    do

    list=$list' '$file

    done

    mp3play -R $list

 

 

To do the same thing with jpegview, I modified the source to add a -l option (loop).

 

Thus related code become :

 

    find /mnt/ -name  "*.jpg" | while read file

    do

    list=$list' '$file

    done

    jpegview -s3 -l $list > /dev/null

 

 

But I seen some strange things :

- When my key is mounted with -t vfat option, these codes doesn't work because files can have space in their name

(if somebody knows how to do I am interrested !)

- When my hotplug script directly implements these 10 lines of code in the "add" section (just after I mount the key, and mp3Play and jpegview launched in background with the & symbol), It crashes after some images are displayed. A misaligned access appear, I don't undesrtand why, and some curious thing appear at screen just before the crash.

 

Thus the only solution I have found which "works" (for now...), it's to have these 2x 5 lines of code in independants files : mp3.sh and jpeg.sh, and these scripts called by my hotplug script :

 

 

    # Call mdev

    /bin/mdev

 

    # Define where to put the output message

    output=/dev/ttyBF0

 

    # We only manage sda1 events

    echo $DEVPATH | grep sda1

    if [ $? -ne 0 ]

    then

    exit 0

    fi

 

    echo "Hotplug Script begin" > $output

 

    # If key inserted, mount it and launch mp3 playing + jpeg view

    if [ $ACTION = "add" ]

    then

    mount /dev/sda1 /mnt

    #mount -t vfat /dev/sda1 /mnt

    echo "Key mounted" > $output

    /mp3.sh > $output 2>&1 &

    /jpeg.sh > $output 2>&1 &

    fi

 

    # If key removed, kill jpegview and mp3play and umount the key

    if [ $ACTION = "remove" ]

    then

    killall mp3.sh

    killall mp3play

    killall jpg.sh

    killall jpegview

    umount /dev/sda1

    echo "Key unmounted" > $output

    fi

 

    echo "Hotplug Script end" > $output

 

For now it works but I am afraid to see tomorrow morning a new crash (because I have not power off the board before go at home this evening...).

Remove/insert the key works well, it's sure, I tryed this a lot of time before go at home. But I am not sure for long time running. Now I have no loop in my scripts, so I think I cannot have memory leak in my scripts.

 

I will tell you tomorrow morning what happened during this night...

 

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-02-21 16:42:17     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51451    i dont know why you use `find|while read` to accumulate things into a variable that you just turn around and pass as a flat argument ... you'd get the same exact behavior by doing:

mp3play -R $(find /mnt -name '*.mp3')

 

this too would have quoting problems ... the only way to solve is either write your own C code, or change with with xargs:

find /mnt -name '*.mp3' -print0 | xargs -r -0 mp3play -R

 

but this will break down as soon as the number of mp3s exceeds a certain amount as you can no longer pass it via the command line (as it typically has a limit of like 32k characters) and so xargs will break it up into multiple mp3play calls which breaks with the way you have architected things

 

which gets back to the only real option is write your own C application or reuse an existing one (like mpd)

 

(and for the record, none of these issues are Blackfin issues ... you'd hit the same exact problems on your desktop)

QuoteReplyEditDelete

 

 

2008-02-21 17:47:14     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51455    Mike, I am a beginner in shell programming !

It's why some things I do are surely not the best method.

 

Tomorrow I will try the mp3play -R $(find /mnt -name '*.mp3') command

 

I don't undertand your last comment :

 

(and for the record, none of these issues are Blackfin issues ... you'd hit the same exact problems on your desktop)

 

What do you mean by "record", and which issue I had (I had multiple issues!!!) will be the same problem on my desktop ?

 

Regards,

Cyril

TranslateQuoteReplyEditDelete

 

 

2008-02-21 17:55:32     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51457    i'm referring to requoting problems with programming in shell ... bash on your desktop would have the same exact problems with handling spaces and such characters, as well as have commandline length limitations

QuoteReplyEditDelete

 

 

2008-02-21 19:35:11     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51464    Oh yes, I was almost sure about that !!

TranslateQuoteReplyEditDelete

 

 

2008-02-22 05:16:43     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51498    Hi all, this morning I was afraid to open the door of my office and see a crashed board. But it was still working ! My hollidays photos was still displayed on the LQ043 screen and mp3play was still playing...

 

Good news after 3 days to do this simple task !!

 

Thus it's clear there is a big problem with while loops (even without "continue") in shell scripts.

 

With the -R option of mp3play and -l option (added by me) of jpegview, thus it's seem's to be OK. After a moment memory free go under 2Mo, but a big quantity of this memory is cached and is probably released when someone need mem, for example when mp3play open a new mp3.

 

Now I try to delete my loop to build the flat list of mp3 and jpeg file.

TranslateQuoteReplyEditDelete

 

 

2008-02-22 05:43:27     Re: Remove a mounted usb stick (bf537 + ISP1160)

Cyril HAENEL (FRANCE)

Message: 51499    :((((((((((

 

I see another problem

 

When memory free is close to 0 (and a big memory quantity is cached), when I remove the stick there is a crash, because my hotplug script is called, and sh probably try to allocate memory.

 

Because the hotplug script is called multiple time, and memory cache seems to be freeied at a moment, the last time the hotplug script is called it works, the key is correctly umounted, and the next key insertion and auto playing still works.

 

If a big quantity of memory is cached, why the kernel don't release some pages for sh when it want to allocate some memory ?

To fix that problem, do you think it can be possible to dedicate a part of the memory as Swap, to not have all the memory cached after a moment ?

 

The log :

 

After a moment of working :

 

    root:~> cat /proc/meminfo

    MemTotal:        55060 kB

    MemFree:          1244 kB

    Buffers:             8 kB

    Cached:          47780 kB

    SwapCached:          0 kB

    Active:           2524 kB

    Inactive:        45264 kB

    SwapTotal:           0 kB

    SwapFree:            0 kB

    Dirty:               0 kB

    Writeback:           0 kB

    AnonPages:           0 kB

    Mapped:              0 kB

    Slab:             1176 kB

    SReclaimable:      420 kB

    SUnreclaim:        756 kB

    PageTables:          0 kB

    NFS_Unstable:        0 kB

    Bounce:              0 kB

    CommitLimit:     27528 kB

    Committed_AS:        0 kB

    VmallocTotal:        0 kB

    VmallocUsed:         0 kB

    VmallocChunk:        0 kB

 

I let the board do his job (messages are from mp3play ):

 

    /mnt/cd7/redhot~1.mp3: MPEG1-III (313418 ms)

    /mnt/cd7/simple~1.mp3: MPEG1-III (202827 ms)

    /mnt/cd7/spindo~1.mp3: MPEG1-III (257115 ms)

    /mnt/cd7/thecar~1.mp3: MPEG1-III (198530 ms)

    /mnt/cd7/u2-new~1.mp3: MPEG1-III (332554 ms)

    /mnt/cd7/01firs~1.mp3: MPEG1-III (245073 ms)

    /mnt/cd7/alanbr~1.mp3: MPEG1-III (293613 ms)

    /mnt/cd7/avrill~1.mp3: MPEG1-III (245551 ms)

    /mnt/cd7/cardig~1.mp3: MPEG1-III (221824 ms)

    /mnt/cd7/depech~1.mp3: MPEG1-III (240248 ms)

    /mnt/cd7/gnarls~1.mp3: MPEG1-III (181487 ms)

    /mnt/cd7/jean-l~1.mp3: MPEG1-III (222912 ms)

    /mnt/cd7/lennyk~1.mp3: MPEG1-III (236280 ms)

 

 

I verify the memory :

 

    root:~> cat /proc/meminfo

    MemTotal:        55060 kB

    MemFree:          1308 kB

    Buffers:             8 kB

    Cached:          47716 kB

    SwapCached:          0 kB

    Active:           3292 kB

    Inactive:        44432 kB

    SwapTotal:           0 kB

    SwapFree:            0 kB

    Dirty:               0 kB

    Writeback:           0 kB

    AnonPages:           0 kB

    Mapped:              0 kB

    Slab:             1176 kB

    SReclaimable:      420 kB

    SUnreclaim:        756 kB

    PageTables:          0 kB

    NFS_Unstable:        0 kB

    Bounce:              0 kB

    CommitLimit:     27528 kB

    Committed_AS:        0 kB

    VmallocTotal:        0 kB

    VmallocUsed:         0 kB

    VmallocChunk:        0 kB

 

 

I remove the key, my hotplug script is called a first time (salonusb.sh) :

 

 

    usb 1-1: USB disconnect, address 7

    salonusb.sh: page allocation failure. order:7, mode:0x40d0

    Stack from 0115dc34:

            0115dc40 0002a906 000040d0 035fa9ec 00000007 000040d0 00000000 0018ba18

            00000000 000240d0 0115c000 00000000 00000000 00000077 0002a9d6 00077000

            00077000 006786c0 00000000 00000002 00000000 00000000 00030502 00077000

            0018ba14 00030736 000769fc 00000000 000162e0 00004e20 00007640 00000004

            0115dcd0 00609fa0 00000005 0215ca54 00067b60 00051880 000585ea 00000005

            00007640 001bc400 0115c000 000769fc 00000000 000162e0 001bc400 00000000

 

    Call Trace:

    [<0001aed4>] _autoremove_wake_function+0x0/0x30

    [<0001fed0>] _futex_lock_pi+0x1e4/0x83c

    [<00003ba6>] _show_interrupts+0x9a/0xc4

    [<0000ee98>] _allow_signal+0x8/0x78

    [<0000c5cc>] _release_console_sem+0xb8/0x23c

    [<00077000>] ___reg_op+0xc/0xac

    [<000769fc>] _as_merged_requests+0x5c/0x74

    [<00067b60>] _fat_fill_super+0x228/0x9b0

    [<00004f8c>] _gpio_request+0x40/0x10c

    [<00036dd8>] _kernel_read+0x30/0x3c

    [<00036af8>] _search_binary_handler+0x6c/0x12c

    [<0005628c>] _load_script+0x1b8/0x1c8

    [<00036af8>] _search_binary_handler+0x6c/0x12c

    [<00036af8>] _search_binary_handler+0x6c/0x12c

    [<00037f54>] _do_execve+0xe8/0x1bc

    [<00017b0e>] _____call_usermodehelper+0xb2/0xc0

    [<00001686>] _kernel_thread_helper+0x6/0xc

 

    Mem-info:

    DMA per-cpu:

    CPU    0: Hot: hi:   18, btch:   3 usd:   2   Cold: hi:    6, btch:   1 usd:   5

    Active:825 inactive:11010 dirty:0 writeback:0 unstable:0

     free:419 slab:296 mapped:0 pagetables:0 bounce:0

    DMA free:1676kB min:952kB low:1188kB high:1428kB active:3300kB inactive:44040kB present:56896kB pages_scanned:0 all_unreclaimable? no

    lowmem_reserve[]: 0 0

    DMA: 3*4kB 4*8kB 8*16kB 11*32kB 8*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 1676kB

    14335 pages of RAM

    456 free pages

    570 reserved pages

    2 pages shared

    0 pages swap cached

    Allocation of length 487424 from process 1424 failed

    DMA per-cpu:

    CPU    0: Hot: hi:   18, btch:   3 usd:   2   Cold: hi:    6, btch:   1 usd:   5

    Active:825 inactive:11010 dirty:0 writeback:0 unstable:0

     free:419 slab:296 mapped:0 pagetables:0 bounce:0

    DMA free:1676kB min:952kB low:1188kB high:1428kB active:3300kB inactive:44040kB present:56896kB pages_scanned:0 all_unreclaimable? no

    lowmem_reserve[]: 0 0

    DMA: 3*4kB 4*8kB 8*16kB 11*32kB 8*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 1676kB

    Unable to allocate RAM for process text/data, errno 12

 

 

My hotplug script is called a 2nd time ( same error) :

 

 

    salonusb.sh: page allocation failure. order:7, mode:0x40d0

    Stack from 0115fc34:

            0115fc40 0002a906 000040d0 035faeec 00000007 000040d0 00000000 0018ba18

            00000000 000240d0 0115e000 00000000 00000000 00000077 0002a9d6 00077000

            00077000 006786c0 00000000 00000002 00000000 00000000 00030502 00077000

            0018ba14 00030736 000769fc 00000000 000162e0 0115fda8 00188794 00000004

            0115fcd0 00609c00 00000005 0215c8b4 016e050c 00051880 000585ea 00000005

            00007640 001bce00 0115e000 000769fc 00000000 000162e0 001bce00 00000000

 

    Call Trace:

    [<0001aed4>] _autoremove_wake_function+0x0/0x30

    [<0001feda>] _futex_lock_pi+0x1ee/0x83c

    [<00003ba6>] _show_interrupts+0x9a/0xc4

    [<0000ee98>] _allow_signal+0x8/0x78

    [<0000c5ba>] _release_console_sem+0xa6/0x23c

    [<00032b7c>] _nameidata_to_filp+0x30/0x3c

    [<00077000>] ___reg_op+0xc/0xac

    [<000769fc>] _as_merged_requests+0x5c/0x74

    [<00067b60>] _fat_fill_super+0x228/0x9b0

    [<00004f7a>] _gpio_request+0x2e/0x10c

    [<00036dd8>] _kernel_read+0x30/0x3c

    [<00036af8>] _search_binary_handler+0x6c/0x12c

    [<0005628c>] _load_script+0x1b8/0x1c8

    [<00036af8>] _search_binary_handler+0x6c/0x12c

    [<00036af8>] _search_binary_handler+0x6c/0x12c

    [<00037f54>] _do_execve+0xe8/0x1bc

    [<00017b0e>] _____call_usermodehelper+0xb2/0xc0

    [<00001686>] _kernel_thread_helper+0x6/0xc

 

    Mem-info:

    DMA per-cpu:

    CPU    0: Hot: hi:   18, btch:   3 usd:   2   Cold: hi:    6, btch:   1 usd:   5

    Active:824 inactive:10947 dirty:0 writeback:0 unstable:0

     free:481 slab:296 mapped:0 pagetables:0 bounce:0

    DMA free:1924kB min:952kB low:1188kB high:1428kB active:3296kB inactive:43788kB present:56896kB pages_scanned:0 all_unreclaimable? no

    lowmem_reserve[]: 0 0

    DMA: 3*4kB 5*8kB 9*16kB 10*32kB 8*64kB 3*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 1924kB

    14335 pages of RAM

    519 free pages

    570 reserved pages

    2 pages shared

    0 pages swap cached

    Allocation of length 487424 from process 1425 failed

    DMA per-cpu:

    CPU    0: Hot: hi:   18, btch:   3 usd:   2   Cold: hi:    6, btch:   1 usd:   5

    Active:824 inactive:10947 dirty:0 writeback:0 unstable:0

     free:481 slab:296 mapped:0 pagetables:0 bounce:0

    DMA free:1924kB min:952kB low:1188kB high:1428kB active:3296kB inactive:43788kB present:56896kB pages_scanned:0 all_unreclaimable? no

    lowmem_reserve[]: 0 0

    DMA: 3*4kB 5*8kB 9*16kB 10*32kB 8*64kB 3*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 1924kB

    Unable to allocate RAM for process text/data, errno 12

 

 

Accesses errors on the key :

 

    scsi 5:0:0:0: rejecting I/O to dead device

    FAT: Directory bread(block 545) failed

    [.........]

    FAT: Directory bread(block 576) failed

 

 

Message from jpegviev :

 

    can't open /mnt/resize~1/imgp0545.jpg

 

 

Memory cache seem's to be freeied and my hotplug script is called a 3th time (this time it works) :

 

    Hotplug Script begin

    MP3 and JPG scripts killed

    Key unmounted

    Hotplug Script end

 

 

TranslateQuoteReplyEditDelete

 

 

2008-02-22 14:03:28     Re: Remove a mounted usb stick (bf537 + ISP1160)

Mike Frysinger (UNITED STATES)

Message: 51517    as i said, that is probably due to the page cache

 

you can either force flushing of it, or try to use the page cache ratio option

Attachments

    Outcomes