Whamcloud - gitweb
LU-7152 hsm: sync volatile file before setting times 41/19441/2
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 11 Apr 2016 14:07:34 +0000 (09:07 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 8 May 2016 17:40:34 +0000 (17:40 +0000)
In the restore case of llapi_hsm_action_end() call fsync() on the
volatile file before updating its timestamps. This prevents spurious
{a,m,c}times from fsync(). Correct a related comment in sanity-hsm
test_24a().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I982dfd49cbb7d6f9cd7d569e834e4e0581e4bdc9
Reviewed-on: http://review.whamcloud.com/19441
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-hsm.sh
lustre/utils/liblustreapi_hsm.c

index 9f8ec9c..6c7b890 100755 (executable)
@@ -1938,8 +1938,7 @@ test_24a() {
        [ $ctime0 -eq $ctime1 ] ||
                error "release changed ctime from $ctime0 to $ctime1"
 
-       # Restore should not change atime or mtime and should not
-       # decrease ctime.
+       # Restore should not change any timestamps.
        $LFS hsm_restore $file
        wait_request_state $fid RESTORE SUCCEED
 
index b7678d7..7eaf8eb 100644 (file)
@@ -1180,13 +1180,14 @@ int llapi_hsm_action_end(struct hsm_copyaction_private **phcp,
                        .lfu_ctime_nsec = hcp->stat.st_ctim.tv_nsec,
                };
 
-               /* Set {a,m,c}time of volatile file to that of original. */
-               if (ioctl(hcp->data_fd, LL_IOC_FUTIMES_3, &lfu) < 0) {
+               rc = fsync(hcp->data_fd);
+               if (rc < 0) {
                        errval = -errno;
                        goto end;
                }
 
-               rc = fsync(hcp->data_fd);
+               /* Set {a,m,c}time of volatile file to that of original. */
+               rc = ioctl(hcp->data_fd, LL_IOC_FUTIMES_3, &lfu);
                if (rc < 0) {
                        errval = -errno;
                        goto end;