From 1766e577e582ca240d215c5b38034b6cec2181fb Mon Sep 17 00:00:00 2001 From: bobijam Date: Thu, 13 Sep 2007 03:30:06 +0000 Subject: [PATCH] Branch HEAD 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 | 8 ++++++++ lustre/tests/sanity.sh | 8 ++++++++ lustre/utils/liblustreapi.c | 12 +++++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 22a0031..af55abf 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -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. diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 0cb9483..537f3b3 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 92fa84d..d2b4a0b 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -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; -- 1.8.3.1