Whamcloud - gitweb
LU-3036 test: make atime update properly with 2.x servers
authorEmoly Liu <emoly.liu@intel.com>
Tue, 7 May 2013 21:40:53 +0000 (05:40 +0800)
committerJohann Lombardi <johann.lombardi@intel.com>
Tue, 21 May 2013 07:32:30 +0000 (03:32 -0400)
This patch includes the following fixes:
- set both MDS_ATTR_xTIME | MDS_ATTR_xTIME_SET when converting
  from OBD_MD_FLATIME in mdc_close_pack_20(). This will fix
  new 1.8 clients with old 2.x servers.
- improve sanityn.sh test_23
- remove sanity.sh test_203 since it does the same check to
  sanityn.sh test_23

Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: Ia5a2749dc548614d55d1b50a3ac57e34dfed56c4
Reviewed-on: http://review.whamcloud.com/6289
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/mdc/mdc_lib.c
lustre/tests/sanity.sh
lustre/tests/sanityn.sh

index 35cd968..80f37c0 100644 (file)
@@ -894,15 +894,15 @@ static void mdc_close_pack_20(struct ptlrpc_request *req, int offset,
 
         if (oa->o_valid & OBD_MD_FLATIME) {
                 rec->sa_atime = oa->o_atime;
-                rec->sa_valid |= MDS_ATTR_ATIME;
+                rec->sa_valid |= MDS_ATTR_ATIME | MDS_ATTR_ATIME_SET;
         }
         if (oa->o_valid & OBD_MD_FLMTIME) {
                 rec->sa_mtime = oa->o_mtime;
-                rec->sa_valid |= MDS_ATTR_MTIME;
+                rec->sa_valid |= MDS_ATTR_MTIME | MDS_ATTR_MTIME_SET;
         }
         if (oa->o_valid & OBD_MD_FLCTIME) {
                 rec->sa_ctime = oa->o_ctime;
-                rec->sa_valid |= MDS_ATTR_CTIME;
+                rec->sa_valid |= MDS_ATTR_CTIME | MDS_ATTR_CTIME_SET;
         }
         if (oa->o_valid & OBD_MD_FLSIZE) {
                 rec->sa_size = oa->o_size;
index 31a89b4..a1d3423 100644 (file)
@@ -6999,33 +6999,6 @@ test_202() {
 }
 run_test 202 "O_APPEND+O_DIRECT multistripe write ========================"
 
-test_203() {
-        local lustre_version=$(get_lustre_version mds)
-        if [[ $lustre_version != 1.8* ]]; then
-               skip bug23766 mds running $lustre_version
-               return
-        fi
-
-        local ATIME=`do_facet mds lctl get_param -n mds.*.atime_diff`
-        echo "atime should be updated on the MDS when closing file" > $DIR/$tfile
-        sync
-        # reads should update atime on the client and close should update it on the MDS
-        multiop_bg_pause $DIR/$tfile o_r20c || return 1
-        MULTIPID=$!
-        sleep $((ATIME+1))
-        time1=`date +%s`
-        log "now is $time1"
-        kill -USR1 $MULTIPID || return 2
-        echo "starting reads"
-        wait
-        cancel_lru_locks osc
-        cancel_lru_locks mdc
-        time2=`stat -c "%X" $DIR/$tfile`
-        log "new atime is $time2"
-        [ "$time2" -ge "$time1" ] || error "atime was not updated"
-}
-run_test 203 " atime should be updated on the MDS when closing file ===="
-
 # usage: default_attr <count | size | offset>
 default_attr() {
        $LCTL get_param -n lov.$FSNAME-clilov-\*.stripe${1}
index 64db399..112e4eb 100644 (file)
@@ -430,26 +430,25 @@ test_22() { # Bug 9926
 run_test 22 " After joining in one dir,  open/close unlink file in anther dir"
 
 test_23() { # Bug 5972
-       echo "others should see updated atime while another read" > $DIR1/f23
+       local atime_diff=$(do_facet mds $LCTL get_param -n md*.*.atime_diff)
 
+       echo "should see updated atime while another read" > $DIR1/$tfile
        # clear the lock(mode: LCK_PW) gotten from creating operation
        cancel_lru_locks osc
+       time1=$(date +%s)
+       echo "now is $time1"
+       sleep $((atime_diff + 1))
 
-       time1=`date +%s`
-       sleep 2
-
-       multiop_bg_pause $DIR1/f23 or20_c || return 1
-       MULTIPID=$!
-
-       time2=`stat -c "%X" $DIR2/f23`
+       multiop_bg_pause $DIR1/$tfile or20_c || return 1
+       kill -USR1 $! || return 2
+       wait
+       cancel_lru_locks mdc
 
-       if (( $time2 <= $time1 )); then
-               kill -USR1 $MULTIPID
-               error "atime doesn't update among nodes"
-       fi
+       time2=$(stat -c "%X" $DIR2/$tfile)
+       echo "new atime is $time2"
 
-       kill -USR1 $MULTIPID || return 1
-       rm -f $DIR1/f23 || error "rm -f $DIR1/f23 failed"
+       [ $time2 -gt $time1 ] || error "atime doesn't update among nodes"
+       rm -f $DIR1/$tfile || error "rm -f $DIR1/$tfile failed"
        true
 }
 run_test 23 " others should see updated atime while another read===="