From 33525087068285c00e3a915788b0837786993bef Mon Sep 17 00:00:00 2001
From: bobijam <bobijam>
Date: Wed, 28 Nov 2007 02:25:56 +0000
Subject: [PATCH] Branch b1_6 b=14270 i=johann, kalpak.shah

Description: lfs find does not continue on file error
Details    : Continue other files processing when a file/dir is absent.
---
 lustre/ChangeLog            |  6 ++++++
 lustre/utils/liblustreapi.c | 24 +++++++++++++++++++++---
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 08b767aefb..ed94aa359d 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -14,6 +14,12 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        * Recommended e2fsprogs version: 1.40.2-cfs4
        * Note that reiserfs quotas are disabled on SLES 10 in this kernel.
 
+Severity   : major
+Frequency  : always
+Bugzilla   : 14270
+Description: lfs find does not continue on file error
+Details    : Continue other files processing when a file/dir is absent.
+
 Severity   : normal
 Bugzilla   : 11791
 Description: Inconsistent usage of lustre_pack_reply()
diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c
index b4257ec88a..3107095fe2 100644
--- a/lustre/utils/liblustreapi.c
+++ b/lustre/utils/liblustreapi.c
@@ -980,6 +980,10 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir,
                                         __FUNCTION__, path);
                                 return ret;
                         }
+                } else if (errno == ENOENT) {
+                        err_msg("warning: %s: %s does not exist",
+                                __FUNCTION__, path);
+                        goto decided;
                 } else {
                         err_msg("error: %s: %s failed for %s", __FUNCTION__,
                                 dir ? "LL_IOC_MDC_GETINFO" :
@@ -1078,9 +1082,15 @@ obd_matches:
                 }
 
                 if (ret) {
-                        fprintf(stderr, "%s: IOC_LOV_GETINFO on %s failed: "
-                                "%s.\n", __FUNCTION__, path, strerror(errno));
-                        return -EINVAL;
+                        if (errno == ENOENT) {
+                                err_msg("warning: %s: %s does not exist",
+                                        __FUNCTION__, path);
+                                goto decided;
+                        } else {
+                                fprintf(stderr, "%s: IOC_LOV_GETINFO on %s failed: "
+                                        "%s.\n", __FUNCTION__, path, strerror(errno));
+                                return ret;
+                        }
                 }
 
                 /* Check the time on osc. */
@@ -1186,6 +1196,10 @@ static int cb_getstripe(char *path, DIR *parent, DIR *d, void *data,
                 } else if (errno == ENOTTY) {
                         fprintf(stderr, "%s: '%s' not on a Lustre fs?\n",
                                 __FUNCTION__, path);
+                } else if (errno == ENOENT) {
+                        err_msg("warning: %s: %s does not exist",
+                                __FUNCTION__, path);
+                        goto out;
                 } else {
                         err_msg("error: %s: %s failed for %s", __FUNCTION__,
                                 d ? "LL_IOC_LOV_GETSTRIPE" :
@@ -1516,6 +1530,10 @@ static int cb_quotachown(char *path, DIR *parent, DIR *d, void *data,
                                 fprintf(stderr, "%s has no stripe info\n",
                                         path);
                         rc = 0;
+                } else if (errno == ENOENT) {
+                        err_msg("warning: %s: %s does not exist",
+                                __FUNCTION__, path);
+                        rc = 0;
                 } else if (errno != EISDIR) {
                         rc = errno;
                         err_msg("%s ioctl failed for %s.",
-- 
GitLab