All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reiserfs: fix blkdev_issue_flush() failure handling
@ 2009-03-29 17:29 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; only message in thread
From: Bartlomiej Zolnierkiewicz @ 2009-03-29 17:29 UTC (permalink / raw)
  To: reiserfs-devel; +Cc: linux-kernel

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-29 17:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-29 17:29 [PATCH] reiserfs: fix blkdev_issue_flush() failure handling Bartlomiej Zolnierkiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.