Whamcloud - gitweb
LU-5955 utils: lfs shouldn't skip .lustre directory 63/30463/4
authorAndreas Dilger <andreas.dilger@intel.com>
Sat, 9 Dec 2017 08:23:36 +0000 (01:23 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 20 Jan 2018 06:19:34 +0000 (06:19 +0000)
Before Lustre 2.5.3 the MDS returned the .lustre directory to clients
with readdir in the root directory.  This has always been masked out
for "lfs find" and "lfs getstripe" by llapi_semantic_traverse(), but
had the side-effect of also skipping a real .lustre directory that may
exist in the filesystem (for whatever reason, I'm not sure).

Since 2.5.3-84-g2976f91 the /.lustre directory is no longer returned
by the MDS, so there is no need to exclude it in the tools anymore.
Add a sanity test to confirm that the .lustre directory is not listed
(there already are many tests that verify it can be accessed).

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I7ec6ee94b6012445d3bfd9a8a47497dacdbcab07
Reviewed-on: https://review.whamcloud.com/30463
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity.sh
lustre/utils/liblustreapi.c

index be29031..65d7461 100755 (executable)
@@ -10974,6 +10974,8 @@ test_154a() {
        dot_lustre_fid_permission_check "$fid" $DIR ||
                error "dot lustre permission check $fid failed"
 
+       ls -a $MOUNT | grep "\.lustre" && error ".lustre should not be listed"
+
        rm -rf $MOUNT/.lustre && error ".lustre is not allowed to be unlinked"
 
        touch $MOUNT/.lustre/file &&
index fb65b0d..7280528 100644 (file)
@@ -1830,24 +1830,20 @@ static int llapi_semantic_traverse(char *path, int size, DIR *parent,
        while ((dent = readdir64(d)) != NULL) {
                int rc;
 
-                if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
-                        continue;
-
-                /* Don't traverse .lustre directory */
-                if (!(strcmp(dent->d_name, dot_lustre_name)))
-                        continue;
+               if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
+                       continue;
 
-                path[len] = 0;
-                if ((len + dent->d_reclen + 2) > size) {
-                        llapi_err_noerrno(LLAPI_MSG_ERROR,
-                                          "error: %s: string buffer is too small",
-                                          __func__);
-                        break;
-                }
-                strcat(path, "/");
-                strcat(path, dent->d_name);
+               path[len] = 0;
+               if ((len + dent->d_reclen + 2) > size) {
+                       llapi_err_noerrno(LLAPI_MSG_ERROR,
+                                         "error: %s: string buffer too small",
+                                         __func__);
+                       break;
+               }
+               strcat(path, "/");
+               strcat(path, dent->d_name);
 
-                if (dent->d_type == DT_UNKNOWN) {
+               if (dent->d_type == DT_UNKNOWN) {
                        lstat_t *st = &param->fp_lmd->lmd_st;
 
                        rc = get_lmd_info(path, d, NULL, param->fp_lmd,