From: vinayak_clogeny Date: Wed, 24 Sep 2014 06:37:11 +0000 (+0530) Subject: LU-5141 hsm: Only regular files should be archived X-Git-Tag: 2.6.54~8 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F12036%2F3;p=fs%2Flustre-release.git LU-5141 hsm: Only regular files should be archived 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 Change-Id: Ie6cdc05a8517853675167640d76d4d7b5ea9dccf Reviewed-on: http://review.whamcloud.com/12036 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: frank zago Reviewed-by: Faccini Bruno Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 773976e..6d2ce2e 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -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 "