lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 08 Jul 2008 15:55:19 -0700
From:	Mingming Cao <cmm@...ibm.com>
To:	Jan Kara <jack@...e.cz>
Cc:	Peter Staubach <staubach@...hat.com>,
	Eric Sandeen <sandeen@...hat.com>, linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: delayed allocation i_blocks fix for stat(2)


在 2008-07-08二的 22:02 +0200,Jan Kara写道:
> > Eric Sandeen wrote:
> > >Mingming Cao wrote:
> > >  
> > >>ext4: delayed allocation i_blocks fix for stat(2)
> > >>
> > >>From: Mingming Cao <cmm@...ibm.com>
> > >>
> > >>Right now i_blocks is not getting updated until the disks are actually
> > >>allocaed on disk.  This means with delayed allocation, right after files
> > >>are copied, "ls -sF" shoes the file as taking 0 blocks on disk.  "du"
> > >>also shows the files taking zero space, which is highly confusing to the 
> > >>user.
> > >>
> > >>Since current delayed allocation already keep track of per-inode total 
> > >>number
> > >>of blocks that are subject to delayed allocation, this patch fix this by 
> > >>using
> > >>that to adjust the value returned by stat(2). When real block allocation
> > >>is done, the i_blocks will get updated. Since the reserved blocks for 
> > >>delayed
> > >>allocation will be decreased, this will be keep value returned by stat(2)
> > >>consistent.
> > >>
> > >>Signed-off-by: Mingming Cao <cmm@...ibm.com>
> > >>    
> > >
> > >Thanks Mingming, looks like just the right approach.
> > >
> > >Something about the spinlock for every stat seems heavy-handed to me but
> > >I'll have to give that more thought.  :)
> > >
> > >  
> > 
> > Since i_reserved_blocks is an unsigned long, it should be possible
> > to atomically fetch it on all of the supported architectures,
> > without the use of the spinlock.  It seems to me that this spinlock
> > is not required here.
>   Well, it's certainly not nice to rely on this. The clean solution
> would be to convert i_reserved_blocks to atomic_t or atomic64_t on archs
> that have it...
> 

I was thinking about the same thing when this lock was initially
introduced ... but this lock is protecting three counters, and these
counters are updated/reset in a couple of places, and being used to
calcuate how much per-fs free blocks counter need to be accounted.  It's
doable, just need a careful look if we make them all atomic.

Mingming


> 								Honza

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ