From 048fca4f9f227f57cc353d247b9873b54d12fb88 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 11 Apr 2016 09:07:34 -0500 Subject: [PATCH] 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 --- lustre/tests/sanity-hsm.sh | 3 +-- lustre/utils/liblustreapi_hsm.c | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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; -- 1.8.3.1