1 #!/bin/ksh -p
   2 #
   3 # CDDL HEADER START
   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  25 #
  26 
  27 #
  28 # ID: misc_002
  29 #
  30 # DESCRIPTION:
  31 #       Verify attribute cache invalidation after
  32 #       some higher-level directory is renamed.
  33 #
  34 # STRATEGY:
  35 #       1. run "mount -F smbfs //server/public /export/mnt"
  36 #       2. mkdir a/b/c/d
  37 #       3. mv a z
  38 #       4. mkdir a
  39 #       5. verify stat of a/b/c shows ENOENT
  40 #       (All steps must be completed in less than a few seconds.)
  41 #
  42 
  43 . $STF_SUITE/include/libtest.ksh
  44 
  45 tc_id="misc002"
  46 tc_desc=" Verify attribute cache invalidation under renamed directory"
  47 print_test_case $tc_id - $tc_desc
  48 
  49 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
  50         [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
  51     set -x
  52 fi
  53 
  54 server=$(server_name)||return
  55 
  56 testdir_init $TDIR
  57 smbmount_clean $TMNT
  58 smbmount_init $TMNT
  59 
  60 cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT"
  61 cti_execute -i '' FAIL $cmd
  62 if [[ $? != 0 ]]; then
  63         cti_fail "FAIL: smbmount can't mount the public share"
  64         return
  65 else
  66         cti_report "PASS: smbmount can mount the public share"
  67 fi
  68 
  69 cmd="mkdir -p $TMNT/a/b/c"
  70 cti_execute_cmd $cmd
  71 if [[ $? != 0 ]]; then
  72         cti_fail "FAIL: $cmd"
  73         return
  74 fi
  75 
  76 cmd="mv $TMNT/a $TMNT/z"
  77 cti_execute_cmd $cmd
  78 if [[ $? != 0 ]]; then
  79         cti_fail "FAIL: $cmd"
  80         return
  81 fi
  82 
  83 cmd="mkdir $TMNT/a"
  84 cti_execute_cmd $cmd
  85 if [[ $? != 0 ]]; then
  86         cti_fail "FAIL: $cmd"
  87         return
  88 fi
  89 
  90 # a should exist, but should have nothing under it.
  91 if [[ -d $TMNT/a/b/c ]] ; then
  92         cti_fail "FAIL: a/b/c/d still exists"
  93         return
  94 fi
  95 
  96 # z should exist, and z/b/c
  97 if [[ ! -d $TMNT/z ]] ; then
  98         cti_fail "FAIL: dir 'z' missing"
  99         return
 100 fi
 101 if [[ ! -d $TMNT/z/b/c ]] ; then
 102         cti_fail "FAIL: dir 'z/b/c/d' missing"
 103         return
 104 fi
 105 
 106 cti_execute_cmd "rm -rf $TMNT/*"
 107 
 108 smbmount_clean $TMNT
 109 cti_pass "$tc_id: PASS"