lkml.org 
[lkml]   [2003]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] fat_access cleanup (6/11)
From
Date
First, this reads ->free_clusters without lock_fat() in fat_statfs().


fs/fat/inode.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)

diff -puN fs/fat/inode.c~fat_access-cleanup3 fs/fat/inode.c
--- linux-2.6.0-test1/fs/fat/inode.c~fat_access-cleanup3 2003-07-21 02:48:21.000000000 +0900
+++ linux-2.6.0-test1-hirofumi/fs/fat/inode.c 2003-07-21 02:48:21.000000000 +0900
@@ -1024,19 +1024,23 @@ out_fail:

int fat_statfs(struct super_block *sb, struct kstatfs *buf)
{
- int free,nr;
+ int free, nr;

- lock_fat(sb);
if (MSDOS_SB(sb)->free_clusters != -1)
free = MSDOS_SB(sb)->free_clusters;
else {
- free = 0;
- for (nr = 2; nr < MSDOS_SB(sb)->clusters + 2; nr++)
- if (fat_access(sb, nr, -1) == FAT_ENT_FREE)
- free++;
- MSDOS_SB(sb)->free_clusters = free;
+ lock_fat(sb);
+ if (MSDOS_SB(sb)->free_clusters != -1)
+ free = MSDOS_SB(sb)->free_clusters;
+ else {
+ free = 0;
+ for (nr = 2; nr < MSDOS_SB(sb)->clusters + 2; nr++)
+ if (fat_access(sb, nr, -1) == FAT_ENT_FREE)
+ free++;
+ MSDOS_SB(sb)->free_clusters = free;
+ }
+ unlock_fat(sb);
}
- unlock_fat(sb);

buf->f_type = sb->s_magic;
buf->f_bsize = 1 << MSDOS_SB(sb)->cluster_bits;
_

--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.085 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site