From: Niu Yawei Date: Mon, 17 Apr 2017 12:58:32 +0000 (-0400) Subject: LU-9351 pfl: setstripe to existing file X-Git-Tag: 2.9.57~66 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F26655%2F2;p=fs%2Flustre-release.git 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 --- 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) ?