Whamcloud - gitweb
LU-6219 utils: remove O_NONBLOCK usage for archive file 72/13672/2
authorBruno Faccini <bruno.faccini@intel.com>
Fri, 6 Feb 2015 11:03:32 +0000 (12:03 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 18 Mar 2015 11:19:58 +0000 (11:19 +0000)
In the first implementations of Posix copytool, file archive/restore
was using a loop around select() with handling/retry on EAGAIN.
This was later found as useless for regular files and fixed/changed
in patch for LU-3971 (http://review.whamcloud.com/7583, commit
397ebc93cef378e6d77450cdd095e2737b94f2f6).
But the O_NONBLOCK flag usage, during open() of file on archive, has
been kept since and must be removed, even if ineffective, to improve
code clarity.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: Ie6350e6f3951545f50783c9fff6753793b7a9a33
Reviewed-on: http://review.whamcloud.com/13672
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Robert Read <robert.read@intel.com>
Reviewed-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lhsmtool_posix.c

index 5a81e4f..12ead32 100644 (file)
@@ -917,7 +917,7 @@ static int ct_archive(const struct hsm_action_item *hai, const long hal_flags)
                goto fini_major;
        }
 
                goto fini_major;
        }
 
-       open_flags = O_WRONLY | O_NOFOLLOW | O_NONBLOCK;
+       open_flags = O_WRONLY | O_NOFOLLOW;
        /* If extent is specified, don't truncate an old archived copy */
        open_flags |= ((hai->hai_extent.length == -1) ? O_TRUNC : 0) | O_CREAT;
 
        /* If extent is specified, don't truncate an old archived copy */
        open_flags |= ((hai->hai_extent.length == -1) ? O_TRUNC : 0) | O_CREAT;
 
@@ -1170,7 +1170,7 @@ static int ct_restore(const struct hsm_action_item *hai, const long hal_flags)
                goto fini;
        }
 
                goto fini;
        }
 
-       src_fd = open(src, O_RDONLY | O_NOATIME | O_NONBLOCK | O_NOFOLLOW);
+       src_fd = open(src, O_RDONLY | O_NOATIME | O_NOFOLLOW);
        if (src_fd < 0) {
                rc = -errno;
                CT_ERROR(rc, "cannot open '%s' for read", src);
        if (src_fd < 0) {
                rc = -errno;
                CT_ERROR(rc, "cannot open '%s' for read", src);