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 <yawei.niu@intel.com>
Change-Id: I2090ba2940b391f7853cc06ccdb9cd842ad6f984
Reviewed-on: https://review.whamcloud.com/26655
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
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) ?