mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nitin Gupta <ngupta@vflare.org>
To: Greg KH <greg@kroah.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] flush block device before reset
Date: Wed, 27 Jan 2010 19:54:05 +0530	[thread overview]
Message-ID: <1264602246-12880-3-git-send-email-ngupta@vflare.org> (raw)
In-Reply-To: <1264602246-12880-1-git-send-email-ngupta@vflare.org>

Make sure we flush block device before freeing all metadata
during reset ioctl.

Signed-off-by: Nitin Gupta <ngupta@vflar.org>
---
 drivers/staging/ramzswap/ramzswap_drv.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ramzswap/ramzswap_drv.c b/drivers/staging/ramzswap/ramzswap_drv.c
index 0a376c2..64f49c9 100644
--- a/drivers/staging/ramzswap/ramzswap_drv.c
+++ b/drivers/staging/ramzswap/ramzswap_drv.c
@@ -1000,6 +1000,9 @@ static void reset_device(struct ramzswap *rzs)
 	unsigned entries_per_page;
 	unsigned long num_table_pages, entry = 0;
 
+	/* Do not accept any new I/O request */
+	rzs->init_done = 0;
+
 	if (rzs->backing_swap && !rzs->num_extents)
 		is_backing_blkdev = 1;
 
@@ -1073,9 +1076,6 @@ static void reset_device(struct ramzswap *rzs)
 
 	rzs->disksize = 0;
 	rzs->memlimit = 0;
-
-	/* Back to uninitialized state */
-	rzs->init_done = 0;
 }
 
 static int ramzswap_ioctl_init_device(struct ramzswap *rzs)
@@ -1276,6 +1276,11 @@ static int ramzswap_ioctl(struct block_device *bdev, fmode_t mode,
 			ret = -EBUSY;
 			goto out;
 		}
+
+		/* Make sure all pending I/O is finished */
+		if (bdev)
+			fsync_bdev(bdev);
+
 		ret = ramzswap_ioctl_reset_device(rzs);
 		break;
 
-- 
1.6.2.5


  parent reply	other threads:[~2010-01-27 14:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 14:24 [PATCH 0/3][linux-next] ramzswap: bug fixes and some cleanups Nitin Gupta
2010-01-27 14:24 ` [PATCH 1/3] use lock for 64-bit stats Nitin Gupta
2010-01-27 15:10   ` Pekka Enberg
2010-01-27 15:51     ` Nitin Gupta
2010-01-28  2:19   ` [PATCH 1/3][resend] " Nitin Gupta
2010-01-27 14:24 ` Nitin Gupta [this message]
2010-01-27 14:24 ` [PATCH 3/3] set block size to PAGE_SIZE and some cleanups Nitin Gupta
2010-01-28  3:59   ` [PATCH 3/3][resend] " Nitin Gupta
2010-01-28  4:23     ` Greg KH
2010-01-28  5:37       ` Nitin Gupta
2010-01-28  5:54         ` Greg KH

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=1264602246-12880-3-git-send-email-ngupta@vflare.org \
    --to=ngupta@vflare.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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®