xfs
[Top] [All Lists]

file data not flushed to disk by umount?

To: linux-xfs@xxxxxxxxxxx
Subject: file data not flushed to disk by umount?
From: James Chapman <jchapman@xxxxxxxxxxx>
Date: Wed, 23 Mar 2005 10:38:21 +0000
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
I'm looking for help/advice to solve an XFS filesystem problem. It
appears that data isn't being flushed to disk by a umount. The problem
is repeatable. Details below.

I create an XFS (realtime) partition using

bash-2.05b# mkfs.xfs -f -r /dev/hdc2 /dev/hdc1

The filesystem can be mounted and new files created as
expected. However, if the filesystem is unmounted, data is not being
written to disk. The file exists but contains zeros. Shouldn't umount
flush any in-memory data to disk?

bash-2.05b# mount -t xfs -o rtdev=/dev/hdc2 /dev/hdc1 /mnt/hd
XFS mounting filesystem ide1(22,1)
bash-2.05b# echo "Hello, world" > /mnt/hd/my-file
bash-2.05b# cat /mnt/hd/my-file
Hello, world
bash-2.05b# umount /mnt/hd
bash-2.05b# mount -t xfs -o rtdev=/dev/hdc2 /dev/hdc1 /mnt/hd
XFS mounting filesystem ide1(22,1)
bash-2.05b# cat /mnt/hd/my-file
bash-2.05b# od -x /mnt/hd/my-file
0000000 0000 0000 0000 0000 0000 0000 0000
0000015
bash-2.05b# xfs_info /mnt/hd
meta-data=/mnt/hd                isize=256    agcount=8, agsize=45182 blks
         =                       sectsz=512
data     =                       bsize=4096   blocks=361454, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal               bsize=4096   blocks=2560, version=1
         =                       sectsz=512   sunit=0 blks
realtime =external extsz=65536 blocks=36788850, rtextents=2299303
bash-2.05b# umount /mnt/hd
bash-2.05b#

The unwritten=1 in the above output is interesting...

I tried doing a sync and waiting a number of minutes before doing the
umount but the same problem occurs.

Repairing the xfs partitions finds a problem with my-file.

bash-2.05b# xfs_repair -r /dev/hdc2 /dev/hdc1

Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
zero length extent (off = 0, fsbno = 0) in ino 132
bad data fork in inode 132
cleared inode 132
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - clear lost+found (if it exists) ...
        - clearing existing "lost+found" inode
        - deleting existing "lost+found" entry
        - check for inodes claiming duplicate blocks...
        - agno = 0
entry "my-file" in shortform directory 128 references free inode 132
junking entry "my-file" in directory inode 128
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
Phase 5 - rebuild AG headers and trees...
        - generate realtime summary info and bitmap...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - ensuring existence of lost+found directory
        - traversing filesystem starting at / ...
        - traversal finished ...
        - traversing all unattached subtrees ...
        - traversals finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done

The hardware platform is a custom embedded MIPS board, running kernel
2.4.25 (MIPS little endian). Ext2 and ext3 filesystems work as
expected so the hardware is ok.

I'm using xfsprogs-2.5.6 and util-linux-2.12q.

What am I doing wrong?

/james



<Prev in Thread] Current Thread [Next in Thread>