From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: reiserfs-devel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] reiserfs: fix blkdev_issue_flush() failure handling
Date: Sun, 29 Mar 2009 19:29:40 +0200 [thread overview]
Message-ID: <200903291929.40523.bzolnier@gmail.com> (raw)
blkdev_issue_flush() may fail (i.e. due to media error on FLUSH CACHE
command execution) so its users should check for the return value.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
fs/reiserfs/file.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: b/fs/reiserfs/file.c
===================================================================
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -140,14 +140,18 @@ static int reiserfs_sync_file(struct fil
struct inode *p_s_inode = p_s_dentry->d_inode;
int n_err;
int barrier_done;
+ int tmp_ret;
BUG_ON(!S_ISREG(p_s_inode->i_mode));
n_err = sync_mapping_buffers(p_s_inode->i_mapping);
reiserfs_write_lock(p_s_inode->i_sb);
barrier_done = reiserfs_commit_for_inode(p_s_inode);
reiserfs_write_unlock(p_s_inode->i_sb);
- if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb))
- blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL);
+ if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb)) {
+ tmp_ret = blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL);
+ if (n_err == 0 && tmp_ret < 0 && tmp_ret != -EOPNOTSUPP)
+ n_err = tmp_ret;
+ }
if (barrier_done < 0)
return barrier_done;
return (n_err < 0) ? -EIO : 0;
reply other threads:[~2009-03-29 17:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200903291929.40523.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.org \
/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