Whamcloud - gitweb
LU-9351 pfl: setstripe to existing file 55/26655/2
authorNiu Yawei <yawei.niu@intel.com>
Mon, 17 Apr 2017 12:58:32 +0000 (08:58 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Apr 2017 03:37:09 +0000 (03:37 +0000)
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>
lustre/utils/lfs.c

index 89f9597..0eaaf7e 100644 (file)
@@ -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) ?