linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fat_access cleanup (6/11)
@ 2003-07-21 15:55 OGAWA Hirofumi
  0 siblings, 0 replies; only message in thread
From: OGAWA Hirofumi @ 2003-07-21 15:55 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

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>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-21 15:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-21 15:55 [PATCH] fat_access cleanup (6/11) OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).