Whamcloud - gitweb
LU-12598 osd-ldiskfs: always return errors for osd_ios_lf_fill 23/37323/2
authorJames Simmons <jsimmons@infradead.org>
Fri, 24 Jan 2020 16:45:48 +0000 (11:45 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 1 Feb 2020 08:10:54 +0000 (08:10 +0000)
While working on ARM ldiskfs support it was noticed that
osd_ios_lf_fill() behaves differently then the other olm_filldir
handlers. On failure of osd_lookup_one_len() osd_ios_lf_fill()
silently returns zero when it should return an error code. Change
to return proper error codes and update the cdebug messages.

Change-Id: I528b18aaa7277133875cba5db3150ce34cc6431a
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/37323
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_scrub.c

index 63c295b..628771a 100644 (file)
@@ -2016,14 +2016,15 @@ static int osd_ios_lf_fill(void *buf,
        scrub->os_lf_scanned++;
        child = osd_lookup_one_len(dev, name, parent, namelen);
        if (IS_ERR(child)) {
        scrub->os_lf_scanned++;
        child = osd_lookup_one_len(dev, name, parent, namelen);
        if (IS_ERR(child)) {
+               rc = PTR_ERR(child);
                CDEBUG(D_LFSCK, "%s: cannot lookup child '%.*s': rc = %d\n",
                CDEBUG(D_LFSCK, "%s: cannot lookup child '%.*s': rc = %d\n",
-                     osd_name(dev), namelen, name, (int)PTR_ERR(child));
-               RETURN(0);
+                     osd_name(dev), namelen, name, rc);
+               RETURN(rc);
        } else if (!child->d_inode) {
                dput(child);
                CDEBUG(D_INODE, "%s: child '%.*s' lacks inode\n",
                       osd_name(dev), namelen, name);
        } else if (!child->d_inode) {
                dput(child);
                CDEBUG(D_INODE, "%s: child '%.*s' lacks inode\n",
                       osd_name(dev), namelen, name);
-               RETURN(0);
+               RETURN(-ENOENT);
        }
 
        inode = child->d_inode;
        }
 
        inode = child->d_inode;