Whamcloud - gitweb
Branch HEAD
authorbobijam <bobijam>
Thu, 13 Sep 2007 03:30:06 +0000 (03:30 +0000)
committerbobijam <bobijam>
Thu, 13 Sep 2007 03:30:06 +0000 (03:30 +0000)
b=13600
i=kalpak, bobijam

original patch by adilger.

Description: "lfs find -obd UUID" prints directories
Details    : "lfs find -obd UUID" will return all directory names instead
             of just file names. It is incorrect because the directories
             do not reside on the OSTs.

lustre/ChangeLog
lustre/tests/sanity.sh
lustre/utils/liblustreapi.c

index 22a0031..af55abf 100644 (file)
@@ -236,6 +236,14 @@ Bugzilla   : 13532
 Description: rewrite ext2-derived code in obdclass/uuid.c
 Details    : rewrite inherited code (uuid parsing code from ext2 utils)
             from scratch preserving functionality.
+
+Severity   : normal
+Bugzilla   : 13600
+Description: "lfs find -obd UUID" prints directories
+Details    : "lfs find -obd UUID" will return all directory names instead
+             of just file names. It is incorrect because the directories
+             do not reside on the OSTs.
+
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
index 0cb9483..537f3b3 100644 (file)
@@ -2466,6 +2466,14 @@ test_56h() {
 }
 run_test 56h "check lfs find ! -name ============================="
 
+test_56i() {
+       mkdir -p $DIR/$tdir
+       UUID=`$GETSTRIPE $DIR/$tdir | awk '/0: / { print $2 }'`
+       OUT="`$LFIND -ost $UUID $DIR/$tdir`"
+       [ "$OUT" ] && error "$LFIND returned directory '$OUT'" || true
+}
+run_test 56i "check 'lfs find -ost UUID' skips directories ======="
+
 test_57a() {
        # note test will not do anything if MDS is not local
        remote_mds && skip "remote MDS" && return
index 92fa84d..d2b4a0b 100644 (file)
@@ -133,7 +133,6 @@ int llapi_file_open(const char *name, int flags, int mode,
                 if (errno != EEXIST && errno != EALREADY)
                         errmsg = strerror(errno);
 
-                rc = -errno;
                 fprintf(stderr, "error on ioctl "LPX64" for '%s' (%d): %s\n",
                         (__u64)LL_IOC_LOV_SETSTRIPE, name, fd, errmsg);
         }
@@ -784,10 +783,12 @@ static int cb_find_init(char *path, DIR *parent, DIR *dir, void *data)
                 decision = -1;
 
         /* If a OST UUID is given, and some OST matches, check it here. */
-        if (decision != -1 && param->obdindex != OBD_NOT_FOUND &&
-            S_ISREG(st->st_mode)) {
-                /* Only those files should be accepted, which have a strip on
-                 * the specified OST. */
+        if (decision != -1 && param->obdindex != OBD_NOT_FOUND) {
+                if (!S_ISREG(st->st_mode))
+                        goto decided;
+
+                /* Only those files should be accepted, which have a
+                 * stripe on the specified OST. */
                 if (!param->lmd->lmd_lmm.lmm_stripe_count) {
                         decision = -1;
                 } else {
@@ -869,6 +870,7 @@ print_path:
                         printf("\n");
         }
 
+decided:
         /* Do not get down anymore? */
         if (param->depth == param->maxdepth)
                 return 1;