Re: Fio could damage some disk/partitions already used

From: Jens Axboe <jens.axboe_at_oracle.com>
Date: Thu, 19 Jul 2007 14:55:04 +0200

On Thu, Jul 19 2007, Erwan Velu wrote:
> Hey folks,
>
> I've been doing a read test on a partition I have on my laptop.
> I tried to do a read test on a swap partition which is already used by the
> kernel.
>
> Stracing fio shows me :
> open("/dev/sda5", O_RDONLY|O_DIRECT|O_LARGEFILE) = 6
>
> I thought "what could append in Write mode"...
>
> Here come a scenario I did :
>
> [root_at_r1 tmp]# mkfs.ext3 /dev/sda8
> mke2fs 1.39 (29-May-2006)
> Étiquette de système de fichiers=
> Type de système d'exploitation : Linux
> Taille de bloc=4096 (log=2)
> Taille de fragment=4096 (log=2)
> 772608 i-noeuds, 1544122 blocs
> 77206 blocs (5.00%) réservés pour le super utilisateur
> Premier bloc de données=0
> Nombre maximum de blocs du système de fichiers=1581252608
> 48 groupes de blocs
> 32768 blocs par groupe, 32768 fragments par groupe
> 16096 i-noeuds par groupe
> Superblocs de secours stockés sur les blocs :
> 32768, 98304, 163840, 229376, 294912, 819200, 884736
>
> Écriture des tables d'i-noeuds : complété Création du
> journal (32768 blocs) : complété
> Écriture des superblocs et de l'information de comptabilité du système de
> fichiers :
> complété
>
> Le système de fichiers sera automatiquement vérifié tous les 31 montages ou
> après 180 jours, selon la première éventualité. Utiliser tune2fs -c ou -i
> pour écraser la valeur.
> [root_at_r1 tmp]#
> [root_at_r1 tmp]# mount /dev/sda8 /mnt/titi/
> [root_at_r1 tmp]# fio /home/erwan/fio/asimplejob.fio
> job1: (g=0): rw=read, bs=16K-16K/16K-16K, ioengine=sync, iodepth=1
> job2: (g=0): rw=write, bs=128K-128K/128K-128K, ioengine=sync, iodepth=1
> Starting 2 processes
> fio: pid=2713, err=5/file:engines/sync.c:55, func=xfer, error=Input/output
> error
>
> job1: (groupid=0, jobs=1): err= 0: pid=2712
> Description : ["Read Seq 16k O/Direct"]
> read : io=16384KiB, bw=20020KiB/s, iops=1221, runt= 838msec
> clat (usec): min= 289, max=48804, avg=814.17, stdev=2882.50
> bw (KiB/s) : min=17686, max=17686, per=88.34%, avg=17686.00, stdev=-1.00
> cpu : usr=0.00%, sys=0.95%, ctx=1028
> IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%,
> >=64=0.0%
> issued r/w: total=1024/0, short=0/0
> lat (usec): 500=91.11%, 750=3.12%, 1000=0.10% lat (msec): 2=1.27%,
> 4=3.03%, 10=0.49%, 20=0.49%, 50=0.39%
>
> Run status group 0 (all jobs):
> READ: io=16384KiB, aggrb=20020KiB/s, minb=20020KiB/s, maxb=20020KiB/s,
> mint=838msec, maxt=838msec
>
> Disk stats (read/write):
> sda: ios=1066/1, merge=23/0, ticks=2124/20, in_queue=2104, util=100.00%
>
> [root_at_r1 tmp]# umount /mnt/titi/
> [root_at_r1 tmp]# umount /mnt/titi/ [root_at_r1 tmp]# mount /dev/sda8
> /mnt/titi/
> mount: type erroné de système de fichiers, option erronée, super bloc
> erroné sur /dev/sda8,
> codepage manquante ou autre erreur
> Dans quelques cas certaines informations sont utiles dans syslog -
> essayez
> dmesg | tail ou quelque chose du genre
>
> [root_at_r1 tmp]#
>
> It looks like fio didn't checked that the partition was already used and
> destroy it. If the user make a typo in its job file, he could wipe its
> system :/
> Can adding an open O_EXCL could prevent such behaviour (I mean only when we
> do some writing) ?

Not much I can do about that... O_EXCL doesn't really help very much, as
it only applies to others that use O_EXCL. And you really do want
several fio jobs to access a raw partition as well, so it would rule out
some interesting tests.

-- 
Jens Axboe
Received on Thu Jul 19 2007 - 14:55:04 CEST

This archive was generated by hypermail 2.2.0 : Thu Jul 19 2007 - 15:00:01 CEST