public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Miquel van Smoorenburg <miquels@cistron.nl>
Subject: Re: [PATCH] block_dev.c: fsync() on close() considered harmful
Date: Thu, 22 Nov 2001 18:26:16 +0100	[thread overview]
Message-ID: <20011122182616.D1338@athlon.random> (raw)
In-Reply-To: <20011122143450.A28020@cistron.nl>
In-Reply-To: <20011122143450.A28020@cistron.nl>; from miquels@cistron.nl on Thu, Nov 22, 2001 at 02:34:50PM +0100

On Thu, Nov 22, 2001 at 02:34:50PM +0100, Miquel van Smoorenburg wrote:
> 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?

it's correct, thanks.

> 
> --- 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.


Andrea

  reply	other threads:[~2001-11-22 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-22 13:34 [PATCH] block_dev.c: fsync() on close() considered harmful Miquel van Smoorenburg
2001-11-22 17:26 ` Andrea Arcangeli [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-02-25 18:04 Christoph Hellwig
2002-02-25 22:36 Christine Ames

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=20011122182616.D1338@athlon.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquels@cistron.nl \
    /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