All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: fix blkdev_issue_flush() failure handling
Date: Sun, 29 Mar 2009 12:43:22 -0500	[thread overview]
Message-ID: <49CFB33A.9020406@redhat.com> (raw)
In-Reply-To: <200903291928.14451.bzolnier@gmail.com>

Bartlomiej Zolnierkiewicz wrote:
> 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/ext4/fsync.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> Index: b/fs/ext4/fsync.c
> ===================================================================
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -48,7 +48,7 @@ int ext4_sync_file(struct file *file, st
>  {
>  	struct inode *inode = dentry->d_inode;
>  	journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
> -	int ret = 0;
> +	int ret = 0, tmp_ret;
>  
>  	J_ASSERT(ext4_journal_current_handle() == NULL);
>  
> @@ -92,8 +92,11 @@ int ext4_sync_file(struct file *file, st
>  			.nr_to_write = 0, /* sys_fsync did this */
>  		};
>  		ret = sync_inode(inode, &wbc);
> -		if (journal && (journal->j_flags & JBD2_BARRIER))
> -			blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
> +		if (journal && (journal->j_flags & JBD2_BARRIER)) {
> +			tmp_ret = blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
> +			if (ret == 0 && tmp_ret < 0 && tmp_ret != -EOPNOTSUPP)
> +				ret = tmp_ret;
> +		}
>  	}
>  out:
>  	return ret;

As long as we keep the call there this is probably good, but after
talking w/ Chris Mason, I think the call is extraneous anyway and should
probably just be removed...

-Eric

  reply	other threads:[~2009-03-29 17:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-29 17:28 [PATCH] ext4: fix blkdev_issue_flush() failure handling Bartlomiej Zolnierkiewicz
2009-03-29 17:43 ` Eric Sandeen [this message]
2009-03-30  2:25   ` Theodore Tso
2009-03-30  3:22     ` Eric Sandeen
2009-03-30 11:47       ` Chris Mason
2009-03-30 13:01         ` Fernando Luis Vázquez Cao
2009-03-30 13:24           ` Chris Mason
2009-03-31  4:28             ` Fernando Luis Vázquez Cao
2009-03-31  4:28               ` Fernando Luis Vázquez Cao
2009-03-30 14:25           ` Theodore Tso
2009-03-30 14:25             ` Theodore Tso
2009-03-31  4:33             ` Fernando Luis Vázquez Cao
2009-03-31  4:33               ` Fernando Luis Vázquez Cao
2009-03-30 15:26           ` Bartlomiej Zolnierkiewicz
2009-03-30 15:26             ` Bartlomiej Zolnierkiewicz
2009-03-31  4:23             ` Fernando Luis Vázquez Cao
2009-03-31  4:23               ` Fernando Luis Vázquez Cao
2009-03-30 17:46         ` Theodore Tso

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=49CFB33A.9020406@redhat.com \
    --to=sandeen@redhat.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 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.