[2/4] libxfs: complain when write IOs fail
diff mbox series

Message ID 158086365728.2079905.9556999948179065078.stgit@magnolia
State Superseded
Headers show
Series
  • libxfs: actually check that writes succeeded
Related show

Commit Message

Darrick J. Wong Feb. 5, 2020, 12:47 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Complain whenever a metadata write fails.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/rdwr.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Allison Collins Feb. 6, 2020, 7:38 p.m. UTC | #1
On 2/4/20 5:47 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Complain whenever a metadata write fails.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks good:
Reviewed-by: Allison Collins <allison.henderson@oracle.com>

> ---
>   libxfs/rdwr.c |    7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
> index 2e9f66cc..8b47d438 100644
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -1149,7 +1149,12 @@ libxfs_writebufr(xfs_buf_t *bp)
>   			(long long)LIBXFS_BBTOOFF64(bp->b_bn),
>   			(long long)bp->b_bn, bp, bp->b_error);
>   #endif
> -	if (!bp->b_error) {
> +	if (bp->b_error) {
> +		fprintf(stderr,
> +	_("%s: write failed on %s bno 0x%llx/0x%x, err=%d\n"),
> +			__func__, bp->b_ops->name,
> +			(long long)bp->b_bn, bp->b_bcount, -bp->b_error);
> +	} else {
>   		bp->b_flags |= LIBXFS_B_UPTODATE;
>   		bp->b_flags &= ~(LIBXFS_B_DIRTY | LIBXFS_B_EXIT |
>   				 LIBXFS_B_UNCHECKED);
>
hch@infradead.org Feb. 17, 2020, 1:57 p.m. UTC | #2
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch
diff mbox series

diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 2e9f66cc..8b47d438 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1149,7 +1149,12 @@  libxfs_writebufr(xfs_buf_t *bp)
 			(long long)LIBXFS_BBTOOFF64(bp->b_bn),
 			(long long)bp->b_bn, bp, bp->b_error);
 #endif
-	if (!bp->b_error) {
+	if (bp->b_error) {
+		fprintf(stderr,
+	_("%s: write failed on %s bno 0x%llx/0x%x, err=%d\n"),
+			__func__, bp->b_ops->name,
+			(long long)bp->b_bn, bp->b_bcount, -bp->b_error);
+	} else {
 		bp->b_flags |= LIBXFS_B_UPTODATE;
 		bp->b_flags &= ~(LIBXFS_B_DIRTY | LIBXFS_B_EXIT |
 				 LIBXFS_B_UNCHECKED);