[lkml]   [2002]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] block_dev.c: fsync() on close() considered harmful
Hi Alan,

I don't see any standard specifying that fsync should be done on
every blockdevice close.

Any chance you could add the below patch to the next -ac release?


Date: Thu, 22 Nov 2001 14:34:50 +0100
From: Miquel van Smoorenburg <>
To: Andrea Arcangeli <>
Subject: [PATCH] block_dev.c: fsync() on close() considered harmful
Message-ID: <>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
X-NCC-RegID: nl.cistron

I'm running an INN usenet news server that uses raw partitions for
storage. I.e. it opens /dev/sda7 etc. and mmap()s [which finally
works in 2.4, hurray]

Even though the server is keeping those devices open, when a utility
program (sm) opens that file/device and closes() it the close() causes
a fsync() on the device, something that is not wanted.

I applied the following patch which fixes it for me, it prevents
the sync-after-close if it was close() calling blkdev_put()
and we're not the last one to call blkdev_put().

That means fsync() will still be done on unmounts or when the
last user of the device closes it, but not otherwise.

Is this correct or am I overlooking something?

--- linux-2.4.15-pre8/fs/block_dev.c.orig Thu Oct 25 22:58:35 2001
+++ linux-2.4.15-pre8/fs/block_dev.c Wed Nov 21 13:32:16 2001
@@ -603,7 +603,7 @@

- if (kind == BDEV_FILE)
+ if (kind == BDEV_FILE && bdev->bd_openers == 1)
else if (kind == BDEV_FS)

"Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former" -- Albert Einstein.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 13:24    [W:0.027 / U:8.732 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site