From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Josef Bacik <josef@redhat.com>
Cc: Jan Kara <jack@suse.cz>,
Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [Regression] Commit 02c24a82187d5a628c68edfe71ae60dc135cd178 breaks s2disk
Date: Tue, 2 Aug 2011 02:17:48 +0200 [thread overview]
Message-ID: <201108020217.48952.rjw@sisk.pl> (raw)
In-Reply-To: <201108020147.01136.rjw@sisk.pl>
On Tuesday, August 02, 2011, Rafael J. Wysocki wrote:
> Hi,
>
> Unfortunately s2disk (which is a user space tool for saving hibernate images)
> doesn't work any more after your commit 02c24a82187d5a628c68edfe71ae60dc135cd178
> (fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers).
> The symptom is that the s2disk's resume counterpart cannot find the image in
> the device even though s2disk considers it as successfully saved.
>
> What happens is that s2disk opens a block device (disk partition to be precise)
> directly and writes to it eventually calling fsync(). My interpretation of the
> failure is that before commit 02c24a82187d5a628c68ed, when s2disk called fsync()
> the VFS layer would run filemap_write_and_wait_range() that in turn would cause
> the data to go to the disk, but after that commit this doesn't happen any more.
>
> If I'm right, then not only s2disk, but any process writing directly to a block
> device will have a problem with fsync().
Well, I'm not sure if the patch below is the right fix, but it evidently makes
s2disk work for me again.
Thanks,
Rafael
---
fs/block_dev.c | 4 ++++
1 file changed, 4 insertions(+)
Index: linux-2.6/fs/block_dev.c
===================================================================
--- linux-2.6.orig/fs/block_dev.c
+++ linux-2.6/fs/block_dev.c
@@ -387,6 +387,10 @@ int blkdev_fsync(struct file *filp, loff
struct inode *bd_inode = filp->f_mapping->host;
struct block_device *bdev = I_BDEV(bd_inode);
int error;
+
+ error = filemap_write_and_wait_range(filp->f_mapping, start, end);
+ if (error)
+ return error;
/*
* There is no need to serialise calls to blkdev_issue_flush with
next parent reply other threads:[~2011-08-02 0:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201108020147.01136.rjw@sisk.pl>
2011-08-02 0:17 ` Rafael J. Wysocki [this message]
2011-08-02 1:22 ` [Regression] Commit 02c24a82187d5a628c68edfe71ae60dc135cd178 breaks s2disk Linus Torvalds
[not found] ` <CA+55aFxPAowBwgK7JqN0uH-ytvg+BKdE3yBGF0z_6kNDNcOYcQ@mail.gmail.com>
2011-08-02 1:30 ` Al Viro
[not found] ` <20110802013027.GJ2203@ZenIV.linux.org.uk>
2011-08-02 1:38 ` Linus Torvalds
2011-08-02 1:39 ` Al Viro
[not found] ` <20110802013947.GK2203@ZenIV.linux.org.uk>
2011-08-02 9:26 ` Rafael J. Wysocki
2011-08-01 23:47 Rafael J. Wysocki
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=201108020217.48952.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=jack@suse.cz \
--cc=josef@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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