From 8e6c461eba6cb4210bb399180ce831788d78e003 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 17 Apr 2017 08:58:32 -0400 Subject: [PATCH] LU-9351 pfl: setstripe to existing file It's ok to setstripe to an existing file when the file has no LOVEA created yet, so we should not use exlusive open for the 'lfs setstripe'. Signed-off-by: Niu Yawei Change-Id: I2090ba2940b391f7853cc06ccdb9cd842ad6f984 Reviewed-on: https://review.whamcloud.com/26655 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Jinshan Xiong --- lustre/utils/lfs.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 89f9597..0eaaf7e 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -719,15 +719,10 @@ static int lfs_component_create(char *fname, int open_flags, mode_t open_mode, return -EINVAL; fd = lstat(fname, &st); - if (fd == 0 && S_ISDIR(st.st_mode)) { + if (fd == 0 && S_ISDIR(st.st_mode)) open_flags = O_DIRECTORY | O_RDONLY; - fd = llapi_layout_file_open(fname, open_flags, open_mode, - layout); - } else { - fd = llapi_layout_file_create(fname, open_flags, open_mode, - layout); - } + fd = llapi_layout_file_open(fname, open_flags, open_mode, layout); if (fd < 0) fprintf(stderr, "%s %s failed. %s\n", S_ISDIR(st.st_mode) ? -- 1.8.3.1