[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200903301720.48260.bzolnier@gmail.com>
Date: Mon, 30 Mar 2009 17:20:43 +0200
From: Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
To: Fernando Luis Vázquez Cao
<fernando@....ntt.co.jp>
Cc: Jeff Garzik <jeff@...zik.org>,
Christoph Hellwig <hch@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Theodore Tso <tytso@....edu>, Ingo Molnar <mingo@...e.hu>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Arjan van de Ven <arjan@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Nick Piggin <npiggin@...e.de>, David Rees <drees76@...il.com>,
Jesper Krogh <jesper@...gh.cc>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
chris.mason@...cle.com, david@...morbit.com, tj@...nel.org
Subject: Re: [PATCH 6/7] xfs: propagate issue-flush error code
On Monday 30 March 2009, Fernando Luis Vázquez Cao 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.
>
> (This issues was first spotted Bartlomiej Zolnierkiewicz)
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@...il.com>
> Signed-off-by: Fernando Luis Vazquez Cao <fernando@....ntt.co.jp>
> ---
>
> diff -urNp linux-2.6.29-orig/fs/xfs/linux-2.6/xfs_buf.c linux-2.6.29/fs/xfs/linux-2.6/xfs_buf.c
> --- linux-2.6.29-orig/fs/xfs/linux-2.6/xfs_buf.c 2009-03-24 08:12:14.000000000 +0900
> +++ linux-2.6.29/fs/xfs/linux-2.6/xfs_buf.c 2009-03-30 14:44:34.000000000 +0900
> @@ -1446,6 +1446,7 @@ xfs_free_buftarg(
> {
> xfs_flush_buftarg(btp, 1);
> if (mp->m_flags & XFS_MOUNT_BARRIER)
> + /* FIXME: check return value */
> xfs_blkdev_issue_flush(btp);
> xfs_free_bufhash(btp);
> iput(btp->bt_mapping->host);
> diff -urNp linux-2.6.29-orig/fs/xfs/linux-2.6/xfs_super.c linux-2.6.29/fs/xfs/linux-2.6/xfs_super.c
> --- linux-2.6.29-orig/fs/xfs/linux-2.6/xfs_super.c 2009-03-24 08:12:14.000000000 +0900
> +++ linux-2.6.29/fs/xfs/linux-2.6/xfs_super.c 2009-03-30 15:16:42.000000000 +0900
> @@ -721,11 +721,11 @@ xfs_mountfs_check_barriers(xfs_mount_t *
> }
> }
>
> -void
> +int
> xfs_blkdev_issue_flush(
> xfs_buftarg_t *buftarg)
> {
> - blkdev_issue_flush(buftarg->bt_bdev, NULL);
> + return block_flush_device(buftarg->bt_bdev);
> }
>
> STATIC void
> diff -urNp linux-2.6.29-orig/fs/xfs/linux-2.6/xfs_super.h linux-2.6.29/fs/xfs/linux-2.6/xfs_super.h
> --- linux-2.6.29-orig/fs/xfs/linux-2.6/xfs_super.h 2009-03-24 08:12:14.000000000 +0900
> +++ linux-2.6.29/fs/xfs/linux-2.6/xfs_super.h 2009-03-30 14:46:31.000000000 +0900
> @@ -89,7 +89,7 @@ struct block_device;
>
> extern __uint64_t xfs_max_file_offset(unsigned int);
>
> -extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
> +extern int xfs_blkdev_issue_flush(struct xfs_buftarg *);
>
> extern const struct export_operations xfs_export_operations;
> extern struct xattr_handler *xfs_xattr_handlers[];
> diff -urNp linux-2.6.29-orig/fs/xfs/xfs_vnodeops.c linux-2.6.29/fs/xfs/xfs_vnodeops.c
> --- linux-2.6.29-orig/fs/xfs/xfs_vnodeops.c 2009-03-24 08:12:14.000000000 +0900
> +++ linux-2.6.29/fs/xfs/xfs_vnodeops.c 2009-03-30 15:08:21.000000000 +0900
> @@ -678,20 +678,20 @@ xfs_fsync(
> xfs_iunlock(ip, XFS_ILOCK_EXCL);
> }
>
> - if ((ip->i_mount->m_flags & XFS_MOUNT_BARRIER) && changed) {
> + if (!error && (ip->i_mount->m_flags & XFS_MOUNT_BARRIER) && changed) {
> /*
> * If the log write didn't issue an ordered tag we need
> * to flush the disk cache for the data device now.
> */
> if (!log_flushed)
> - xfs_blkdev_issue_flush(ip->i_mount->m_ddev_targp);
> + error = xfs_blkdev_issue_flush(ip->i_mount->m_ddev_targp);
This is different from my original patch which preserved the original
error value...
> /*
> * If this inode is on the RT dev we need to flush that
> * cache as well.
> */
> - if (XFS_IS_REALTIME_INODE(ip))
> - xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
> + if (!error && XFS_IS_REALTIME_INODE(ip))
> + error = xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
This is also different and is a change in behavior
(it makes sense IMHO but please document it).
Thanks,
Bart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists