public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* df -h shows ~10 times bigger size when umounting pendrive
@ 2009-03-22  0:50 Arkadiusz Miskiewicz
  2009-03-22  6:47 ` David Newall
  0 siblings, 1 reply; 4+ messages in thread
From: Arkadiusz Miskiewicz @ 2009-03-22  0:50 UTC (permalink / raw)
  To: linux-kernel


I have 1GiB pendrive:

[ 1494.641661] scsi 4:0:0:0: Direct-Access              GOODDRIVE        1100 
PQ: 0 ANSI: 0 CCS
[ 1494.643482] sd 4:0:0:0: [sdb] 1957888 512-byte hardware sectors: (1.00 
GB/956 MiB)
[ 1494.644599] sd 4:0:0:0: [sdb] Write Protect is off
[ 1494.644604] sd 4:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 1494.644609] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 1494.647107] sd 4:0:0:0: [sdb] 1957888 512-byte hardware sectors: (1.00 
GB/956 MiB)
[ 1494.648224] sd 4:0:0:0: [sdb] Write Protect is off
[ 1494.648230] sd 4:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 1494.648234] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 1494.648241]  sdb: sdb1
[ 1494.657345] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[ 1494.657564] sd 4:0:0:0: Attached scsi generic sg2 type 0
[ 1494.658212] usb-storage: device scan complete

pendrive was mounted on /media/floppy

[arekm@t400 ~]$ df -h
System plik�w         rozm. u�yte dost. %u�. zamont. na
/dev/sda3             9,6G  4,2G  5,5G  44% /          
/dev/mapper/home      127G   52G   75G  42% /home      
tmpfs                 1,0G   28K  1,0G   1% /tmp       
none                  2,0G   12K  2,0G   1% /dev/shm   
/dev/sdb1             956M  657M  299M  69% /media/floppy

then I copied 650MB file and run umount /media/floppy

While umount was running and data were synced on the
pendrive df -h showed:

[arekm@t400 ~]$ df -h
System plik�w         rozm. u�yte dost. %u�. zamont. na
/dev/sda3             9,6G  4,2G  5,5G  44% /
/dev/mapper/home      127G   52G   75G  42% /home
tmpfs                 1,0G   28K  1,0G   1% /tmp
none                  2,0G   12K  2,0G   1% /dev/shm
/dev/sdb1             9,6G  4,2G  5,5G  44% /media/floppy


So it started to show 9.6G size when in process of umount.

Doesn't sound "normal" and correct.

[arekm@t400 ~]$ uname -a
Linux t400 2.6.29-rc8 #105 SMP Sun Mar 22 00:47:52 CET 2009 x86_64 
Intel(R)_Core(TM)2_Duo_CPU_____T9400__@_2.53GHz PLD Linux

(actually from git from about 1 hour ago)
-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: df -h shows ~10 times bigger size when umounting pendrive
  2009-03-22  0:50 df -h shows ~10 times bigger size when umounting pendrive Arkadiusz Miskiewicz
@ 2009-03-22  6:47 ` David Newall
  2009-03-22 10:25   ` Arkadiusz Miskiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: David Newall @ 2009-03-22  6:47 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: linux-kernel

Arkadiusz Miskiewicz wrote:
> While umount was running and data were synced on the
> pendrive df -h showed:
>
> [arekm@t400 ~]$ df -h
> System plik�w         rozm. u�yte dost. %u�. zamont. na
> /dev/sda3             9,6G  4,2G  5,5G  44% /
> /dev/sdb1             9,6G  4,2G  5,5G  44% /media/floppy
>   

This looks to me like a race between umount and df.  By the time df had
read mtab (to find the mounted filesystem), the pen drive had already
been unmounted; but umount hadn't yet updated mtab.  It's a pretty
trivial sort of fault, and not worth worrying about.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: df -h shows ~10 times bigger size when umounting pendrive
  2009-03-22  6:47 ` David Newall
@ 2009-03-22 10:25   ` Arkadiusz Miskiewicz
  2009-03-22 14:52     ` David Newall
  0 siblings, 1 reply; 4+ messages in thread
From: Arkadiusz Miskiewicz @ 2009-03-22 10:25 UTC (permalink / raw)
  To: David Newall; +Cc: linux-kernel

On Sunday 22 of March 2009, David Newall wrote:
> Arkadiusz Miskiewicz wrote:
> > While umount was running and data were synced on the
> > pendrive df -h showed:
> >
> > [arekm@t400 ~]$ df -h
> > System plik�w         rozm. u�yte dost. %u�. zamont. na
> > /dev/sda3             9,6G  4,2G  5,5G  44% /
> > /dev/sdb1             9,6G  4,2G  5,5G  44% /media/floppy
>
> This looks to me like a race between umount and df.  By the time df had
> read mtab (to find the mounted filesystem), the pen drive had already
> been unmounted; but umount hadn't yet updated mtab.  It's a pretty
> trivial sort of fault, and not worth worrying about.

It's not that. umounting takes more than 15 seconds (syncing 650MB of data 
takes some time) and in that ~15 seconds I reliably get such results:

/etc/mtab contains:

/dev/sdb1 /media/floppy vfat rw 0 0

statfs() returns:

statfs("/media/floppy", {f_type=0x58465342, f_bsize=4096, f_blocks=2497555, 
f_bfree=1410716, f_bavail=1410716, f_files=10000448, f_ffree=9842679, 
f_fsid={2051, 0}, f_namelen=255, f_frsize=4096}) = 0

which is:

/dev/sdb1             9,6G  4,2G  5,4G  44% /media/floppy

So why statfs() lies on a being unmounted filesystem?

-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: df -h shows ~10 times bigger size when umounting pendrive
  2009-03-22 10:25   ` Arkadiusz Miskiewicz
@ 2009-03-22 14:52     ` David Newall
  0 siblings, 0 replies; 4+ messages in thread
From: David Newall @ 2009-03-22 14:52 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: linux-kernel

Arkadiusz Miskiewicz wrote:
> /etc/mtab contains:
>
> /dev/sdb1 /media/floppy vfat rw 0 0
>
> statfs() returns:
>
> statfs("/media/floppy", {f_type=0x58465342, f_bsize=4096, f_blocks=2497555, 
> f_bfree=1410716, f_bavail=1410716, f_files=10000448, f_ffree=9842679, 
> f_fsid={2051, 0}, f_namelen=255, f_frsize=4096}) = 0
>   

The statfs(), above, is not a stat for the file system at /media/floppy,
it's a stat for the file system which *contains* /media/floppy.  If
/dev/sdb1 has been unmounted (which was in fact in occurring at the
time) the stat refers to (in your case) the root filesystem.  And look
at the returned information: 2497555 4K blocks, 1410716 of them
available; that's 9.6GB file system with 5.5GB available, same as /dev/sda3.

Truly, this is what I said it was; and it's normal, and it's reasonable.

> /dev/sdb1             9,6G  4,2G  5,4G  44% /media/floppy
>
> So why statfs() lies on a being unmounted filesystem?

There is a lie, which is that /media/floppy is on /dev/sdb1.  That
ceases to be true as soon as the umount starts.  The reason df lies is
because it trusts the mtab, which has not yet had the entry for
/dev/sdb1 removed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-22 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-22  0:50 df -h shows ~10 times bigger size when umounting pendrive Arkadiusz Miskiewicz
2009-03-22  6:47 ` David Newall
2009-03-22 10:25   ` Arkadiusz Miskiewicz
2009-03-22 14:52     ` David Newall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox