Re: [patch] xfsprogs: unhandled error check in libxfs_trans_read_buf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Community,
Our testing team reported one issue, we found it was related to libxfs
and resolved it.
I thought to share my experience with you, but did not receive any comment.

On Thu, Feb 3, 2011 at 3:17 PM, Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx> wrote:
> xfsprogs: unhandled error check in libxfs_trans_read_buf
>
> libxfs_trans_read_buf() is used in both mkfs.xfs & xfs_repair.
> During stability testing we found some time occur pagefault in mkfs.xfs,
> code inspection shows that if libxfs_readbuf() fails then occurs a
> page fault in xfs_buf_item_init() called in libxfs_trans_read_buf().
>
> mkfs.xfs: unhandled page fault (11) at 0x00000070, code 0x017
>
> Added NULL check and errno handling.
>
> Signed-off-by: Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx>
>
> diff -Nurp xfsprogs/libxfs/rdwr.c xfsprogs-dirty/libxfs/rdwr.c
> --- xfsprogs/libxfs/rdwr.c   Â2011-01-28 20:22:11.000000000 +0900
> +++ xfsprogs-dirty/libxfs/rdwr.c    Â2011-02-02 16:59:16.000000000 +0900
> @@ -207,10 +207,11 @@ libxfs_trace_readbuf(const char *func, c
> Â{
>    Âxfs_buf_t    *bp = libxfs_readbuf(dev, blkno, len, flags);
>
> - Â Â Â bp->b_func = func;
> - Â Â Â bp->b_file = file;
> - Â Â Â bp->b_line = line;
> -
> + Â Â Â if (bp){
> + Â Â Â Â Â Â Â bp->b_func = func;
> + Â Â Â Â Â Â Â bp->b_file = file;
> + Â Â Â Â Â Â Â bp->b_line = line;
> + Â Â Â }
> Â Â Â Âreturn bp;
> Â}
>
> @@ -485,6 +486,7 @@ libxfs_readbuf(dev_t dev, xfs_daddr_t bl
> Â Â Â Â Â Â Â Âerror = libxfs_readbufr(dev, blkno, bp, len, flags);
> Â Â Â Â Â Â Â Âif (error) {
> Â Â Â Â Â Â Â Â Â Â Â Âlibxfs_putbuf(bp);
> + Â Â Â Â Â Â Â Â Â Â Â errno = error;
> Â Â Â Â Â Â Â Â Â Â Â Âreturn NULL;
> Â Â Â Â Â Â Â Â}
> Â Â Â Â}
> diff -Nurp xfsprogs/libxfs/trans.c xfsprogs-dirty/libxfs/trans.c
> --- xfsprogs/libxfs/trans.c   2011-01-28 20:22:11.000000000 +0900
> +++ xfsprogs-dirty/libxfs/trans.c    2011-02-02 17:00:42.000000000 +0900
> @@ -508,6 +508,10 @@ libxfs_trans_read_buf(
> Â Â Â Â}
>
> Â Â Â Âbp = libxfs_readbuf(dev, blkno, len, flags);
> + Â Â Â if (!bp){
> + Â Â Â Â Â Â Â *bpp = NULL;
> + Â Â Â Â Â Â Â return errno;
> + Â Â Â }
> Â#ifdef XACT_DEBUG
> Â Â Â Âfprintf(stderr, "trans_read_buf buffer %p, transaction %p\n", bp, tp);
> Â#endif
>

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux