mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fat_access cleanup (6/11)
Date: Tue, 22 Jul 2003 00:55:10 +0900	[thread overview]
Message-ID: <871xwjx4bl.fsf@devron.myhome.or.jp> (raw)

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>

                 reply	other threads:[~2003-07-21 15:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871xwjx4bl.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®