From: John L. Hammond Date: Mon, 11 Apr 2016 14:07:34 +0000 (-0500) Subject: LU-7152 hsm: sync volatile file before setting times X-Git-Tag: 2.8.53~4 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F19441%2F2;p=fs%2Flustre-release.git LU-7152 hsm: sync volatile file before setting times 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 Change-Id: I982dfd49cbb7d6f9cd7d569e834e4e0581e4bdc9 Reviewed-on: http://review.whamcloud.com/19441 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Faccini Bruno Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 9f8ec9c..6c7b890 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -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 diff --git a/lustre/utils/liblustreapi_hsm.c b/lustre/utils/liblustreapi_hsm.c index b7678d7..7eaf8eb 100644 --- a/lustre/utils/liblustreapi_hsm.c +++ b/lustre/utils/liblustreapi_hsm.c @@ -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;