* block_dev.c: fsync() on close() considered harmful
@ 2001-11-21 13:30 Miquel van Smoorenburg
0 siblings, 0 replies; only message in thread
From: Miquel van Smoorenburg @ 2001-11-21 13:30 UTC (permalink / raw)
To: linux-kernel
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 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 @@
down(&bdev->bd_sem);
lock_kernel();
- if (kind == BDEV_FILE)
+ if (kind == BDEV_FILE && bdev->bd_openers == 1)
__block_fsync(bd_inode);
else if (kind == BDEV_FS)
fsync_no_super(rdev);
Mike.
--
"Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former" -- Albert Einstein.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-11-21 13:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-21 13:30 block_dev.c: fsync() on close() considered harmful Miquel van Smoorenburg
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®