From 1fc1660d7648ea10c100a8bb5b10df15cdddb3d4 Mon Sep 17 00:00:00 2001 From: vinayak_clogeny Date: Wed, 24 Sep 2014 12:07:11 +0530 Subject: [PATCH] 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 --- lustre/utils/lfs.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 " -- 1.8.3.1