From 2959fbfbb77e2b1b2ccbc90610f8ff9362109ae3 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Thu, 13 Jun 2019 16:23:21 +0530 Subject: posix/ctime: Fix ctime upgrade issue Problem: On a EC volume, during upgrade from the older version where ctime feature is not enabled(or not present) to the newer version where the ctime feature is available (enabled default), the self heal hangs and doesn't complete. Cause: The ctime feature has both client side code (utime) and server side code (posix). The feature is driven from client. Only if the client side sets the time in the frame, should the server side sets the time attributes in xattr. But posix setattr/fseattr was not doing that. When one of the server nodes is updated, since ctime is enabled by default, it starts setting xattr on setattr/fseattr on the updated node/brick. On a EC volume the first two updated nodes(bricks) are not a problem because there are 4 other bricks with consistent data. However once the third brick is updated, the new attribute(mdata xattr) will cause an inconsistency on metadata on 3 bricks, which prevents the file to be repaired. Fix: Don't create mdata xattr with utimes/utimensat system call. Only update if already present. Change-Id: Ieacedecb8a738bb437283ef3e0f042fd49dc4c8c fixes: bz#1720201 Signed-off-by: Kotresh HR --- tests/volume.rc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/volume.rc') diff --git a/tests/volume.rc b/tests/volume.rc index 6477dfb484f..85a2cb01727 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -944,3 +944,33 @@ function number_healer_threads_shd { local pid=$(get_shd_mux_pid $1) pstack $pid | grep $2 | wc -l } + +function get_mtime { + local time=$(get-mdata-xattr -m $1) + if [ $time == "-1" ]; + then + echo $(stat -c %Y $1) + else + echo $time + fi +} + +function get_ctime { + local time=$(get-mdata-xattr -c $1) + if [ $time == "-1" ]; + then + echo $(stat -c %Z $2) + else + echo $time + fi +} + +function get_atime { + local time=$(get-mdata-xattr -a $1) + if [ $time == "-1" ]; + then + echo $(stat -c %X $1) + else + echo $time + fi +} -- cgit