Whamcloud - gitweb
LU-5141 hsm: Only regular files should be archived 36/12036/3
authorvinayak_clogeny <vinayakswami.hariharmath@clogeny.com>
Wed, 24 Sep 2014 06:37:11 +0000 (12:07 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 10 Oct 2014 13:12:10 +0000 (13:12 +0000)
It is currently possible to ask lfs to hsm_archive a directory,
although this doesn't appear to make any sense, and the posix
copytool rejects it.

Ideally this should be caught early and not being forwarded to
the copytool at all.

So adding regular file check in
lustre/utils/lfs.c
which will report error if the file provided for hsm_archive
is not a regular file

Signed-off-by: vinayakswami hariharmath <vinayakswami.hariharmath@clogeny.com>
Change-Id: Ie6cdc05a8517853675167640d76d4d7b5ea9dccf
Reviewed-on: http://review.whamcloud.com/12036
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lfs.c

index 773976e..6d2ce2e 100644 (file)
@@ -3637,6 +3637,13 @@ static int lfs_hsm_prepare_file(char *file, struct lu_fid *fid,
                fprintf(stderr, "Cannot stat %s: %s\n", file, strerror(errno));
                return -errno;
        }
+       /* Checking for regular file as archiving as posix copytool
+        * rejects archiving files other than regular files
+        */
+       if (!S_ISREG(st.st_mode)) {
+               fprintf(stderr, "error: \"%s\" is not a regular file\n", file);
+               return CMD_HELP;
+       }
        /* A request should be ... */
        if (*last_dev != st.st_dev && *last_dev != 0) {
                fprintf(stderr, "All files should be "