xfs
[Top] [All Lists]

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

To: aelder@xxxxxxx
Subject: Re: [patch] xfsprogs: unhandled error check in libxfs_trans_read_buf
From: Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx>
Date: Tue, 8 Feb 2011 11:22:42 +0900
Cc: xfs@xxxxxxxxxxx, Eric Sandeen <sandeen@xxxxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=UXSaNHGFwR4UPcM3tCWPS6z9WCTXc+AcdjQRPtgHuKU=; b=BS0Z/6rlrRkc5Ww4pwkunDnRxTEAzzR2dnoOiAKaNfv9tImL6/n7K0/IRtSxwdA6mi khVbKFmVj6x2wj/Az/TY0GT8WssP1VLn1FdW/cjiegzAesbMusHiB97KZTdGGFCPN9FR SaCwxGYyWP/wWyB3MRlQMxcp4u612GaG7tnfs=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=N9XBLn70Mg20xm/59NsR+OcFBITUtUE2FRtvcuywH3KXFiBK7iqQKQ18V5lQzzsOlb 3MAocWP5ox11J/nTuGCvw9E9dDG1wwnb4yV6xonQsxNqNVZwcR8ZCjPYWaJCxsFsArKw LPDA4Phdr97Ob560nt96MJljHQK9Ccr/MBC1k=
In-reply-to: <AANLkTi=FMmJEipcJPa--y3Pmg+K9W8e3JVyhgSpBP-qu@xxxxxxxxxxxxxx>
References: <AANLkTim2nm9SXPmpRUmK8eWxXYFkPcrzc-gw2ceJ-m2-@xxxxxxxxxxxxxx> <1297127823.2078.24.camel@doink> <AANLkTi=FMmJEipcJPa--y3Pmg+K9W8e3JVyhgSpBP-qu@xxxxxxxxxxxxxx>
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.

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;
 }

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

<Prev in Thread] Current Thread [Next in Thread>