From eea5959d74d40f74cc51700ca22cbe2f2458914b Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Mon, 11 May 2009 00:51:33 +0000 Subject: [PATCH] rxk5-1557-20090510 LICENSE IPL10 FIXES n/a Update rxk5 branch to 1.5.59. --- Makefile-libafs.in | 5 + Makefile.in | 2 +- README.RXK5 | 163 + acinclude.m4 | 19 +- config.guess | 67 +- configure-libafs.in | 2 +- configure.in | 4 +- doc/man-pages/README | 1 - doc/man-pages/pod1/vos.pod | 12 + doc/man-pages/pod1/vos_examine.pod | 12 +- doc/man-pages/pod1/vos_setfields.pod | 142 + doc/man-pages/pod5/afs.keytab.pod | 73 + doc/man-pages/pod8/afsd.pod | 8 + doc/man-pages/pod8/salvager.pod | 14 +- doc/man-pages/pod8/umich.copyright.pod | 38 + doc/man-pages/pod8/vldb_check.pod | 19 +- doc/txt/winnotes/afs-changes-since-1.2.txt | 117 + src/JAVA/classes/.cvsignore | 1 + src/JAVA/classes/org/openafs/jafs/.cvsignore | 1 + src/NTMakefile | 204 +- src/WINNT/afsd/afsd.h | 2 +- src/WINNT/afsd/afsd_eventlog.c | 20 +- src/WINNT/afsd/afsd_eventmessages.mc | 17 +- src/WINNT/afsd/afsd_init.c | 15 +- src/WINNT/afsd/afsd_service.c | 1 + src/WINNT/afsd/cm_aclent.c | 19 +- src/WINNT/afsd/cm_aclent.h | 2 +- src/WINNT/afsd/cm_btree.c | 118 +- src/WINNT/afsd/cm_btree.h | 14 +- src/WINNT/afsd/cm_callback.c | 5 +- src/WINNT/afsd/cm_cell.c | 2 +- src/WINNT/afsd/cm_config.c | 7 +- src/WINNT/afsd/cm_conn.c | 57 +- src/WINNT/afsd/cm_conn.h | 1 + src/WINNT/afsd/cm_dcache.c | 6 +- src/WINNT/afsd/cm_dir.c | 2 +- src/WINNT/afsd/cm_freelance.c | 90 +- src/WINNT/afsd/cm_ioctl.c | 9 +- src/WINNT/afsd/cm_scache.c | 22 +- src/WINNT/afsd/cm_scache.h | 4 + src/WINNT/afsd/cm_server.c | 72 +- src/WINNT/afsd/cm_server.h | 6 +- src/WINNT/afsd/cm_user.c | 2 +- src/WINNT/afsd/cm_utils.c | 2 + src/WINNT/afsd/cm_vnodeops.c | 143 +- src/WINNT/afsd/cm_vnodeops.h | 6 +- src/WINNT/afsd/cm_volume.c | 74 +- src/WINNT/afsd/rawops.c | 2 +- src/WINNT/afsd/smb.c | 462 +- src/WINNT/afsd/smb.h | 2 + src/WINNT/afsd/smb3.c | 230 +- src/WINNT/afsd/smb_ioctl.c | 2 +- src/WINNT/afskfw/afskfw.c | 4 +- src/WINNT/client_osi/osistatl.c | 4 +- src/WINNT/client_osi/osistatl.h | 4 +- .../en_US/html/ReleaseNotes/logo.htm | 2 +- .../html/ReleaseNotes/relnotes-frames.htm | 2 +- .../en_US/html/ReleaseNotes/relnotes.htm | 4 +- .../ReleaseNotes/relnotes_files/filelist.xml | 11 +- .../en_US/html/ReleaseNotes/toc.htm | 2 +- .../Documentation/en_US/html/index.htm | 4 +- src/WINNT/install/loopback/NTMakefile | 17 +- src/WINNT/netidmgr_plugin/afsnewcreds.c | 4 + src/WINNT/talocale/tal_alloc.cpp | 2 +- src/WINNT/tests/NTMakefile | 31 + src/WINNT/tests/largefiles/NTMakefile | 31 + src/WINNT/tests/largefiles/lftest.c | 169 + src/WINNT/tests/nmtest/NTMakefile | 31 + src/WINNT/tests/nmtest/nmtest.c | 670 + .../tests/torture/DumpAfsLog/DumpAfsLog.c | 258 + .../tests/torture/DumpAfsLog/DumpAfsLog.dsp | 88 + .../tests/torture/DumpAfsLog/DumpAfsLog.dsw | 29 + src/WINNT/tests/torture/DumpAfsLog/NTMakefile | 35 + src/WINNT/tests/torture/NTMakefile | 31 + src/WINNT/tests/torture/Source/NTMakefile | 39 + .../tests/torture/Source/ResolveLocker.c | 154 + src/WINNT/tests/torture/Source/WinThreads.c | 622 + src/WINNT/tests/torture/Source/WinTorture.c | 925 + src/WINNT/tests/torture/Source/nbio.c | 1516 + src/WINNT/tests/torture/Source/output.c | 316 + .../tests/torture/StopStressTest/NTMakefile | 35 + .../torture/StopStressTest/StopStressTest.c | 150 + .../torture/StopStressTest/StopStressTest.dsp | 101 + .../torture/StopStressTest/StopStressTest.dsw | 29 + src/WINNT/tests/torture/Stress/NTMakefile | 35 + src/WINNT/tests/torture/Stress/StdAfx.h | 19 + src/WINNT/tests/torture/Stress/Stress.c | 268 + src/WINNT/tests/torture/Stress/Stress.dsp | 113 + src/WINNT/tests/torture/Stress/Stress.dsw | 29 + .../torture/WinTorture_VC6/wintorture.dsp | 138 + .../torture/WinTorture_VC6/wintorture.dsw | 29 + .../wintorture.dsp | 138 + .../wintorture.dsw | 29 + .../wintorture.vcproj | 346 + .../torture/clients/CopySmallFilesLong.txt | 1782 + .../torture/clients/CopySmallFilesShort.txt | 227 + .../MoveSmallFilesBetweenLockersShort.txt | 254 + .../tests/torture/clients/StreamFiles.txt | 122857 +++++++++++++++ src/WINNT/tests/torture/clients/files.txt | 81 + .../tests/torture/clients/streamfiles.txt | 122857 +++++++++++++++ .../tests/torture/include/ResolveLocker.h | 31 + src/WINNT/tests/torture/include/common.h | 150 + src/WINNT/tests/torture/include/includes.h | 49 + src/WINNT/tests/torture/include/proto.h | 37 + src/WINNT/tests/torture/readme.txt | 123 + src/WINNT/tests/winflock/NTMakefile | 35 + src/WINNT/tests/winflock/winflock.h | 2 + src/afs/AIX/osi_vfsops.c | 2 +- src/afs/AIX/osi_vm.c | 4 +- src/afs/AIX/osi_vnodeops.c | 50 +- src/afs/DARWIN/osi_vfsops.c | 2 +- src/afs/DARWIN/osi_vm.c | 18 +- src/afs/DARWIN/osi_vnodeops.c | 80 +- src/afs/DUX/osi_vfsops.c | 14 +- src/afs/DUX/osi_vnodeops.c | 32 +- src/afs/FBSD/osi_vfsops.c | 2 +- src/afs/FBSD/osi_vnodeops.c | 12 +- src/afs/HPUX/osi_vfsops.c | 2 +- src/afs/IRIX/osi_idbg.c | 16 +- src/afs/IRIX/osi_vfsops.c | 10 +- src/afs/IRIX/osi_vm.c | 12 +- src/afs/IRIX/osi_vnodeops.c | 64 +- src/afs/LINUX/osi_export.c | 172 +- src/afs/LINUX/osi_file.c | 2 +- src/afs/LINUX/osi_groups.c | 11 +- src/afs/LINUX/osi_machdep.h | 2 +- src/afs/LINUX/osi_probe.c | 6 +- src/afs/LINUX/osi_proc.c | 19 +- src/afs/LINUX/osi_vfsops.c | 2 +- src/afs/LINUX/osi_vm.c | 14 +- src/afs/LINUX/osi_vnodeops.c | 79 +- src/afs/NBSD/osi_vfsops.c | 14 +- src/afs/NBSD/osi_vnodeops.c | 32 +- src/afs/OBSD/osi_vnodeops.c | 6 +- src/afs/SOLARIS/osi_file.c | 2 +- src/afs/SOLARIS/osi_vfsops.c | 2 +- src/afs/SOLARIS/osi_vnodeops.c | 42 +- src/afs/UKERNEL/afs_usrops.c | 8 +- src/afs/UKERNEL/osi_vfsops.c | 2 +- src/afs/VNOPS/afs_vnop_access.c | 40 +- src/afs/VNOPS/afs_vnop_attrs.c | 62 +- src/afs/VNOPS/afs_vnop_create.c | 76 +- src/afs/VNOPS/afs_vnop_dirops.c | 71 +- src/afs/VNOPS/afs_vnop_fid.c | 12 +- src/afs/VNOPS/afs_vnop_flock.c | 26 +- src/afs/VNOPS/afs_vnop_link.c | 22 +- src/afs/VNOPS/afs_vnop_lookup.c | 165 +- src/afs/VNOPS/afs_vnop_open.c | 6 +- src/afs/VNOPS/afs_vnop_read.c | 38 +- src/afs/VNOPS/afs_vnop_readdir.c | 46 +- src/afs/VNOPS/afs_vnop_remove.c | 70 +- src/afs/VNOPS/afs_vnop_rename.c | 82 +- src/afs/VNOPS/afs_vnop_strategy.c | 6 +- src/afs/VNOPS/afs_vnop_symlink.c | 148 +- src/afs/VNOPS/afs_vnop_write.c | 64 +- src/afs/afs.h | 112 +- src/afs/afs_bypasscache.c | 26 +- src/afs/afs_call.c | 7 +- src/afs/afs_callback.c | 83 +- src/afs/afs_cbqueue.c | 30 +- src/afs/afs_daemons.c | 26 +- src/afs/afs_dcache.c | 209 +- src/afs/afs_disconnected.c | 586 +- src/afs/afs_dynroot.c | 36 +- src/afs/afs_init.c | 14 +- src/afs/afs_memcache.c | 4 +- src/afs/afs_nfsdisp.c | 16 +- src/afs/afs_osi.h | 4 +- src/afs/afs_osi_alloc.c | 4 +- src/afs/afs_osi_pag.c | 6 +- src/afs/afs_osi_vm.c | 20 +- src/afs/afs_osidnlc.c | 10 +- src/afs/afs_pioctl.c | 152 +- src/afs/afs_prototypes.h | 13 +- src/afs/afs_segments.c | 157 +- src/afs/afs_server.c | 4 +- src/afs/afs_stats.h | 2 +- src/afs/afs_util.c | 2 +- src/afs/afs_vcache.c | 807 +- src/afs/afs_volume.c | 18 +- src/afs/discon.h | 15 +- src/afsd/afsd.c | 103 +- src/afsd/vsys.c | 5 +- src/aklog/Makefile.in | 2 +- src/aklog/aklog_main.c | 23 +- src/audit/audit.c | 8 +- src/auth/authcon.c | 33 +- src/auth/cellconfig.c | 3 + src/auth/cellconfig.p.h | 37 +- src/auth/ktc.c | 9 +- src/auth/libafsdep | 4 + src/auth/userok.c | 6 +- src/bozo/bnode.c | 46 +- src/bozo/bnode.p.h | 23 +- src/bozo/bos.c | 92 +- src/bozo/bos_util.c | 8 +- src/bozo/bosoprocs.c | 242 +- src/bozo/bosprototypes.h | 42 + src/bozo/bosserver.c | 25 +- src/bozo/cronbnodeops.c | 65 +- src/bozo/ezbnodeops.c | 65 +- src/bozo/fsbnodeops.c | 133 +- src/bubasics/Makefile.in | 8 +- src/bubasics/bubasics.h | 6 +- src/bubasics/butm.p.h | 37 +- src/bucoord/bc.p.h | 2 +- src/bucoord/bc_status.c | 19 +- src/bucoord/bucoord_prototypes.h | 194 + src/bucoord/commands.c | 139 +- src/bucoord/config.c | 46 +- src/bucoord/dsstub.c | 29 +- src/bucoord/dsvs.c | 64 +- src/bucoord/dump.c | 83 +- src/bucoord/dump_sched.c | 20 +- src/bucoord/expire.c | 6 +- src/bucoord/main.c | 67 +- src/bucoord/regex.c | 39 +- src/bucoord/regex.h | 14 + src/bucoord/restore.c | 27 +- src/bucoord/server.c | 7 +- src/bucoord/status.c | 31 +- src/bucoord/tape_hosts.c | 14 +- src/bucoord/ubik_db_if.c | 146 +- src/bucoord/vol_sets.c | 24 +- src/bucoord/volstub.c | 15 +- src/budb/budb_prototypes.h | 97 + src/budb/database.c | 11 +- src/budb/database.h | 8 +- src/budb/db_alloc.c | 56 +- src/budb/db_dump.c | 59 +- src/budb/db_hash.c | 227 +- src/budb/db_lock.c | 53 +- src/budb/db_text.c | 81 +- src/budb/dbs_dump.c | 34 +- src/budb/ol_verify.c | 135 +- src/budb/procs.c | 584 +- src/budb/server.c | 77 +- src/budb/struct_ops.c | 126 +- src/butc/dump.c | 9 +- src/butc/tcmain.c | 2 +- src/butm/file_tm.c | 122 +- src/cf/darwin-exp-dc.m4 | 72 + src/cf/java.m4 | 45 + src/cf/k5ssl-crypto.m4 | 113 + src/cf/linux-test1.m4 | 2 +- src/cf/linux-test4.m4 | 57 +- src/cf/socklen.m4 | 18 + src/cf/ssl.m4 | 29 + src/config/NTMakefile | 16 +- src/config/NTMakefile.amd64_w2k | 2 +- src/config/NTMakefile.i386_nt40 | 2 +- src/config/NTMakefile.i386_w2k | 2 +- src/config/afs_args.h | 1 + src/config/afsconfig-windows.h | 3 + src/config/exp2map | 8 + src/config/make_krb_dirs | 83 + src/config/param.alpha_linux_22.h | 1 + src/config/param.alpha_linux_24.h | 1 + src/config/param.alpha_linux_26.h | 3 +- src/config/param.amd64_linux24.h | 2 + src/config/param.amd64_linux26.h | 2 + src/config/param.arm_linux24.h | 1 + src/config/param.arm_linux26.h | 1 + src/config/param.hp_ux110.h | 1 + src/config/param.hp_ux11i.h | 1 + src/config/param.i386_linux22.h | 1 + src/config/param.i386_linux24.h | 2 + src/config/param.i386_linux26.h | 2 + src/config/param.i386_umlinux22.h | 1 + src/config/param.i386_umlinux24.h | 2 + src/config/param.i386_umlinux26.h | 2 + src/config/param.ia64_linux24.h | 2 + src/config/param.ia64_linux26.h | 4 +- src/config/param.parisc_linux24.h | 2 + src/config/param.ppc64_linux24.h | 2 + src/config/param.ppc64_linux26.h | 2 + src/config/param.ppc_linux22.h | 1 + src/config/param.ppc_linux24.h | 2 + src/config/param.ppc_linux26.h | 2 + src/config/param.s390_linux22.h | 1 + src/config/param.s390_linux24.h | 2 + src/config/param.s390_linux26.h | 2 + src/config/param.s390x_linux24.h | 1 + src/config/param.s390x_linux26.h | 1 + src/config/param.sparc64_linux22.h | 1 + src/config/param.sparc64_linux24.h | 2 + src/config/param.sparc64_linux26.h | 2 + src/config/param.sparc_linux22.h | 1 + src/config/param.sparc_linux24.h | 2 + src/config/param.x86_darwin_100.h | 190 + src/config/stds.h | 37 +- src/des/crypt.c | 46 +- src/des/des_prototypes.h | 2 +- src/des/key_sched.c | 2 +- src/des/make_odd.c | 3 +- src/des/quad_cksum.c | 1 + src/des/read_pssword.c | 9 +- src/des/stats.h | 4 +- src/des/strng_to_key.c | 2 +- src/dir/buffer.c | 27 +- src/dir/dir.c | 138 +- src/dir/dir.h | 6 +- src/dir/salvage.c | 109 +- src/fsprobe/fsprobe.c | 62 +- src/fsprobe/fsprobe.h | 6 +- src/fsprobe/fsprobe_callback.c | 17 +- src/fsprobe/fsprobe_test.c | 22 +- src/gtx/X11windows.c | 66 +- src/gtx/curseswindows.c | 90 +- src/gtx/dumbwindows.c | 66 +- src/gtx/frame.c | 126 +- src/gtx/gtxX11win.h | 35 +- src/gtx/gtxcurseswin.h | 32 +- src/gtx/gtxdumbwin.h | 33 +- src/gtx/gtxframe.h | 22 +- src/gtx/gtxinput.h | 3 + src/gtx/gtxkeymap.h | 22 +- src/gtx/gtxlightobj.h | 10 +- src/gtx/gtxobjdict.h | 8 +- src/gtx/gtxobjects.h | 12 +- src/gtx/gtxtest.c | 40 +- src/gtx/gtxtextcb.h | 11 +- src/gtx/gtxtextobj.h | 14 +- src/gtx/gtxwindows.h | 39 +- src/gtx/input.c | 6 +- src/gtx/keymap.c | 51 +- src/gtx/lightobject.c | 28 +- src/gtx/objdict.c | 16 +- src/gtx/objects.c | 30 +- src/gtx/textcb.c | 65 +- src/gtx/textobject.c | 55 +- src/gtx/windows.c | 6 +- src/k5ssl/.cvsignore | 24 + src/k5ssl/libafsdep | 24 + src/kauth/admin_tools.c | 12 +- src/kauth/authclient.c | 2 + src/kauth/ka-forwarder.c | 35 +- src/kauth/kadatabase.c | 124 +- src/kauth/kalocalcell.c | 4 +- src/kauth/kaprocs.c | 521 +- src/kauth/kaserver.h | 1 + src/kauth/kauth_internal.h | 28 + src/kauth/kautils.c | 6 +- src/kauth/kdb.c | 16 +- src/kauth/kpasswd.c | 36 +- src/kauth/rebuild.c | 46 +- src/kauth/user.c | 12 +- src/libacl/aclprocs.c | 47 +- src/libacl/netprocs.c | 6 +- src/libadmin/adminutil/afs_utilAdmin.c | 22 +- src/libadmin/adminutil/afs_utilAdmin.h | 19 +- src/libadmin/afs_Admin.h | 5 +- src/libadmin/bos/afs_bosAdmin.c | 2 + src/libadmin/cfg/cfgclient.c | 2 + src/libadmin/cfg/cfgdb.c | 3 + src/libadmin/cfg/cfghost.c | 3 + src/libadmin/cfg/cfgservers.c | 3 + src/libadmin/client/afs_clientAdmin.c | 1 + src/libadmin/client/afs_clientAdmin.h | 6 +- src/libadmin/kas/afs_kasAdmin.c | 2 + src/libadmin/pts/afs_ptsAdmin.c | 2 + src/libadmin/samples/cm_client_config.c | 8 +- src/libadmin/samples/cm_local_cell.c | 4 + src/libadmin/samples/cm_server_prefs.c | 4 + src/libadmin/samples/rxdebug_basic_stats.c | 4 + src/libadmin/samples/rxdebug_conns.c | 4 + src/libadmin/samples/rxdebug_peers.c | 4 + src/libadmin/samples/rxdebug_rx_stats.c | 4 + .../samples/rxdebug_supported_stats.c | 4 + src/libadmin/samples/rxdebug_version.c | 4 + src/libadmin/samples/rxstat_clear_peer.c | 6 +- src/libadmin/samples/rxstat_clear_process.c | 6 +- src/libadmin/samples/rxstat_disable_peer.c | 8 +- src/libadmin/samples/rxstat_disable_process.c | 8 +- src/libadmin/samples/rxstat_enable_peer.c | 8 +- src/libadmin/samples/rxstat_get_peer.c | 8 +- src/libadmin/samples/rxstat_get_process.c | 6 +- src/libadmin/samples/rxstat_get_version.c | 6 +- src/libadmin/samples/rxstat_query_peer.c | 8 +- src/libadmin/test/afscp.c | 3 + src/libadmin/test/bos.h | 3 + src/libadmin/test/client.h | 3 + src/libadmin/test/kas.h | 3 + src/libadmin/test/util.h | 3 + src/libadmin/test/vos.h | 3 + src/libadmin/vos/afs_vosAdmin.c | 14 +- src/libadmin/vos/lockprocs.h | 1 + src/libadmin/vos/vosadmin.def | 13 +- src/libadmin/vos/vosutils.c | 6 +- src/libadmin/vos/vosutils.h | 4 +- src/libadmin/vos/vsprocs.c | 55 +- src/libadmin/vos/vsprocs.h | 30 +- src/libafs/afs.x86_darwin_100.plist.in | 33 + src/libafsrpc/afsrpc.def | 9 +- src/libafsrpc/linktest.c | 144 + src/packaging/Debian/module/compat | 1 + src/packaging/Debian/module/control | 7 + src/packaging/Debian/module/control.in | 20 + src/packaging/Debian/module/genchanges | 19 + src/packaging/Debian/module/kernel-version | 24 + src/packaging/Debian/module/prep-modules | 103 + src/packaging/Debian/module/rules | 125 + src/packaging/Debian/module/sysname | 134 + src/packaging/MacOS/InstallationCheck.10 | 10 + src/packaging/MacOS/ReadMe.rtf.10 | 13 + src/packaging/RedHat/mockbuild.pl | 32 +- src/packaging/RedHat/openafs-kmodtool | 5 + src/packaging/RedHat/openafs.spec.in | 54 +- src/pam/afs_util.c | 2 + src/ptserver/db_verify.c | 11 +- src/ptserver/map.c | 4 +- src/ptserver/pt_util.c | 44 +- src/ptserver/ptclient.c | 4 +- src/ptserver/ptclient.h | 27 - src/ptserver/ptprocs.c | 474 +- src/ptserver/ptprototypes.h | 94 +- src/ptserver/pts.c | 66 +- src/ptserver/ptserver.c | 15 +- src/ptserver/ptuser.c | 2 +- src/ptserver/ptuser.h | 74 +- src/ptserver/ptutils.c | 21 +- src/ptserver/readgroup.c | 6 +- src/ptserver/readpwd.c | 2 + src/ptserver/testpt.c | 35 +- src/ptserver/ubik.c | 25 +- src/ptserver/utils.c | 20 +- src/rx/LINUX/rx_kmutex.c | 6 +- src/rx/LINUX/rx_knet.c | 2 - src/rx/UKERNEL/rx_knet.c | 1 + src/rx/rx.c | 362 +- src/rx/rx.h | 11 +- src/rx/rx_event.c | 14 +- src/rx/rx_globals.h | 26 +- src/rx/rx_kcommon.c | 21 +- src/rx/rx_kcommon.h | 3 + src/rx/rx_lwp.c | 2 +- src/rx/rx_misc.c | 6 +- src/rx/rx_multi.c | 36 +- src/rx/rx_multi.h | 8 +- src/rx/rx_packet.c | 113 +- src/rx/rx_packet.h | 12 +- src/rx/rx_prototypes.h | 202 +- src/rx/rx_pthread.c | 4 +- src/rx/rx_rdwr.c | 48 +- src/rx/rx_user.c | 4 + src/rx/rx_xmit_nt.c | 322 +- src/rx/rx_xmit_nt.h | 9 +- src/rx/xdr.c | 46 +- src/rx/xdr_array.c | 12 +- src/rx/xdr_arrayn.c | 12 +- src/rx/xdr_float.c | 4 +- src/rx/xdr_int32.c | 4 +- src/rx/xdr_int64.c | 16 +- src/rx/xdr_mem.c | 20 +- src/rx/xdr_prototypes.h | 69 +- src/rx/xdr_rec.c | 106 +- src/rx/xdr_refernce.c | 6 +- src/rx/xdr_rx.c | 40 +- src/rx/xdr_stdio.c | 6 +- src/rx/xdr_update.c | 10 +- src/rxdebug/rxdumptrace.c | 103 + src/rxgen/rpc_cout.c | 4 + src/rxgen/rpc_hout.c | 4 + src/rxgen/rpc_parse.c | 4 + src/rxgk/Makefile.in | 125 + src/rxgk/README | 5 + src/rxgk/krb5.conf.in | 11 + src/rxgk/rxgk.h | 88 + src/rxgk/rxgk_clnt.c | 332 + src/rxgk/rxgk_common.c | 190 + src/rxgk/rxgk_crpc.c | 241 + src/rxgk/rxgk_crypto.c | 574 + src/rxgk/rxgk_err.c | 38 + src/rxgk/rxgk_err.et | 19 + src/rxgk/rxgk_err.h | 35 + src/rxgk/rxgk_info.c | 36 + src/rxgk/rxgk_proto.xg | 227 + src/rxgk/rxgk_proto.ydr.c | 1153 + src/rxgk/rxgk_serv.c | 430 + src/rxgk/rxgk_srpc.c | 221 + src/rxgk/rxgk_ticket.c | 222 + src/rxgk/test.h | 14 + src/rxgk/test.xg | 21 + src/rxgk/test.ydr.c | 43 + src/rxgk/test_client.c | 178 + src/rxgk/test_gss.in | 93 + src/rxgk/test_server.c | 113 + src/rxgk/test_ticket.c | 93 + src/rxk5/.cvsignore | 5 + src/rxk5/libafsdep | 6 + src/rxkad/rxkad_common.c | 10 +- src/rxstat/Makefile.in | 14 +- src/rxstat/NTMakefile | 4 +- src/rxstat/rxstat_prototypes.h | 16 + src/scout/scout.c | 120 +- src/shlibafsrpc/afsrpc.proto | 1 + src/sys/Makefile.in | 5 + src/sys/NTMakefile | 5 +- src/sys/glue.c | 3 - src/sys/iopen.c | 2 +- src/sys/pagsh.c | 10 +- src/sys/rmtsysc.c | 37 +- src/sys/rmtsysd.c | 4 +- src/sys/rmtsysnet.c | 24 +- src/sys/rmtsyss.c | 39 +- src/sys/setpag.c | 8 +- src/sys/sys_prototypes.h | 48 + src/tests/OpenAFS/Auth.pm | 2 +- src/tests/OpenAFS/vos.pm | 3 +- src/tests/OpenAFS/wrapper.pm | 2 +- src/tests/afs-newcell.pl | 3 +- src/tsm41/Makefile.in | 9 +- src/tsm41/aix_aklog.c | 2 + src/tviced/state_analyzer.c | 2 +- src/tvolser/Makefile.in | 4 +- src/ubik/Makefile.in | 4 +- src/ubik/beacon.c | 67 +- src/ubik/disk.c | 32 +- src/ubik/lock.c | 18 +- src/ubik/phys.c | 12 +- src/ubik/recovery.c | 21 +- src/ubik/remote.c | 109 +- src/ubik/ubik.c | 290 +- src/ubik/ubik.p.h | 171 +- src/ubik/ubikclient.c | 81 +- src/ubik/ubikcmd.c | 14 +- src/ubik/udebug.c | 37 +- src/ubik/uinit.c | 5 +- src/ubik/utst_client.c | 46 +- src/ubik/utst_server.c | 39 +- src/ubik/vote.c | 38 +- src/update/client.c | 5 +- src/uss/uss.c | 62 +- src/uss/uss_acl.c | 64 +- src/uss/uss_acl.h | 7 +- src/uss/uss_common.c | 13 +- src/uss/uss_common.h | 7 +- src/uss/uss_fs.c | 91 +- src/uss/uss_fs.h | 21 +- src/uss/uss_kauth.c | 60 +- src/uss/uss_kauth.h | 8 +- src/uss/uss_procs.c | 87 +- src/uss/uss_procs.h | 27 +- src/uss/uss_ptserver.c | 22 +- src/uss/uss_ptserver.h | 6 +- src/uss/uss_vol.c | 99 +- src/uss/uss_vol.h | 18 +- src/util/fstab.c | 26 +- src/util/regex.c | 8 +- src/util/serverLog.c | 2 +- src/venus/cmdebug.c | 18 +- src/venus/fs.c | 121 +- src/venus/fstrace.c | 300 +- src/venus/kdump.c | 210 +- src/venus/livesys.c | 5 +- src/venus/up.c | 7 +- src/vfsck/dirutils.c | 5 +- src/vfsck/inode.c | 2 +- src/vfsck/pass1.c | 2 +- src/viced/afsfileprocs.c | 237 +- src/viced/callback.c | 99 +- src/viced/host.c | 36 +- src/viced/host.h | 14 +- src/viced/viced.c | 19 +- src/vlserver/cnvldb.c | 2 +- src/vlserver/cnvldb.h | 12 +- src/vlserver/vlclient.c | 10 +- src/vlserver/vldb_check.c | 406 +- src/vlserver/vldbint.xg | 36 +- src/vlserver/vlprocs.c | 50 +- src/vlserver/vlserver.c | 2 +- src/vlserver/vlserver.p.h | 6 +- src/vlserver/vlutils.c | 2 +- src/vol/clone.c | 8 +- src/vol/daemon_com.c | 12 +- src/vol/daemon_com.h | 10 +- src/vol/devname.c | 3 +- src/vol/fs_conv_411.c | 1 + src/vol/fssync-debug.c | 61 +- src/vol/fssync-server.c | 116 +- src/vol/fssync.h | 13 + src/vol/gi.c | 7 +- src/vol/ihandle.c | 8 +- src/vol/ihandle.h | 4 +- src/vol/listinodes.c | 18 +- src/vol/namei_ops.c | 105 +- src/vol/namei_ops.h | 8 +- src/vol/ntops.c | 22 +- src/vol/ntops.h | 12 +- src/vol/nuke.c | 4 +- src/vol/partition.c | 18 +- src/vol/partition.h | 2 +- src/vol/physio.c | 2 +- src/vol/purge.c | 10 +- src/vol/salvager.c | 7 +- src/vol/salvsync-server.c | 42 +- src/vol/vnode.c | 201 +- src/vol/vol-info.c | 13 +- src/vol/vol-salvage.c | 28 +- src/vol/volinodes.h | 2 - src/vol/volume.c | 119 +- src/vol/volume.h | 7 +- src/vol/volume_inline.h | 23 + src/vol/vutil.c | 2 +- src/volser/Makefile.in | 16 +- src/volser/NTMakefile | 1 + src/volser/dumpstuff.c | 1 - src/volser/restorevol.c | 2 +- src/volser/vol-dump.c | 4 +- src/volser/vol_split.c | 905 + src/volser/volint.xg | 80 +- src/volser/volmain.c | 18 +- src/volser/volprocs.c | 164 +- src/volser/volser.p.h | 4 +- src/volser/volser_prototypes.h | 56 +- src/volser/vos.c | 172 +- src/volser/vsprocs.c | 118 +- src/volser/vsutils.c | 4 +- src/volser/vsutils_prototypes.h | 5 +- src/xstat/xstat_cm.c | 12 +- src/xstat/xstat_fs.c | 10 +- src/xstat/xstat_fs_callback.c | 4 - src/xstat/xstat_fs_test.c | 4 +- 623 files changed, 273172 insertions(+), 9070 deletions(-) create mode 100644 README.RXK5 create mode 100644 doc/man-pages/pod1/vos_setfields.pod create mode 100644 doc/man-pages/pod5/afs.keytab.pod create mode 100644 doc/man-pages/pod8/umich.copyright.pod create mode 100644 src/JAVA/classes/.cvsignore create mode 100644 src/JAVA/classes/org/openafs/jafs/.cvsignore create mode 100644 src/WINNT/tests/NTMakefile create mode 100644 src/WINNT/tests/largefiles/NTMakefile create mode 100644 src/WINNT/tests/largefiles/lftest.c create mode 100644 src/WINNT/tests/nmtest/NTMakefile create mode 100644 src/WINNT/tests/nmtest/nmtest.c create mode 100644 src/WINNT/tests/torture/DumpAfsLog/DumpAfsLog.c create mode 100644 src/WINNT/tests/torture/DumpAfsLog/DumpAfsLog.dsp create mode 100644 src/WINNT/tests/torture/DumpAfsLog/DumpAfsLog.dsw create mode 100644 src/WINNT/tests/torture/DumpAfsLog/NTMakefile create mode 100644 src/WINNT/tests/torture/NTMakefile create mode 100644 src/WINNT/tests/torture/Source/NTMakefile create mode 100644 src/WINNT/tests/torture/Source/ResolveLocker.c create mode 100644 src/WINNT/tests/torture/Source/WinThreads.c create mode 100644 src/WINNT/tests/torture/Source/WinTorture.c create mode 100644 src/WINNT/tests/torture/Source/nbio.c create mode 100644 src/WINNT/tests/torture/Source/output.c create mode 100644 src/WINNT/tests/torture/StopStressTest/NTMakefile create mode 100644 src/WINNT/tests/torture/StopStressTest/StopStressTest.c create mode 100644 src/WINNT/tests/torture/StopStressTest/StopStressTest.dsp create mode 100644 src/WINNT/tests/torture/StopStressTest/StopStressTest.dsw create mode 100644 src/WINNT/tests/torture/Stress/NTMakefile create mode 100644 src/WINNT/tests/torture/Stress/StdAfx.h create mode 100644 src/WINNT/tests/torture/Stress/Stress.c create mode 100644 src/WINNT/tests/torture/Stress/Stress.dsp create mode 100644 src/WINNT/tests/torture/Stress/Stress.dsw create mode 100644 src/WINNT/tests/torture/WinTorture_VC6/wintorture.dsp create mode 100644 src/WINNT/tests/torture/WinTorture_VC6/wintorture.dsw create mode 100644 src/WINNT/tests/torture/WinTorture_VC6_withoutHesiod/wintorture.dsp create mode 100644 src/WINNT/tests/torture/WinTorture_VC6_withoutHesiod/wintorture.dsw create mode 100644 src/WINNT/tests/torture/WinTorture_VC6_withoutHesiod/wintorture.vcproj create mode 100644 src/WINNT/tests/torture/clients/CopySmallFilesLong.txt create mode 100644 src/WINNT/tests/torture/clients/CopySmallFilesShort.txt create mode 100644 src/WINNT/tests/torture/clients/MoveSmallFilesBetweenLockersShort.txt create mode 100644 src/WINNT/tests/torture/clients/StreamFiles.txt create mode 100644 src/WINNT/tests/torture/clients/files.txt create mode 100644 src/WINNT/tests/torture/clients/streamfiles.txt create mode 100644 src/WINNT/tests/torture/include/ResolveLocker.h create mode 100644 src/WINNT/tests/torture/include/common.h create mode 100644 src/WINNT/tests/torture/include/includes.h create mode 100644 src/WINNT/tests/torture/include/proto.h create mode 100644 src/WINNT/tests/torture/readme.txt create mode 100644 src/WINNT/tests/winflock/NTMakefile create mode 100644 src/auth/libafsdep create mode 100644 src/bucoord/regex.h create mode 100644 src/budb/budb_prototypes.h create mode 100644 src/cf/darwin-exp-dc.m4 create mode 100644 src/cf/java.m4 create mode 100644 src/cf/k5ssl-crypto.m4 create mode 100644 src/cf/socklen.m4 create mode 100644 src/cf/ssl.m4 create mode 100644 src/config/exp2map create mode 100644 src/config/make_krb_dirs create mode 100644 src/config/param.x86_darwin_100.h create mode 100644 src/k5ssl/.cvsignore create mode 100644 src/k5ssl/libafsdep create mode 100644 src/kauth/kauth_internal.h create mode 100644 src/libafs/afs.x86_darwin_100.plist.in create mode 100644 src/libafsrpc/linktest.c create mode 100644 src/packaging/Debian/module/compat create mode 100644 src/packaging/Debian/module/control create mode 100644 src/packaging/Debian/module/control.in create mode 100644 src/packaging/Debian/module/genchanges create mode 100644 src/packaging/Debian/module/kernel-version create mode 100644 src/packaging/Debian/module/prep-modules create mode 100644 src/packaging/Debian/module/rules create mode 100644 src/packaging/Debian/module/sysname create mode 100644 src/packaging/MacOS/InstallationCheck.10 create mode 100644 src/packaging/MacOS/ReadMe.rtf.10 create mode 100644 src/rxdebug/rxdumptrace.c create mode 100644 src/rxgk/Makefile.in create mode 100644 src/rxgk/README create mode 100644 src/rxgk/krb5.conf.in create mode 100644 src/rxgk/rxgk.h create mode 100644 src/rxgk/rxgk_clnt.c create mode 100644 src/rxgk/rxgk_common.c create mode 100644 src/rxgk/rxgk_crpc.c create mode 100644 src/rxgk/rxgk_crypto.c create mode 100644 src/rxgk/rxgk_err.c create mode 100644 src/rxgk/rxgk_err.et create mode 100644 src/rxgk/rxgk_err.h create mode 100644 src/rxgk/rxgk_info.c create mode 100644 src/rxgk/rxgk_proto.xg create mode 100644 src/rxgk/rxgk_proto.ydr.c create mode 100644 src/rxgk/rxgk_serv.c create mode 100644 src/rxgk/rxgk_srpc.c create mode 100644 src/rxgk/rxgk_ticket.c create mode 100644 src/rxgk/test.h create mode 100644 src/rxgk/test.xg create mode 100644 src/rxgk/test.ydr.c create mode 100644 src/rxgk/test_client.c create mode 100644 src/rxgk/test_gss.in create mode 100644 src/rxgk/test_server.c create mode 100644 src/rxgk/test_ticket.c create mode 100644 src/rxk5/.cvsignore create mode 100644 src/rxk5/libafsdep create mode 100644 src/rxstat/rxstat_prototypes.h create mode 100644 src/sys/sys_prototypes.h create mode 100644 src/volser/vol_split.c diff --git a/Makefile-libafs.in b/Makefile-libafs.in index 477ab1c662..c58e804aee 100644 --- a/Makefile-libafs.in +++ b/Makefile-libafs.in @@ -7,5 +7,10 @@ all: cd src/libafs && $(MAKE) + clean: cd src/libafs && $(MAKE) clean + +distclean: clean + rm -f Makefile src/config/Makefile.config src/config/Makefile.version \ + src/libafs/Makefile.common src/libafs/Makefile diff --git a/Makefile.in b/Makefile.in index 713a15fa83..62ba746f13 100644 --- a/Makefile.in +++ b/Makefile.in @@ -235,7 +235,7 @@ tptserver: cmd comerr ptserver tubik libafsrpc libafsauthent echo Not building MT ptserver for ${SYS_NAME} ;; \ esac -kauth: cmd comerr ubik cmd auth comerr ptserver audit libacl kauth_depinstall +kauth: cmd comerr ubik cmd auth comerr ptserver audit libacl kauth_depinstall sys_depinstall ${COMPILE_PART1} kauth ${COMPILE_PART2} dauth: cmd comerr ubik cmd auth $(KAUTH) comerr diff --git a/README.RXK5 b/README.RXK5 new file mode 100644 index 0000000000..93f78bb7b4 --- /dev/null +++ b/README.RXK5 @@ -0,0 +1,163 @@ + RXK5 + +"rxk5" is a kerberos 5 based replacement for rxkad. +See src/rxk5/README for more detailed information on rxk5 design. + +To use rxk5 with openafs, +/1/ build (see notes below) +/2/ install on servers. +/3/ create a service principal: + + afs-k5/@ + + make sure you only select encryption types supported by your + servers. + +/4/ extract and install this service principal's key in: + ${afsconfdir}/afs.keytab + (where ${afsconfdir} might be something like + /etc/openaf/server or /usr/afs/etc) + on each db server and file server in your cell. + You must do this by hand: there are no provisions (yet?) + in bosserver to maintain keytabs or k5 principals or + k5 configuration. + + If you don't want to support rxkad, remove your + KeyFile. You can run both rxkad & rxk5 in parallel, + in which case, you should not remove this file. + You can remove it later after you have finished migrating + all of your clients. + +/5/ if you are supporting multiple "local" kerberos realms, + create ${afsconfdir}/krb.conf + and list all your local kerberos realm realms on the first + line. Your preferred realm should probably be listed first. + If you do not have this file, your local realm is + your cell name upper-cased. When mapping names into + pt names, this file controls which ones are not considered + to be "foreign" principals, so you want to get this right. + +/6/ UserList file: ${afsconfdir}/UserList . + For now for rxk5: if you have names with instances: you + must list them as user/foo or user/foo@realm . + There are a number of issues with this; this logic + may change in the future. + +/7/ for openafs + rxk5, it's more important to make sure that + afs host to realm mapping work right for all your cell db servers. + This is particularly an issue on the clients, but + many of the choices are global. + + * If possible: your realm-name should be the uppercase of your cell name. + + * If possible: your kerberos realm should at least be upper-case. + + * If possible: your db servers should have dns names exactly like: + . + + Especially if the above aren't true then: + + * dns configuration: + + In DNS, you should have host realm mapping txt records, + something like: + _kerberos. TXT REALM-NAME + where matches the last N elements of your host name. + (the krb5 library will start with the fqdn of your "first + db server, then strip leading elements off one by one + until a _kerberos record is found. + The realm-name should NOT be . terminated, and case matters. + + you may also want: + afsdb records for your cell pointing to your db servers. + _kerberos._udp. srv records for your kerberos kdcs. + + * krb5.conf configuration: + + [domain_realm] stanza: + For your local environment, you should use this to map + your local domains into your local kerberos realms, + perhaps also favoured foreign domains & realms. + Listing this can speed performance and improve security. + + [libdefaults] stanza: + Do NOT have this line: default_etypes = des-cbc-crc + + With dns_lookup_realm = 0, + you will disable DNS host_realm mappings. This is + the default with MIT.If you set this to 1, you enable + this, which is the default with Heimdal. Enabling this + might slow down host realm mapping logic, but give better + data for cells outside your local environment. + +Client side, run-time. +Tools generally support the following: + +-localauth -k5 use local keytab, be "god", rxk5 +-localauth -k4 use local keyfile, be "god", rxkad +-localauth keytab if possible, else keyfile, else noauth +-k5 use k5 credentials cache, rxk5 +-ktc (?) use ktc, rxk5 or rxkad. XXX not yet implemented. +-noauth none of the above + +Tools default to either -k5 or -ktc. +XXX may be compile time option? +To alter the default, set +AFS_RXK5_DEFAULT +if set to 1 or yes, forces use of k5 credentials cache, +otherwise, forces use of ktc. +See notes above on host to realm mapping before defaulting +to -k5. If you need to use "-k" on aklog, -k5 on other +commands will not work. +XXX why can't other tools look for afs-k5/@arbitrary-realm? + +Build configuration. + +OS & hardware choices: +rxk5 + openafs has been developed and should work best on i386 linux 2.4, 2.6. +Building and testing for other unix-like architectures is in progress; +solaris or aix may be possibilities for you. A Windows port of rxk5 +is provided, be advised it has received less testing. To build on +Windows a recent MIT KFW development environment is required +(3.2+). These versions include and export ticket-decoding +routines required by rxk5. + +possible kerberos libraries: + heimdal + I've used 0.6.4 in the past. I currently use "CVS head" + as of 20060410, which I recommend in preference to 0.6.4 + or 0.7.2. + configure openafs with: + --enable-rxk5 + --with-krb5-conf=.../krb5-conf + + MIT k5 + not recommended for now. The MIT folks have indicated + they may be willing to support a suitable interface + in some future version of MIT k5. For now, do not use + unless you are willing to patch, build, and support kerberos. + See note in src/rxk5/README for more information. + + shishi + "alpha" quality. Shishi is GPL not LGPL; so there + are probably severe licensing problems if you share + code built with this. You'll have to patch openafs to + make this work; run-time configuration will be special as well. + If you succeed and find it useful: please submit BSD or IPL + compatible patches and documentation to the openafs community. + + k5ssl (standalone) + k5ssl is a partial kerberos implementation inside of openafs. + It's always used inside the cache manager with its own private + crypto library. If you supply real openssl libraries, this + can also be used with the rest of openafs. Since openssl + supports hardware accelleration, this may be particularly useful + and attractive for the afs server. Note that the 524 functionality + of aklog is not available with k5ssl. + configure openafs with: + --with-ssl [=path...] + --with-krb5 + + -Marcus Watts + University of Michigan ITCS UMCE + Mon Sep 4 03:34:05 EDT 2006 diff --git a/acinclude.m4 b/acinclude.m4 index 77afdd25d9..563ed1363c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -313,6 +313,17 @@ dnl Various compiler setup. AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SIGNAL +AC_TYPE_SOCKLEN_T +AC_CHECK_TYPES(sig_t, , , + [#include + #include ]) +AH_BOTTOM( +[#ifndef HAVE_SIG_T +#ifndef SIG_T_DEFINED +#define SIG_T_DEFINED +typedef RETSIGTYPE (*sig_t) (); +#endif +#endif]) COMPILER_HAS_FUNCTION_MACRO dnl Checks for programs. @@ -828,6 +839,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_KMEM_CACHE_INIT LINUX_HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN LINUX_STRUCT_TASK_HAS_CRED + LINUX_STRUCT_PROC_DIR_ENTRY_HAS_OWNER LINUX_HAVE_KMEM_CACHE_T LINUX_KMEM_CACHE_CREATE_TAKES_DTOR dnl XXX ask about LINUX_KERNEL_HAS_NFSSRV @@ -899,6 +911,7 @@ dnl XXX ask about LINUX_KERNEL_HAS_NFSSRV LINUX_REFRIGERATOR LINUX_LINUX_KEYRING_SUPPORT LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK + LINUX_KEY_ALLOC_NEEDS_CRED LINUX_DO_SYNC_READ LINUX_GENERIC_FILE_AIO_READ LINUX_INIT_WORK_HAS_DATA @@ -906,6 +919,10 @@ dnl XXX ask about LINUX_KERNEL_HAS_NFSSRV LINUX_SYSCTL_TABLE_CHECKING LINUX_HAVE_IGET LINUX_HAVE_I_SIZE_READ + LINUX_HAVE_D_ALLOC_ANON + if test "x$ac_cv_linux_d_alloc_anon" = "xno"; then + AC_DEFINE([AFS_NONFSTRANS], 1, [define to disable the nfs translator]) + fi LINUX_FS_STRUCT_NAMEIDATA_HAS_PATH LINUX_EXPORTS_INIT_MM LINUX_EXPORTS_SYS_CHDIR @@ -1552,7 +1569,7 @@ AC_HEADER_DIRENT AC_CHECK_HEADERS(stdlib.h string.h unistd.h poll.h fcntl.h sys/time.h sys/file.h) AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h) AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h) -AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h poll.h) +AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h poll.h sys/pag.h) AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h sys/user.h) AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h regex.h values.h) AC_CHECK_HEADERS(linux/errqueue.h,,,[#include ]) diff --git a/config.guess b/config.guess index 22906b3399..f32079abda 100755 --- a/config.guess +++ b/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2006-03-13' +timestamp='2008-01-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -56,8 +56,8 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -161,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -211,7 +212,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} @@ -329,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -531,7 +532,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[45]) + *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -771,6 +772,8 @@ EOF case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac @@ -778,7 +781,7 @@ EOF i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - i*:MINGW*:*) + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) @@ -788,12 +791,18 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - x86:Interix*:[345]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[345]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; @@ -827,6 +836,16 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) @@ -945,6 +964,9 @@ EOF x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -987,7 +1009,7 @@ EOF LIBC=gnulibc1 # endif #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout @@ -1203,6 +1225,15 @@ EOF SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1453,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/configure-libafs.in b/configure-libafs.in index 1723f30270..0a66473200 100644 --- a/configure-libafs.in +++ b/configure-libafs.in @@ -1,5 +1,5 @@ AC_INIT(src/libafs/Makefile.common.in) -AM_INIT_AUTOMAKE(openafs-libafs,1.5.57) +AM_INIT_AUTOMAKE(openafs-libafs,1.5.59) AC_CONFIG_HEADER(src/config/afsconfig.h) MACOS_VERSION="$VERSION" LINUX_PKGVER="$VERSION" diff --git a/configure.in b/configure.in index fc9e16f049..0fe478111f 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(openafs,1.5.57) +AC_INIT(openafs,1.5.59) AC_CONFIG_SRCDIR(src/config/stds.h) AM_INIT_AUTOMAKE AC_CONFIG_HEADER(src/config/afsconfig.h) @@ -12,7 +12,7 @@ AC_SUBST(LINUX_PKGVER) AC_SUBST(LINUX_PKGREL) AC_PROG_CC -AC_PATH_PROGS([PATH_CPP], [cpp], , [$PATH:/lib:/usr/ccs/lib]) +AC_PATH_PROGS([PATH_CPP], [cpp], [${CC-cc} -E], [$PATH:/lib:/usr/ccs/lib]) AC_SUBST([PATH_CPP]) OPENAFS_CONFIGURE_COMMON diff --git a/doc/man-pages/README b/doc/man-pages/README index 0f86c651ec..546c1ac972 100644 --- a/doc/man-pages/README +++ b/doc/man-pages/README @@ -247,7 +247,6 @@ Known Problems restorevol rmtsysd tokens.krb - vos setfields vsys * Add -noresolve to the documentation of all the vos commands. diff --git a/doc/man-pages/pod1/vos.pod b/doc/man-pages/pod1/vos.pod index b91eaff566..11b69840cb 100644 --- a/doc/man-pages/pod1/vos.pod +++ b/doc/man-pages/pod1/vos.pod @@ -90,6 +90,10 @@ A command to report Volume Server status: B. =item * +A command to change volume fields: B. + +=item * + Commands to obtain help: B and B. =back @@ -211,6 +215,13 @@ command is issued. The B<-fromserver> and B<-toserver> arguments to the B command also accept these name formats. +=item B<-noresolve> + +Shows all servers as IP addresses instead of the DNS name. This is very +useful when the server address is registered as 127.0.0.1 or when dealing +with multi-homed servers. The B<-noresolve> option is available in OpenAFS +versions 1.4.8 or later and 1.5.35 or later. + =item B<-verbose> Produces on the standard output stream a detailed trace of the command's @@ -261,6 +272,7 @@ L, L, L, L, +L, L, L, L, diff --git a/doc/man-pages/pod1/vos_examine.pod b/doc/man-pages/pod1/vos_examine.pod index 0ae5082f09..4f5d00a766 100644 --- a/doc/man-pages/pod1/vos_examine.pod +++ b/doc/man-pages/pod1/vos_examine.pod @@ -170,7 +170,15 @@ expressed in kilobyte blocks in the C field. The date and time the volume was created, in the C field. If the volume has been restored with the B, B, or B command, this is the restore time. +volrestore>, or B command, this is the restore time. For a +read-only volume, this is the last release time. + +=item * + +The date and time this copy of this volume was created, in the C +field. This is the time when the volume was created on this server and +partition. For read-only volumes, it is not updated by a release (unlike +the Creation date). The copy date is not stored in volume dumps. =item * @@ -305,6 +313,7 @@ shows the volume as locked. RWrite 5360870981 ROnly 536870982 Backup 536870983 MaxQuota 40000 K Creation Mon Jun 12 15:22:06 1989 + Copy Mon Jun 12 15:22:06 1989 Last Update Fri Jun 16 09:34:35 1989 5719 accesses in the past day (i.e., vnode references) RWrite: 5360870981 ROnly: 536870982 Backup: 536870983 @@ -323,6 +332,7 @@ the B<-extended> flag. The volume has no read-only replication sites. RWrite 354287190 ROnly 0 Backup 354287192 MaxQuota 5000 K Creation Wed Nov 25 17:38:57 1992 + Copy Wed Nov 25 17:38:57 1992 Last Update Tue Dec 15 10:46:20 1992 598 accesses in the past day (i.e., vnode references) Raw Read/Write Stats diff --git a/doc/man-pages/pod1/vos_setfields.pod b/doc/man-pages/pod1/vos_setfields.pod new file mode 100644 index 0000000000..14931a9dca --- /dev/null +++ b/doc/man-pages/pod1/vos_setfields.pod @@ -0,0 +1,142 @@ +=head1 NAME + +vos_setfields - Sets the quota or clear the access counter on a volume. + +=head1 SYNOPSIS + +=for html +
+ +B S<<< B<-id> > >>> + S<<< B<-maxquota> > >>> [B<-clearuse>] + S<<< [B<-cell> >] >>> [B<-noauth>] [B<-localauth>] + [B<-verbose>] [B<-encrypt>] [b<-noresolve>] [B<-help>] + +B S<<< B<-id> > >>> + S<<< B<-maxquota> > >>> [B<-clearuse>] + S<<< [B<-cell> >] >>> [B<-noauth>] [B<-localauth>] + [B<-verbose>] [B<-encrypt>] [b<-noresolve>] [B<-help>] + +=for html +
+ +=head1 DESCRIPTION + +The B command can set the quota on a volume, and it can +clear the access counter on a volume. This command differs from +B because only the volume name is needed to set the quota, +whereas the path to the volume is needed with B. + +If the B<-maxquota> and B<-clearuse> flags are missing, then no action is +taken. + +=head1 CAUTIONS + +This command is not effective on read-only or backup volumes. + +=head1 OPTIONS + +=over 4 + +=item B<-id> > + +Identifies the volume on which to operate, either by its complete name or +volume ID number. + +=item B<-maxquota> > + +Sets the maximum amount of file server disk space the volume can +occupy. Specify the number of one-kilobyte blocks as a positive integer +(C<1024> is one megabyte). A value of C<0> sets an unlimited quota, but +the size of the disk partition that houses the volume places an absolute +limit on the volume's size. + +=item B<-clearuse> + +Clears the access counter on a volumes, which is shown as C in the B output. + +=item B<-cell> > + +Names the cell in which to run the command. Do not combine this argument +with the B<-localauth> flag. For more details, see L. + +=item B<-noauth> + +Assigns the unprivileged identity C to the issuer. Do not +combine this flag with the B<-localauth> flag. For more details, see +L. + +=item B<-localauth> + +Constructs a server ticket using a key from the local +F file. The B command interpreter presents it +to the Volume Server and Volume Location Server during mutual +authentication. Do not combine this flag with the B<-cell> argument or +B<-noauth> flag. For more details, see L. + +=item B<-encrypt> + +Encrypts the command so that the operation's results are not transmitted +across the network in clear text. + +=item B<-noresolve> + +Shows all servers as IP addresses instead of the DNS name. This is very +useful when the server address is registered as 127.0.0.1 or when dealing +with multi-homed servers. The B<-noresolve> option is available in OpenAFS +versions 1.4.8 or later and 1.5.35 or later. + +=item B<-verbose> + +Produces on the standard output stream a detailed trace of the command's +execution. If this argument is omitted, only warnings and error messages +appear. + +=item B<-help> + +Prints the online help for this command. All other valid options are +ignored. + +=back + +=head1 OUTPUT + +This command produces no output other than error messages. + +=head1 EXAMPLES + +To set a 123KB quota on the root.cell volume, the following command may be +used: + + % vos setfields -id root.cell -maxquota 123 + +To clear the access counter on the root.cell volume, use the following +command: + + % vos setfields -id root.cell -clearuse + +The above commands may be combined as follows: + + % vos setfields -id root.cell -maxquota 123 -clearuse + +=head1 PRIVILEGE REQUIRED + +The issuer must be listed in the F file on the +machine specified with the B<-server> argument and on each database server +machine. If the B<-localauth> flag is included, the issuer must instead be +logged on to a server machine as the local superuser C. + +=head1 SEE ALSO + +L, +L, +L + +=head1 COPYRIGHT + +Copyright 2009 Jason Edgecombe + +This documentation is covered by the BSD License as written in the +doc/LICENSE file. This man page was written by Jason Edgecombe for +OpenAFS. diff --git a/doc/man-pages/pod5/afs.keytab.pod b/doc/man-pages/pod5/afs.keytab.pod new file mode 100644 index 0000000000..4dc88f8a35 --- /dev/null +++ b/doc/man-pages/pod5/afs.keytab.pod @@ -0,0 +1,73 @@ +=head1 NAME + +afs.keytab - Contains AFS server encryption keys + +=head1 DESCRIPTION + +The F file defines the server encryption keys that the AFS server +processes running on the machine use to decrypt the tickets presented by +clients using rxk5. AFS server processes +perform privileged actions only for clients that possess a ticket +encrypted with one of the entries from the file. +The file must reside in the +F directory on every server machine. +If the keytab does not exist when a server process starts up, +that process will decide not to accept any authentication, at least via rxk5. +This is almost never desirable. +For more detailed +information on mutual authentication and server encryption keys, see the +I. + +Each key has a corresponding a key version number that distinguishes it +from the other keys. The tickets that clients present are also marked with +a service principal and key version number to tell the server process which +key to use to decrypt it. The F file must always include the +same principals, keys, and key versions as the corresponding entries in +the realm's kerberos 5 database. + +The F file is in binary format, so always use the appropriate +commands from kerberos to administer it: + +=over 4 + +=item * + +The B command to define a new key. + +=item * + +The B command to display the keys. + +=item * + +The B command to remove a key from the file. + +=back + +This file should contain service principals that are named +afs-k5/I@I . +cell-name should be in lower-case; realm-name should be your kerberos +5 realm, normally the upper-case version of the cell name. + +You can update the keytab at any time, even while server processes are running. +You may need to restart server processes if the keytab did not exist +when they were started. + +In cells that use the Update Server to distribute the contents of the +F directory, it is customary to edit only the copy of the +file stored on the system control machine. Otherwise, edit the file on +each server machine individually. + +=head1 SEE ALSO + +L, +L, +L, +L, +L + +I + +=head1 COPYRIGHT + +See L. diff --git a/doc/man-pages/pod8/afsd.pod b/doc/man-pages/pod8/afsd.pod index 8d0f54ebb8..d46c35e2d6 100644 --- a/doc/man-pages/pod8/afsd.pod +++ b/doc/man-pages/pod8/afsd.pod @@ -29,6 +29,7 @@ B [B<-afsdb>] [B<-backuptree>] [B<-settime>] [B<-shutdown>] S<<< [B<-splitcache> >] >>> S<<< [B<-stat> >] >>> [B<-verbose>] + [B<-disable-dynamic-vcaches>] S<<< [B<-volumes> >] >>> [B<-waitclose>] @@ -669,6 +670,13 @@ standard output stream. Specifies the number of memory structures to allocate for storing volume location information. The default value is C<50>. +=item B<-disable-dynamic-vcaches> + +By default, dynamic vcache overrides the B<-stat> option by using the value of +B<-stat> (or the default) as the initial size of the stat (or vcache) pool and +increases the pool dynamically as needed on supported platforms. This flag will +disable this new functionality and honor the '-stat' setting. + =item B<-waitclose> Has no effect on the operation of the Cache Manager. The behavior it diff --git a/doc/man-pages/pod8/salvager.pod b/doc/man-pages/pod8/salvager.pod index 2057e1502a..f7009c6537 100644 --- a/doc/man-pages/pod8/salvager.pod +++ b/doc/man-pages/pod8/salvager.pod @@ -102,11 +102,13 @@ Salvager by default salvages them serially to avoid the inefficiency of constantly moving the disk head from one partition to another. However, this strategy is often not ideal if the partitions are configured as logical volumes that span multiple disks. To force the Salvager to salvage -logical volumes in parallel, provide the string C as the value for -the B<-parallel> argument. Provide a positive integer to specify the -number of subprocesses to run in parallel (for example, C<-parallel 5all> -for five subprocesses), or omit the integer to run up to four -subprocesses, depending on the number of logical volumes being salvaged. +logical volumes in parallel as if they were on separate disks, provide the +string C as the value for the B<-parallel> argument. + +To set both parameters at the same time, append the number of Salvager +processes to the string C. For example, C<-parallel all5> treats +each partition as a separate disk and runs five Salvager processes, thus +salvaging five partitions at a time. The Salvager creates temporary files as it runs, by default writing them to the partition it is salvaging. The number of files can be quite large, @@ -230,7 +232,7 @@ volumes. Use this value only with such logical volumes. The BOS Server never starts more Salvager subprocesses than there are partitions, and always starts only one process to salvage a single volume. If this argument is omitted, up to four Salvager subprocesses run -in parallel. +in parallel but partitions on the same device are salvaged serially. =item B<-tmpdir> > diff --git a/doc/man-pages/pod8/umich.copyright.pod b/doc/man-pages/pod8/umich.copyright.pod new file mode 100644 index 0000000000..f239cbb7bb --- /dev/null +++ b/doc/man-pages/pod8/umich.copyright.pod @@ -0,0 +1,38 @@ +=head1 NAME + +umich.copyright - omnibus copyright. + +=head1 DESCRIPTION + +All-purpose copyright statement, because online help +should not be an excuse to spew out a long legal manifesto. + +=head1 COPYRIGHT + +Copyright (c) 2005 +The Regents of the University of Michigan +ALL RIGHTS RESERVED + +Permission is granted to use, copy, create derivative works +and redistribute this software and such derivative works +for any purpose, so long as the name of the University of +Michigan is not used in any advertising or publicity +pertaining to the use or distribution of this software +without specific, written prior authorization. If the +above copyright notice or any other identification of the +University of Michigan is included in any copy of any +portion of this software, then the disclaimer below must +also be included. + +This software is provided as is, without representation +from the University of Michigan as to its fitness for any +purpose, and without warranty by the University of +Michigan of any kind, either express or implied, including +without limitation the implied warranties of +merchantability and fitness for a particular purpose. The +regents of the University of Michigan shall not be liable +for any damages, including special, indirect, incidental, or +consequential damages, with respect to any claim arising +out of or in connection with the use of the software, even +if it has been or is hereafter advised of the possibility of +such damages. diff --git a/doc/man-pages/pod8/vldb_check.pod b/doc/man-pages/pod8/vldb_check.pod index ce83949560..0726101a83 100644 --- a/doc/man-pages/pod8/vldb_check.pod +++ b/doc/man-pages/pod8/vldb_check.pod @@ -8,7 +8,7 @@ vldb_check - Checks the integrity of the VLDB
B S<<< B<-database> > >>> [B<-uheader>] [B<-vheader>] - [B<-servers>] [B<-entries>] [B<-verbose>] [B<-help>] + [B<-servers>] [B<-entries>] [B<-quiet> | B<-verbose>] [B<-help>] B S<<< B<-d> > >>> [B<-u>] [B<-vh>] [B<-s>] [B<-e>] [B<-ve>] [B<-h>] @@ -60,10 +60,15 @@ registered for each file server machine in the cell. Outputs every volume entry in the database. The information includes the volume's name and the volume ID number for each of its versions. +=item B<-quiet> + +Blocks output from going to stdout. Output to stderr is not blocked. Cannot +be used with -verbose, -uheader, -servers or -entries. + =item B<-verbose> Reports additional information about the database, including the number of -entries for each type of volume. +entries for each type of volume. Cannot be used with -quiet. =item B<-help> @@ -81,6 +86,16 @@ additional information as described for each option in L. The output is intended for debugging purposes and is meaningful to someone familiar with the internal structure of the VLDB. +The B<-quiet> option can be used to supress the standard output stream +so that the command can be used more easily inside scripts. + +The command exits with one of the following completion codes: + +0: No errors or warnings have been encountered. +1: One or more warnings encountered. +2: One or more warnings and/or errors encountered. +4: A fatal or internal error has occurred and the program cannot proceed. + =head1 PRIVILEGE REQUIRED The issuer must be logged in as the local superuser C. diff --git a/doc/txt/winnotes/afs-changes-since-1.2.txt b/doc/txt/winnotes/afs-changes-since-1.2.txt index fa3dc4e0a0..361bcda34b 100644 --- a/doc/txt/winnotes/afs-changes-since-1.2.txt +++ b/doc/txt/winnotes/afs-changes-since-1.2.txt @@ -1,3 +1,120 @@ +Since 1.5.58 + * PriorityClass of afsd_service.exe process raised to + "High" to match the priority of the system services + that are waiting for afsd_service.exe to respond. + Configurable using [TransarcAFSDaemon\Parameters] + DWORD "PriorityClass" value. (use values from Win32 + API) + + * Change error reporting of CM_ERROR_BADSHARENAME to + use the correct error (NTSTATUS_BAD_NETWORK_PATH). + The error we were sending would cause the smb + redirector to drop the connection. + + * Change the error reporting of CM_ERROR_ALLOFFLINE + and CM_ERROR_ALLDOWN to return NTSTATUS_PATH_NOT_FOUND. + Previous we would return Bad Network Path which + would cause the smb redirector to cancel all file + handles on the same "share". + + * A debug version of afsd_service.exe can now be used + with a release version of afsrpc.dll (or vice versa). + afsrpc.dll now implements and exports xdr_free(). + + * Removed all unprotected OutputDebugString() calls as + those calls can block for up to 10 seconds if there + is contention for the globally shared memory or if + the debugger fails to read data in a timely manner. + + * Visual Studio 2008, WDK 6.1 and DDK 6.1 are now + supported for builds. The production releases still + use VS 2005. + +Since 1.5.57 + * Discovered that XP/2003 supports a variant on recvmsg + called WSARecvMsg. The input parameters are mostly + compatible with the Posix recvmsg. This will save + multiple memcpy() calls per received packet. + + * Discovered that Vista/2008 supports a variant on + sendmsg called WSASendMsg. The input parameters + are mostly compatible with the Posix sendmsg. This + will save multiple memcpy() calls per sent packet. + + * Exporting rx_ReadProc32, rx_WriteProc32 from afsrpc.dll + and utilizing rx_ReadProc32 from within the cache manager + as part of the FetchData operations. rx_ReadProc32 and + rx_WriteProc32 are optimized versions of rx_ReadProc and + rx_WriteProc for use when reading 32-bit integer values. + + * The Network Identity Manager AFS provider now reports + progress events. These provide a better user experience + with Network Identity Manager 2.0. + + * [RT 124293] A race condition exists which permits the + scp field of the an smb_fid_t object to become invalid + after a request on the smb_fid_t has begun. Remove the + race by protecting all access to the scp field with the + smb_fid_t mx mutex and obtaining a local reference on + the cm_scache_t object for the length of the request. + + * [RT 124276] If the vldb is out of sync with the contents + of the file servers, afsd_service will retry too many + times when a file server reports a volume as not being + present. Now if the list reported by the vldb is the + same as the previously seen list, then the retry is + aborted. + + * [RT 124276] Read-only volume failover was broken in + 1.5.53 whenever accessing a volume results in VNOVOL or + VMOVED. + + * [RT 124276] Prior to 1.3.70 the volume server reference + list was not reference counted and would be prematurely + freed while in use. When reference counting was added + in 1.3.70 a bug was introduced that could result in + service reference list corruption. + + * Add Windows Application Event Log warning messages for + "Client SMB MPX value too large" and + "Client SMB Buffer Size too small". + + * Renaming of files across directory boundaries would result + in an invalid handle error when attempting to access the + files after the move. + + * Fix the handling of Tran2 Set Path Info RPCs. Do not fail + when a smb file descriptor cannot be found. The whole point + of using a Path Info function is because an smb file + descriptor wasn't allocated. + + * More edge cases in which dynamic addition of Freelance + root.afs entries would get the wrong FID or where the + root.afs directory would not be refreshed. + + * Buffer overflow could occur if the workstation cell name was + longer than 64 characters. Crashes could occur in + afscreds.exe, afslogon.dll, and afsd_service.exe. + + * VNOSERVICE and VOFFLINE errors were leaking and were exposed + to the smb client. + + * Improve consistency of the bad data version value used for + cm_scache fields. + + * Log file server uuid values as part of the cm_server object + when available. Dump the cm_server object list in response + to "fs memdump". + + * Optimize the performance of resetting access control lists + when tokens are set or removed. + + * Fix vos.exe so that it can work with very large volume + identifiers + + * Remove symlink recursion tests and increase max symlink count + to 64 from 16. + Since 1.5.56 * Undo the "UAC manifest fix" applied to afs_config.exe. diff --git a/src/JAVA/classes/.cvsignore b/src/JAVA/classes/.cvsignore new file mode 100644 index 0000000000..6b468b62a9 --- /dev/null +++ b/src/JAVA/classes/.cvsignore @@ -0,0 +1 @@ +*.class diff --git a/src/JAVA/classes/org/openafs/jafs/.cvsignore b/src/JAVA/classes/org/openafs/jafs/.cvsignore new file mode 100644 index 0000000000..6b468b62a9 --- /dev/null +++ b/src/JAVA/classes/org/openafs/jafs/.cvsignore @@ -0,0 +1 @@ +*.class diff --git a/src/NTMakefile b/src/NTMakefile index 60f6e500e5..db026ab31d 100644 --- a/src/NTMakefile +++ b/src/NTMakefile @@ -48,91 +48,91 @@ RXK5_HEADERS = rxk5_headers DOCD=call $(SRC)\DOLASTCMP.BAT config: - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\config $(CD) $(SRC)\config $(NTMAKE) $(CD) ..\.. procmgmt_headers: config - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\procmgmt $(CD) $(SRC)\procmgmt $(NTMAKE_HEADERS) $(CD) ..\.. afsreg_headers: - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\afsreg $(CD) $(SRC)\WINNT\afsreg $(NTMAKE_HEADERS) $(CD) ..\..\.. lwp_headers: - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\lwp $(CD) $(SRC)\lwp $(NTMAKE_HEADERS) $(CD) ..\.. util: procmgmt_headers afsreg_headers lwp_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. comerr: util - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. afs: comerr - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\afs $(CD) $(SRC)\afs $(NTMAKE) $(CD) ..\.. cmd: afs - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. afsreg: cmd - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. eventlog: afsreg - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. lwp: eventlog - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. rxgen: lwp - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. des: rxgen - echo ***** $@ + @echo ***** $@ ! IF (EXIST($(SRC)\des\NTMakefile)) $(DOCD) $(SRC)\des $(CD) $(SRC)\des @@ -146,503 +146,503 @@ des: rxgen ! ENDIF rx: des - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. rxdebug: rx - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. ubik_headers: rxdebug - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\ubik $(CD) $(SRC)\ubik $(NTMAKE_HEADERS) $(CD) ..\.. rxstat: ubik_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. rxkad: rxstat - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. pthread: rxkad - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. afskfw_headers: pthread - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\afskfw $(CD) $(SRC)\WINNT\afskfw $(NTMAKE_HEADERS) $(CD) ..\..\.. cm_headers: afskfw_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\afsd $(CD) $(SRC)\WINNT\afsd $(NTMAKE_HEADERS) $(CD) ..\..\.. ptserver_headers: cm_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\ptserver $(CD) $(SRC)\ptserver $(NTMAKE_HEADERS) $(CD) ..\.. auth_headers: ptserver_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\auth $(CD) $(SRC)\auth $(NTMAKE_HEADERS) $(CD) ..\.. rxk5_headers: auth_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\rxk5 $(CD) $(SRC)\rxk5 $(NTMAKE_HEADERS) $(CD) ..\.. osi_headers: auth_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\client_osi $(CD) $(SRC)\WINNT\client_osi $(NTMAKE_HEADERS) $(CD) ..\..\.. client_osi: osi_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. -afskfw: client_osi $(RXK5_HEADERS) - echo ***** $@ +afskfw: client_osi $(RXK5_HEADERS) + @echo ***** $@ $(DOCD) $(SRC)\WINNT\afskfw $(CD) $(SRC)\WINNT\afskfw $(NTMAKE) $(CD) ..\..\.. rxk5: afskfw $(RXK5_HEADERS) - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. trxk5: rxk5 - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. procmgmt: pthread $(TRXK5) - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. libacl_headers: procmgmt - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libacl $(CD) $(SRC)\libacl $(NTMAKE_HEADERS) $(CD) ..\.. vlserver_headers: libacl_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\vlserver $(CD) $(SRC)\vlserver $(NTMAKE_HEADERS) $(CD) ..\.. fsint: vlserver_headers - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. audit: fsint - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. afsdobjs: audit afskfw - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\afsd $(CD) $(SRC)\WINNT\afsd $(NTMAKE_OBJS) $(CD) ..\..\.. sys: afsdobjs - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. auth: sys - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. ubik: auth - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. ptserver: ubik - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. libacl: ptserver - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. kauth: libacl - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. vlserver: kauth - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. usd: vlserver - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. bubasics: usd - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. budb: bubasics - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. butm: budb - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. dir: butm - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. vol: dir - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. volser: vol - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. viced: volser - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. update: viced - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. bucoord: update - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. butc: bucoord - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. bozo: butc - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. bosctlsvc: bozo - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. bu_utils: bosctlsvc - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. libafsrpc: bu_utils - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. libafsauthent: libafsrpc - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. tviced: libafsauthent - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. tbutc: tviced - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. talocale: tbutc - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. license: talocale - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. afsd: client_osi license - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. libadmin: afsd - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. adminutil: libadmin - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. vos: adminutil - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. client: vos - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. kas: client - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. pts: kas - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. bos: pts - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. cfg: bos - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\$@ $(CD) $(SRC)\libadmin\$@ $(NTMAKE) $(CD) ..\..\.. admintest: cfg - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\libadmin\test $(CD) $(SRC)\libadmin\test $(NTMAKE) $(CD) ..\..\.. afsadmsvr: admintest - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. afsusrmgr: afsadmsvr - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. afssvrmgr: afsusrmgr - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. afssvrcfg: afssvrmgr - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. afssvrcpa: afssvrcfg - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. client_talocale: afssvrcpa - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\talocale $(CD) $(SRC)\WINNT\talocale $(NTMAKE) $(CD) ..\..\.. client_cpa: client_talocale - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. client_config: client_cpa - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. client_exp: client_config - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. client_creds: client_exp - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. aklog: client_creds - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. xstat: aklog - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. netidmgr_plugin: xstat - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) @@ -650,25 +650,24 @@ netidmgr_plugin: xstat extra: netidmgr_plugin ! IF EXIST($(SRC)\WINNT\extra) && EXIST($(SRC)\WINNT\extra\NTMakefile) - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\WINNT\$@ $(CD) $(SRC)\WINNT\$@ $(NTMAKE) $(CD) ..\..\.. ! ELSE - echo ***** Skipping $@ ***** Not found. + @echo ***** Skipping $@ ***** Not found. ! ENDIF - + finale: extra - echo ***** $@ + @echo ***** $@ $(DOCD) $(SRC)\$@ $(CD) $(SRC)\$@ $(NTMAKE) $(CD) ..\.. install: finale - echo Build Finished Successfully - + @echo Build Finished Successfully # Clean target for obj tree clean: @@ -696,28 +695,33 @@ mkdir: -@copy $(SRC)\config\NTLANG.BAT . loopback: - echo ***** Making Loopback Adapter Utility DLL + @echo ***** Making Loopback Adapter Utility DLL $(DOCD) $(SRC)\WINNT\install\$@ $(CD) $(SRC)\WINNT\install\$@ $(NTMAKE) $(CD) ..\..\..\.. -man-pages: - echo ***** $@ +man-pages: + @echo ***** $@ $(DOCD) $(DOC)\man-pages $(CD) $(DOC)\man-pages $(NTMAKE) $(CD) ..\.. -NSIS: loopback man-pages - echo ***** Making NSIS Installer - $(DOCD) $(SRC)\WINNT\install\$@ - $(CD) $(SRC)\WINNT\install\$@ +NSIS.i386: loopback man-pages + @echo ***** Making NSIS Installer + $(DOCD) $(SRC)\WINNT\install\NSIS + $(CD) $(SRC)\WINNT\install\NSIS $(NTMAKE) $(CD) ..\..\..\.. +NSIS.AMD64: + @echo Skipping NSIS Installer on non-x86 platforms; not implemented + +NSIS: NSIS.$(CPU) + wix: loopback man-pages - echo ***** Making Wix MSI Installer + @echo ***** Making Wix MSI Installer $(DOCD) $(SRC)\WINNT\install\$@ $(CD) $(SRC)\WINNT\install\$@ $(NTMAKE) diff --git a/src/WINNT/afsd/afsd.h b/src/WINNT/afsd/afsd.h index f5289410be..0e0332ba1b 100644 --- a/src/WINNT/afsd/afsd.h +++ b/src/WINNT/afsd/afsd.h @@ -38,9 +38,9 @@ BOOL APIENTRY About(HWND, unsigned int, unsigned int, long); #include "cm_diskcache95.h" #endif /* DISKCACHE95 */ #include "cm_conn.h" +#include "cm_cell.h" #include "cm_aclent.h" #include "cm_server.h" -#include "cm_cell.h" #include "cm_volstat.h" #include "cm_volume.h" #include "cm_dcache.h" diff --git a/src/WINNT/afsd/afsd_eventlog.c b/src/WINNT/afsd/afsd_eventlog.c index 192d8d574b..756392bd7b 100644 --- a/src/WINNT/afsd/afsd_eventlog.c +++ b/src/WINNT/afsd/afsd_eventlog.c @@ -167,7 +167,7 @@ LogEvent(WORD wEventType, DWORD dwEventID, ...) CHAR lpStrings[MAXARGS][STRLEN]; WORD wNumArgs = 0; WORD wNumStrings = 0; - DWORD code; + DWORD code; // Ensure that our event source is properly initialized. if (!AddEventSource()) @@ -209,6 +209,8 @@ LogEvent(WORD wEventType, DWORD dwEventID, ...) break; case MSG_TIME_FLUSH_PER_VOLUME: case MSG_TIME_FLUSH_TOTAL: + case MSG_SMB_MAX_MPX_COUNT: + case MSG_SMB_MAX_BUFFER_SIZE: wNumArgs = 2; lpArgs[0] = va_arg(listArgs, LPTSTR); lpArgs[1] = va_arg(listArgs, LPTSTR); @@ -296,14 +298,14 @@ LogEvent(WORD wEventType, DWORD dwEventID, ...) // Log the event. code = ReportEvent(hEventSource, // handle of event source - wEventType, // event type - 0, // event category - dwEventID, // event ID - NULL, // current user's SID - wNumArgs, // strings in lpszArgs - 0, // no bytes of raw data - wNumArgs ? lpArgs : NULL, // array of error strings - NULL); // no raw data + wEventType, // event type + 0, // event category + dwEventID, // event ID + NULL, // current user's SID + wNumArgs, // strings in lpszArgs + 0, // no bytes of raw data + wNumArgs ? lpArgs : NULL,// array of error strings + NULL); // no raw data DeregisterEventSource(hEventSource); diff --git a/src/WINNT/afsd/afsd_eventmessages.mc b/src/WINNT/afsd/afsd_eventmessages.mc index f01059d0dc..53f48a618d 100644 --- a/src/WINNT/afsd/afsd_eventmessages.mc +++ b/src/WINNT/afsd/afsd_eventmessages.mc @@ -7,7 +7,7 @@ ;// Do not edit the header file. It is autogenerated from ;// afsd_eventmessages.mc. If you edit afsd_eventmessages.mc ;// be sure to ensure the consistency of the data types in LogEvent() -;// +;// located in afsd_eventlog.c ; ;#ifndef __AFSD_EVENTMESSAGES_H_ ;#define __AFSD_EVENTMESSAGES_H_ 1 @@ -358,5 +358,20 @@ Language=English Unexpected SMB Session Close: %1. . +MessageId= +Severity=Warning +Facility=System +SymbolicName=MSG_SMB_MAX_MPX_COUNT +Language=English +MaxMpxCount for client is too large (Client=%1, Server=%2). +. + +MessageId= +Severity=Warning +Facility=System +SymbolicName=MSG_SMB_MAX_BUFFER_SIZE +Language=English +MaxBufferSize for client is too small (Client=%1, Server=%2). +. ;#endif /* __AFSD_EVENTMESSAGES_H_ 1 */ diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index 80744c4ea0..61664221d9 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -464,7 +464,7 @@ static void afsd_InitServerPreferences(void) } else /* add a new server without a cell */ { - tsp = cm_NewServer(&saddr, CM_SERVER_VLDB, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */ + tsp = cm_NewServer(&saddr, CM_SERVER_VLDB, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */ tsp->ipRank = (USHORT)dwRank; } } @@ -534,7 +534,7 @@ static void afsd_InitServerPreferences(void) } else /* add a new server without a cell */ { - tsp = cm_NewServer(&saddr, CM_SERVER_FILE, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */ + tsp = cm_NewServer(&saddr, CM_SERVER_FILE, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */ tsp->ipRank = (USHORT)dwRank; } } @@ -617,6 +617,7 @@ int afsd_InitCM(char **reasonP) int cm_SubnetMask[CM_MAXINTERFACE_ADDR];/* client's subnet mask in host order*/ int cm_NetMtu[CM_MAXINTERFACE_ADDR]; /* client's MTU sizes */ int cm_NetFlags[CM_MAXINTERFACE_ADDR]; /* network flags */ + DWORD dwPriority; WSAStartup(0x0101, &WSAjunk); @@ -666,6 +667,16 @@ int afsd_InitCM(char **reasonP) osi_panic(buf, __FILE__, __LINE__); } + dummyLen = sizeof(dwPriority); + code = RegQueryValueEx(parmKey, "PriorityClass", NULL, NULL, + (BYTE *) &dwPriority, &dummyLen); + if (code != ERROR_SUCCESS || dwPriority == 0) { + dwPriority = HIGH_PRIORITY_CLASS; + } + if (dwPriority != GetPriorityClass(GetCurrentProcess())) + SetPriorityClass(GetCurrentProcess(), dwPriority); + afsi_log("PriorityClass 0x%x", GetPriorityClass(GetCurrentProcess())); + dummyLen = sizeof(lockOrderValidation); code = RegQueryValueEx(parmKey, "LockOrderValidation", NULL, NULL, (BYTE *) &lockOrderValidation, &dummyLen); diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index dc495491aa..a1a8034b41 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -90,6 +90,7 @@ static void afsd_notifier(char *msgp, char *filep, long line) cm_DumpVolumes(afsi_file, "a", 0); cm_DumpSCache(afsi_file, "a", 0); cm_DumpBufHashTable(afsi_file, "a", 0); + cm_DumpServers(afsi_file, "a", 0); smb_DumpVCP(afsi_file, "a", 0); rx_DumpPackets(afsi_file, "a"); rx_DumpCalls(afsi_file, "a"); diff --git a/src/WINNT/afsd/cm_aclent.c b/src/WINNT/afsd/cm_aclent.c index 9182b9ae6e..77a1b5b817 100644 --- a/src/WINNT/afsd/cm_aclent.c +++ b/src/WINNT/afsd/cm_aclent.c @@ -342,7 +342,7 @@ void cm_InvalidateACLUser(cm_scache_t *scp, cm_user_t *userp) * Invalidate ACL info for a user that has just obtained or lost tokens. */ void -cm_ResetACLCache(cm_user_t *userp) +cm_ResetACLCache(cm_cell_t *cellp, cm_user_t *userp) { cm_scache_t *scp; int hash; @@ -350,13 +350,16 @@ cm_ResetACLCache(cm_user_t *userp) lock_ObtainWrite(&cm_scacheLock); for (hash=0; hash < cm_data.scacheHashTableSize; hash++) { for (scp=cm_data.scacheHashTablep[hash]; scp; scp=scp->nextp) { - cm_HoldSCacheNoLock(scp); - lock_ReleaseWrite(&cm_scacheLock); - lock_ObtainWrite(&scp->rw); - cm_InvalidateACLUser(scp, userp); - lock_ReleaseWrite(&scp->rw); - lock_ObtainWrite(&cm_scacheLock); - cm_ReleaseSCacheNoLock(scp); + if (cellp == NULL || + scp->fid.cell == cellp->cellID) { + cm_HoldSCacheNoLock(scp); + lock_ReleaseWrite(&cm_scacheLock); + lock_ObtainWrite(&scp->rw); + cm_InvalidateACLUser(scp, userp); + lock_ReleaseWrite(&scp->rw); + lock_ObtainWrite(&cm_scacheLock); + cm_ReleaseSCacheNoLock(scp); + } } } lock_ReleaseWrite(&cm_scacheLock); diff --git a/src/WINNT/afsd/cm_aclent.h b/src/WINNT/afsd/cm_aclent.h index 27e0ec30ea..fae82bbf7d 100644 --- a/src/WINNT/afsd/cm_aclent.h +++ b/src/WINNT/afsd/cm_aclent.h @@ -47,6 +47,6 @@ extern long cm_ValidateACLCache(void); extern long cm_ShutdownACLCache(void); -extern void cm_ResetACLCache(cm_user_t *userp); +extern void cm_ResetACLCache(cm_cell_t *cellp, cm_user_t *userp); #endif /* _CM_ACLENT_H_ */ diff --git a/src/WINNT/afsd/cm_btree.c b/src/WINNT/afsd/cm_btree.c index 138a4eaba8..942d457349 100644 --- a/src/WINNT/afsd/cm_btree.c +++ b/src/WINNT/afsd/cm_btree.c @@ -1613,7 +1613,7 @@ cm_BPlusDirLookupOriginalName(cm_dirOp_t * op, clientchar_t *centry, */ slot = getSlot(op->scp->dirBplus, leafNode); if (slot <= BTERROR) { - op->scp->dirDataVersion = 0; + op->scp->dirDataVersion = CM_SCACHE_VERSION_BAD; rc = (slot == BTERROR ? EINVAL : ENOENT); goto done; } @@ -2170,8 +2170,9 @@ cm_BPlusEnumAlloc(afs_uint32 entries) } long -cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, - clientchar_t * maskp, cm_direnum_t **enumpp) +cm_BPlusDirEnumerate(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp, + afs_uint32 locked, clientchar_t * maskp, + afs_uint32 fetchStatus, cm_direnum_t **enumpp) { afs_uint32 count = 0, slot, numentries; Nptr leafNode = NONODE, nextLeafNode; @@ -2186,6 +2187,13 @@ cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, if (!locked) lock_ObtainRead(&scp->dirlock); + /* + * Hold a reference to the directory so that it wont' be + * recycled while the enumeration is active. + */ + cm_HoldSCache(scp); + cm_HoldUser(userp); + if (scp->dirBplus == NULL) { osi_Log0(afsd_logp, "cm_BPlusDirEnumerate No BPlus Tree"); rc = CM_ERROR_WOULDBLOCK; @@ -2285,6 +2293,11 @@ cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, nextLeafNode = getnextnode(leafNode); } + enump->dscp = scp; + enump->userp = userp; + enump->reqFlags = reqp->flags; + enump->fetchStatus = fetchStatus; + done: if (!locked) lock_ReleaseRead(&scp->dirlock); @@ -2292,7 +2305,11 @@ cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, /* if we failed, cleanup any mess */ if (rc != 0) { osi_Log0(afsd_logp, "cm_BPlusDirEnumerate rc != 0"); - if (enump) { + + /* release the directory because we failed to generate an enumeration object */ + cm_ReleaseSCache(scp); + cm_ReleaseUser(userp); + if (enump) { for ( count = 0; count < enump->count && enump->entry[count].name; count++ ) { free(enump->entry[count].name); } @@ -2307,11 +2324,17 @@ cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, } long -cm_BPlusDirEnumBulkStat(cm_scache_t *dscp, cm_direnum_t *enump, cm_user_t *userp, cm_req_t *reqp) +cm_BPlusDirEnumBulkStat(cm_direnum_t *enump) { + cm_scache_t *dscp = enump->dscp; + cm_user_t *userp = enump->userp; cm_bulkStat_t *bsp; afs_uint32 count; - afs_uint32 code; + afs_uint32 code = 0; + cm_req_t req; + + cm_InitReq(&req); + req.flags = enump->reqFlags; if ( dscp->fid.cell == AFS_FAKE_ROOT_CELL_ID ) return 0; @@ -2333,6 +2356,7 @@ cm_BPlusDirEnumBulkStat(cm_scache_t *dscp, cm_direnum_t *enump, cm_user_t *userp */ lock_ReleaseWrite(&tscp->rw); cm_ReleaseSCache(tscp); + enump->entry[count].flags |= CM_DIRENUM_FLAG_GOT_STATUS; continue; } lock_ReleaseWrite(&tscp->rw); @@ -2344,21 +2368,82 @@ cm_BPlusDirEnumBulkStat(cm_scache_t *dscp, cm_direnum_t *enump, cm_user_t *userp bsp->fids[i].Volume = enump->entry[count].fid.volume; bsp->fids[i].Vnode = enump->entry[count].fid.vnode; bsp->fids[i].Unique = enump->entry[count].fid.unique; + enump->entry[count].flags |= CM_DIRENUM_FLAG_GOT_STATUS; if (bsp->counter == AFSCBMAX) { - code = cm_TryBulkStatRPC(dscp, bsp, userp, reqp); + code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); memset(bsp, 0, sizeof(cm_bulkStat_t)); } } if (bsp->counter > 0) - code = cm_TryBulkStatRPC(dscp, bsp, userp, reqp); + code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); free(bsp); - return 0; + return code; } -long +static long +cm_BPlusDirEnumBulkStatNext(cm_direnum_t *enump) +{ + cm_scache_t *dscp = enump->dscp; + cm_user_t *userp = enump->userp; + cm_bulkStat_t *bsp; + afs_uint32 count; + afs_uint32 code = 0; + cm_req_t req; + + cm_InitReq(&req); + req.flags = enump->reqFlags; + + if ( dscp->fid.cell == AFS_FAKE_ROOT_CELL_ID ) + return 0; + + bsp = malloc(sizeof(cm_bulkStat_t)); + memset(bsp, 0, sizeof(cm_bulkStat_t)); + + for ( count = enump->next; count < enump->count; count++ ) { + cm_scache_t *tscp = cm_FindSCache(&enump->entry[count].fid); + int i; + + if (tscp) { + if (lock_TryWrite(&tscp->rw)) { + /* we have an entry that we can look at */ + if (!(tscp->flags & CM_SCACHEFLAG_EACCESS) && cm_HaveCallback(tscp)) { + /* we have a callback on it. Don't bother + * fetching this stat entry, since we're happy + * with the info we have. + */ + lock_ReleaseWrite(&tscp->rw); + cm_ReleaseSCache(tscp); + enump->entry[count].flags |= CM_DIRENUM_FLAG_GOT_STATUS; + continue; + } + lock_ReleaseWrite(&tscp->rw); + } /* got lock */ + cm_ReleaseSCache(tscp); + } /* found entry */ + + i = bsp->counter++; + bsp->fids[i].Volume = enump->entry[count].fid.volume; + bsp->fids[i].Vnode = enump->entry[count].fid.vnode; + bsp->fids[i].Unique = enump->entry[count].fid.unique; + enump->entry[count].flags |= CM_DIRENUM_FLAG_GOT_STATUS; + + if (bsp->counter == AFSCBMAX) { + code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); + break; + } + } + + if (bsp->counter > 0 && bsp->counter < AFSCBMAX) + code = cm_TryBulkStatRPC(dscp, bsp, userp, &req); + + free(bsp); + return code; +} + +long cm_BPlusDirNextEnumEntry(cm_direnum_t *enump, cm_direnum_entry_t **entrypp) { if (enump == NULL || entrypp == NULL || enump->next >= enump->count) { @@ -2368,6 +2453,10 @@ cm_BPlusDirNextEnumEntry(cm_direnum_t *enump, cm_direnum_entry_t **entrypp) return CM_ERROR_INVAL; } + if (enump->fetchStatus && + !(enump->entry[enump->next].flags & CM_DIRENUM_FLAG_GOT_STATUS)) + cm_BPlusDirEnumBulkStatNext(enump); + *entrypp = &enump->entry[enump->next++]; if ( enump->next == enump->count ) { osi_Log0(afsd_logp, "cm_BPlusDirNextEnumEntry STOPNOW"); @@ -2387,6 +2476,10 @@ cm_BPlusDirFreeEnumeration(cm_direnum_t *enump) osi_Log0(afsd_logp, "cm_BPlusDirFreeEnumeration"); if (enump) { + /* Release the directory object */ + cm_ReleaseSCache(enump->dscp); + cm_ReleaseUser(enump->userp); + for ( count = 0; count < enump->count && enump->entry[count].name; count++ ) { free(enump->entry[count].name); } @@ -2396,15 +2489,16 @@ cm_BPlusDirFreeEnumeration(cm_direnum_t *enump) } long -cm_BPlusDirEnumTest(cm_scache_t * dscp, afs_uint32 locked) +cm_BPlusDirEnumTest(cm_scache_t * dscp, cm_user_t *userp, cm_req_t *reqp, afs_uint32 locked) { cm_direnum_t * enump = NULL; cm_direnum_entry_t * entryp; long code; + osi_Log0(afsd_logp, "cm_BPlusDirEnumTest start"); - for (code = cm_BPlusDirEnumerate(dscp, locked, NULL, &enump); code == 0; ) { + for (code = cm_BPlusDirEnumerate(dscp, userp, reqp, locked, NULL, 1, &enump); code == 0; ) { code = cm_BPlusDirNextEnumEntry(enump, &entryp); if (code == 0 || code == CM_ERROR_STOPNOW) { char buffer[1024]; diff --git a/src/WINNT/afsd/cm_btree.h b/src/WINNT/afsd/cm_btree.h index 161e8763d0..5c167f15d4 100644 --- a/src/WINNT/afsd/cm_btree.h +++ b/src/WINNT/afsd/cm_btree.h @@ -156,19 +156,27 @@ typedef struct cm_direnum_entry { clientchar_t *name; cm_fid_t fid; normchar_t shortName[13]; + afs_uint32 flags; } cm_direnum_entry_t; +#define CM_DIRENUM_FLAG_GOT_STATUS 1 + typedef struct cm_direnum { + cm_scache_t *dscp; + cm_user_t *userp; + afs_uint32 reqFlags; afs_uint32 count; afs_uint32 next; + afs_uint32 fetchStatus; cm_direnum_entry_t entry[1]; } cm_direnum_t; -long cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, clientchar_t *maskp, cm_direnum_t **enumpp); +long cm_BPlusDirEnumerate(cm_scache_t *dscp, cm_user_t *userp, cm_req_t *reqp, + afs_uint32 locked, clientchar_t *maskp, afs_uint32 fetchStatus, cm_direnum_t **enumpp); long cm_BPlusDirNextEnumEntry(cm_direnum_t *enump, cm_direnum_entry_t **entrypp); long cm_BPlusDirFreeEnumeration(cm_direnum_t *enump); -long cm_BPlusDirEnumTest(cm_scache_t * dscp, afs_uint32 locked); -long cm_BPlusDirEnumBulkStat(cm_scache_t *dscp, cm_direnum_t *enump, cm_user_t *userp, cm_req_t *reqp); +long cm_BPlusDirEnumTest(cm_scache_t * dscp, cm_user_t *userp, cm_req_t *reqp, afs_uint32 locked); +long cm_BPlusDirEnumBulkStat(cm_direnum_t *enump); long cm_InitBPlusDir(void); diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 32f59ab36e..70538d1b21 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -190,8 +190,7 @@ void cm_RevokeCallback(struct rx_call *callp, cm_cell_t * cellp, AFSFid *fidp) scp->fid.vnode == tfid.vnode && scp->fid.unique == tfid.unique && (cellp == NULL || scp->fid.cell == cellp->cellID) && - scp->cbExpires > 0 && - scp->cbServerp != NULL) + cm_HaveCallback(scp)) { cm_HoldSCacheNoLock(scp); lock_ReleaseWrite(&cm_scacheLock); @@ -1537,7 +1536,7 @@ int cm_HaveCallback(cm_scache_t *scp) lock_ObtainWrite(&scp->rw); // now get the lock back return 0; } - return 1; // no change + return (cm_data.fakeDirVersion == scp->dataVersion); } return 0; } diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index 7bf3055e0e..a2a012af39 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -52,7 +52,7 @@ long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *hostnamep) } } else - tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp, probe ? 0 : CM_FLAG_NOPROBE); + tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp, NULL, probe ? 0 : CM_FLAG_NOPROBE); /* Insert the vlserver into a sorted list, sorted by server rank */ tsrp = cm_NewServerRef(tsp, 0); diff --git a/src/WINNT/afsd/cm_config.c b/src/WINNT/afsd/cm_config.c index b15f9738dc..c153066b5d 100644 --- a/src/WINNT/afsd/cm_config.c +++ b/src/WINNT/afsd/cm_config.c @@ -394,7 +394,10 @@ long cm_GetCellServDB(char *cellNamep, afs_uint32 len) return 0; } -/* look up the root cell's name in the Registry */ +/* look up the root cell's name in the Registry + * Input buffer must be at least CELL_MAXNAMELEN + * in size. (Defined in cm_cell.h) + */ long cm_GetRootCellName(char *cellNamep) { DWORD code, dummyLen; @@ -405,7 +408,7 @@ long cm_GetRootCellName(char *cellNamep) if (code != ERROR_SUCCESS) return -1; - dummyLen = 256; + dummyLen = CELL_MAXNAMELEN; code = RegQueryValueEx(parmKey, "Cell", NULL, NULL, cellNamep, &dummyLen); RegCloseKey (parmKey); diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 2641691a60..c769f398ea 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -353,8 +353,9 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, } lock_ReleaseWrite(&cm_serverLock); if (free_svr_list) { - cm_FreeServerList(&serversp, 0); - *serverspp = serversp = NULL; + cm_FreeServerList(serverspp, 0); + serverspp = NULL; + serversp = NULL; free_svr_list = 0; } @@ -428,8 +429,9 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, } if (free_svr_list) { - cm_FreeServerList(&serversp, 0); - *serverspp = serversp = NULL; + cm_FreeServerList(serverspp, 0); + serverspp = NULL; + serversp = NULL; free_svr_list = 0; } retry = 1; @@ -442,6 +444,10 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, char addr[16]; char *format; DWORD msgID; + + /* In case of timeout */ + reqp->volumeError = errorCode; + switch ( errorCode ) { case VNOVOL: msgID = MSG_SERVER_REPORTS_VNOVOL; @@ -481,11 +487,14 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume); } - /* Mark server offline for this volume */ + /* + * Mark server offline for this volume or delete the volume + * from the server list if it was moved or is not present. + */ if (!serversp && fidp) { code = cm_GetServerList(fidp, userp, reqp, &serverspp); if (code == 0) { - serversp = *serverspp = NULL; + serversp = *serverspp; free_svr_list = 1; } } @@ -494,23 +503,39 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (tsrp->status == srv_deleted) continue; + + sprintf(addr, "%d.%d.%d.%d", + ((tsrp->server->addr.sin_addr.s_addr & 0xff)), + ((tsrp->server->addr.sin_addr.s_addr & 0xff00)>> 8), + ((tsrp->server->addr.sin_addr.s_addr & 0xff0000)>> 16), + ((tsrp->server->addr.sin_addr.s_addr & 0xff000000)>> 24)); + if (tsrp->server == serverp) { /* REDIRECT */ if (errorCode == VMOVED || errorCode == VNOVOL) { + osi_Log2(afsd_logp, "volume %d not present on server %s", + fidp->volume, osi_LogSaveString(afsd_logp,addr)); tsrp->status = srv_deleted; if (fidp) cm_RemoveVolumeFromServer(serverp, fidp->volume); } else { + osi_Log2(afsd_logp, "volume %d instance on server %s marked offline", + fidp->volume, osi_LogSaveString(afsd_logp,addr)); tsrp->status = srv_offline; } + /* break; */ + } else { + osi_Log3(afsd_logp, "volume %d exists on server %s with status %u", + fidp->volume, osi_LogSaveString(afsd_logp,addr), tsrp->status); } } lock_ReleaseWrite(&cm_serverLock); /* Free the server list before cm_ForceUpdateVolume is called */ if (free_svr_list) { - cm_FreeServerList(&serversp, 0); - *serverspp = serversp = NULL; + cm_FreeServerList(serverspp, 0); + serverspp = NULL; + serversp = NULL; free_svr_list = 0; } @@ -521,10 +546,14 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, if (code == 0) statep = cm_VolumeStateByID(volp, fidp->volume); - if (errorCode == VMOVED || errorCode == VNOVOL) { + if ((errorCode == VMOVED || errorCode == VNOVOL) && + !(reqp->flags & CM_REQ_VOLUME_UPDATED)) + { code = cm_ForceUpdateVolume(fidp, userp, reqp); if (code) timeLeft = 0; /* prevent a retry on failure */ + else + reqp->flags |= CM_REQ_VOLUME_UPDATED; osi_Log3(afsd_logp, "cm_Analyze called cm_ForceUpdateVolume cell %u vol %u code 0x%x", fidp->cell, fidp->volume, code); } @@ -813,6 +842,16 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, if (connp) cm_PutConn(connp); + /* + * clear the volume updated flag if we succeed. + * this way the flag will not prevent a subsequent volume + * from being updated if necessary. + */ + if (errorCode == 0) + { + reqp->flags &= ~CM_REQ_VOLUME_UPDATED; + } + /* retry until we fail to find a connection */ return retry; } diff --git a/src/WINNT/afsd/cm_conn.h b/src/WINNT/afsd/cm_conn.h index 68b464ce28..d5f41e2790 100644 --- a/src/WINNT/afsd/cm_conn.h +++ b/src/WINNT/afsd/cm_conn.h @@ -55,6 +55,7 @@ typedef struct cm_req { #define CM_REQ_NORETRY 0x1 #define CM_REQ_NEW_CONN_FORCED 0x2 #define CM_REQ_SOURCE_SMB 0x4 +#define CM_REQ_VOLUME_UPDATED 0x8 /* * Vice2 error codes diff --git a/src/WINNT/afsd/cm_dcache.c b/src/WINNT/afsd/cm_dcache.c index d9f99fdb7f..89f4963fe9 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -1506,7 +1506,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp code = StartRXAFS_FetchData64(rxcallp, &tfid, biod.offset.QuadPart, biod.length); if (code == 0) { - temp = rx_Read(rxcallp, (char *) &nbytes_hi, sizeof(afs_int32)); + temp = rx_Read32(rxcallp, &nbytes_hi); if (temp == sizeof(afs_int32)) { nbytes_hi = ntohl(nbytes_hi); } else { @@ -1540,7 +1540,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp } if (code == 0) { - temp = rx_Read(rxcallp, (char *)&nbytes, sizeof(afs_int32)); + temp = rx_Read32(rxcallp, &nbytes); if (temp == sizeof(afs_int32)) { nbytes = ntohl(nbytes); FillInt64(length_found, nbytes_hi, nbytes); @@ -1561,7 +1561,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp /* now copy the data out of the pipe and put it in the buffer */ if (code == 0) { - temp = rx_Read(rxcallp, (char *)&nbytes, sizeof(afs_int32)); + temp = rx_Read32(rxcallp, &nbytes); if (temp == sizeof(afs_int32)) { nbytes = ntohl(nbytes); if (nbytes > biod.length) diff --git a/src/WINNT/afsd/cm_dir.c b/src/WINNT/afsd/cm_dir.c index ceb92ff338..9710e8b564 100644 --- a/src/WINNT/afsd/cm_dir.c +++ b/src/WINNT/afsd/cm_dir.c @@ -1060,7 +1060,7 @@ cm_BeginDirOp(cm_scache_t * scp, cm_user_t * userp, cm_req_t * reqp, bplus_free_tree++; freeBtree(scp->dirBplus); scp->dirBplus = NULL; - scp->dirDataVersion = -1; + scp->dirDataVersion = CM_SCACHE_VERSION_BAD; } if (!scp->dirBplus) { diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index fe2085e045..e557a095dd 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -385,11 +385,13 @@ int cm_reInitLocalMountPoints() { osi_Log0(afsd_logp,"Invalidating local mount point scp... "); - lock_ObtainWrite(&cm_scacheLock); lock_ObtainMutex(&cm_Freelance_Lock); /* always scache then freelance lock */ - for (i=1; i<=cm_noLocalMountPoints; i++) { - cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, i, 1); + for (i=0; i<=cm_noLocalMountPoints; i++) { + if (i == 0) + cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, 1, 1); + else + cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, i*2, i); hash = CM_SCACHE_HASH(&aFid); for (scp=cm_data.scacheHashTablep[hash]; scp; scp=scp->nextp) { if (scp != cm_data.rootSCachep && cm_FidCmp(&scp->fid, &aFid) == 0) { @@ -1064,12 +1066,33 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, fprintf(fp, "%s#%s:%s\n", filename, fullname, volume); fclose(fp); } + + /* Do this while we are holding the lock */ + cm_data.fakeDirVersion++; + cm_localMountPointChangeFlag = 1; lock_ReleaseMutex(&cm_Freelance_Lock); - /* cm_reInitLocalMountPoints(); */ - if (fidp) - cm_SetFid(fidp, fidp->cell, fidp->volume, ++cm_noLocalMountPoints, 1); - cm_noteLocalMountPointChange(); + if (fidp) { + cm_req_t req; + afs_uint32 code; + cm_scache_t *scp; + clientchar_t *cpath; + + cm_InitReq(&req); + + cpath = cm_FsStringToClientStringAlloc(filename, -1, NULL); + if (!cpath) + return CM_ERROR_NOSUCHPATH; + code = cm_NameI(cm_data.rootSCachep, cpath, + CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL, + cm_rootUserp, NULL, &req, &scp); + free(cpath); + if (code) + return code; + *fidp = scp->fid; + cm_ReleaseSCache(scp); + } + return 0; } @@ -1171,13 +1194,14 @@ long cm_FreelanceRemoveMount(char *toremove) rename(hfile2, hfile); } } - - lock_ReleaseMutex(&cm_Freelance_Lock); + if (found) { - cm_noteLocalMountPointChange(); - return 0; - } else - return CM_ERROR_NOSUCHFILE; + /* Do this while we are holding the lock */ + cm_data.fakeDirVersion++; + cm_localMountPointChangeFlag = 1; + } + lock_ReleaseMutex(&cm_Freelance_Lock); + return (found ? 0 : CM_ERROR_NOSUCHFILE); } long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp) @@ -1271,12 +1295,33 @@ long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp) } RegCloseKey(hkFreelanceSymlinks); } + + /* Do this while we are holding the lock */ + cm_data.fakeDirVersion++; + cm_localMountPointChangeFlag = 1; lock_ReleaseMutex(&cm_Freelance_Lock); - /* cm_reInitLocalMountPoints(); */ - if (fidp) - cm_SetFid(fidp, fidp->cell, fidp->volume, ++cm_noLocalMountPoints, 1); - cm_noteLocalMountPointChange(); + if (fidp) { + cm_req_t req; + afs_uint32 code; + cm_scache_t *scp; + clientchar_t *cpath; + + cm_InitReq(&req); + + cpath = cm_FsStringToClientStringAlloc(filename, -1, NULL); + if (!cpath) + return CM_ERROR_NOSUCHPATH; + code = cm_NameI(cm_data.rootSCachep, cpath, + CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL, + cm_rootUserp, NULL, &req, &scp); + free(cpath); + if (code) + return code; + *fidp = scp->fid; + cm_ReleaseSCache(scp); + } + return 0; } @@ -1333,12 +1378,13 @@ long cm_FreelanceRemoveSymlink(char *toremove) RegCloseKey(hkFreelanceSymlinks); } - lock_ReleaseMutex(&cm_Freelance_Lock); if (found) { - cm_noteLocalMountPointChange(); - return 0; - } else - return CM_ERROR_NOSUCHFILE; + /* Do this while we are holding the lock */ + cm_data.fakeDirVersion++; + cm_localMountPointChangeFlag = 1; + } + lock_ReleaseMutex(&cm_Freelance_Lock); + return (found ? 0 : CM_ERROR_NOSUCHFILE); } long diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index cfdca0bb10..73a2f8b985 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -1698,7 +1698,7 @@ cm_IoctlSetSPrefs(struct cm_ioctl *ioctlp, struct cm_user *userp) } else /* add a new server without a cell */ { - tsp = cm_NewServer(&tmp, type, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */ + tsp = cm_NewServer(&tmp, type, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */ tsp->ipRank = rank; } lock_ObtainMutex(&tsp->mx); @@ -2395,7 +2395,7 @@ cm_IoctlSetToken(struct cm_ioctl *ioctlp, struct cm_user *userp) ioctlp->flags |= CM_IOCTLFLAG_LOGON; } - cm_ResetACLCache(userp); + cm_ResetACLCache(cellp, userp); if (release_userp) cm_ReleaseUser(userp); @@ -3003,7 +3003,7 @@ cm_IoctlDelToken(struct cm_ioctl *ioctlp, struct cm_user *userp) lock_ReleaseMutex(&userp->mx); - cm_ResetACLCache(userp); + cm_ResetACLCache(cellp, userp); return 0; } @@ -3046,7 +3046,7 @@ cm_IoctlDelAllToken(struct cm_ioctl *ioctlp, struct cm_user *userp) lock_ReleaseMutex(&userp->mx); - cm_ResetACLCache(userp); + cm_ResetACLCache(NULL, userp); return 0; } @@ -3450,6 +3450,7 @@ cm_IoctlMemoryDump(struct cm_ioctl *ioctlp, struct cm_user *userp) cm_DumpVolumes(hLogFile, cookie, 1); cm_DumpSCache(hLogFile, cookie, 1); cm_DumpBufHashTable(hLogFile, cookie, 1); + cm_DumpServers(hLogFile, cookie, 1); smb_DumpVCP(hLogFile, cookie, 1); rx_DumpCalls(hLogFile, cookie); rx_DumpPackets(hLogFile, cookie); diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index 2d143df85e..066781c6b9 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -127,7 +127,7 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags) bufp->dirty_length = 0; bufp->flags |= CM_BUF_ERROR; bufp->error = VNOVNODE; - bufp->dataVersion = -1; /* bad */ + bufp->dataVersion = CM_BUF_VERSION_BAD; /* bad */ bufp->dirtyCounter++; if (bufp->flags & CM_BUF_WAITING) { osi_Log2(afsd_logp, "CM RecycleSCache Waking [scp 0x%x] bufp 0x%x", scp, bufp); @@ -149,7 +149,7 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags) bufp->dirty_length = 0; bufp->flags |= CM_BUF_ERROR; bufp->error = VNOVNODE; - bufp->dataVersion = -1; /* bad */ + bufp->dataVersion = CM_BUF_VERSION_BAD; /* bad */ bufp->dirtyCounter++; if (bufp->flags & CM_BUF_WAITING) { osi_Log2(afsd_logp, "CM RecycleSCache Waking [scp 0x%x] bufp 0x%x", scp, bufp); @@ -178,8 +178,8 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags) | CM_SCACHEFLAG_OUTOFSPACE | CM_SCACHEFLAG_EACCESS); scp->serverModTime = 0; - scp->dataVersion = 0; - scp->bufDataVersionLow = 0; + scp->dataVersion = CM_SCACHE_VERSION_BAD; + scp->bufDataVersionLow = CM_SCACHE_VERSION_BAD; scp->bulkStatProgress = hzero; scp->waitCount = 0; scp->waitQueueT = NULL; @@ -215,7 +215,7 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags) scp->serverLock = (-1); scp->exclusiveLocks = 0; scp->sharedLocks = 0; - scp->lockDataVersion = -1; + scp->lockDataVersion = CM_SCACHE_VERSION_BAD; /* not locked, but there can be no references to this guy * while we hold the global refcount lock. @@ -556,7 +556,7 @@ cm_ShutdownSCache(void) if (scp->dirBplus) freeBtree(scp->dirBplus); scp->dirBplus = NULL; - scp->dirDataVersion = -1; + scp->dirDataVersion = CM_SCACHE_VERSION_BAD; lock_FinalizeRWLock(&scp->dirlock); #endif lock_FinalizeRWLock(&scp->rw); @@ -606,7 +606,7 @@ void cm_InitSCache(int newFile, long maxSCaches) scp->waitCount = 0; #ifdef USE_BPLUS scp->dirBplus = NULL; - scp->dirDataVersion = -1; + scp->dirDataVersion = CM_SCACHE_VERSION_BAD; #endif scp->waitQueueT = NULL; scp->flags &= ~CM_SCACHEFLAG_WAITING; @@ -1530,8 +1530,8 @@ void cm_MergeStatus(cm_scache_t *dscp, scp->group = 0; scp->unixModeBits = 0; scp->anyAccess = 0; - scp->dataVersion = 0; - scp->bufDataVersionLow = 0; + scp->dataVersion = CM_SCACHE_VERSION_BAD; + scp->bufDataVersionLow = CM_SCACHE_VERSION_BAD; if (dscp) { scp->parentVnode = dscp->fid.vnode; @@ -1549,7 +1549,9 @@ void cm_MergeStatus(cm_scache_t *dscp, dataVersion <<= 32; dataVersion |= statusp->DataVersion; - if (!(flags & CM_MERGEFLAG_FORCE) && dataVersion < scp->dataVersion) { + if (!(flags & CM_MERGEFLAG_FORCE) && + dataVersion < scp->dataVersion && + scp->dataVersion != CM_SCACHE_VERSION_BAD) { struct cm_cell *cellp; cellp = cm_FindCellByID(scp->fid.cell, 0); diff --git a/src/WINNT/afsd/cm_scache.h b/src/WINNT/afsd/cm_scache.h index 1a6d6c2938..49c8e8b89b 100644 --- a/src/WINNT/afsd/cm_scache.h +++ b/src/WINNT/afsd/cm_scache.h @@ -217,12 +217,16 @@ typedef struct cm_scache { osi_queue_t * waitQueueT; /* locked by cm_scacheLock */ } cm_scache_t; +/* dataVersion */ +#define CM_SCACHE_VERSION_BAD 0xFFFFFFFFFFFFFFFF + /* mask field - tell what has been modified */ #define CM_SCACHEMASK_CLIENTMODTIME 1 /* client mod time */ #define CM_SCACHEMASK_LENGTH 2 /* length */ #define CM_SCACHEMASK_TRUNCPOS 4 /* truncation position */ /* fileType values */ +#define CM_SCACHETYPE_UNKNOWN 0 /* unknown */ #define CM_SCACHETYPE_FILE 1 /* a file */ #define CM_SCACHETYPE_DIRECTORY 2 /* a dir */ #define CM_SCACHETYPE_SYMLINK 3 /* a symbolic link */ diff --git a/src/WINNT/afsd/cm_server.c b/src/WINNT/afsd/cm_server.c index 7567d61ccc..545f686e7f 100644 --- a/src/WINNT/afsd/cm_server.c +++ b/src/WINNT/afsd/cm_server.c @@ -870,13 +870,14 @@ void cm_SetServerPrefs(cm_server_t * serverp) else serverp->ipRank = min(serverp->ipRank,CM_IPRANK_MED); /* same net */ } - /* random between 0..15*/ - serverp->ipRank += min(serverp->ipRank, rand() % 0x000f); } /* and of for loop */ + + /* random between 0..15*/ + serverp->ipRank += (rand() % 0x000f); lock_ReleaseRead(&cm_syscfgLock); } -cm_server_t *cm_NewServer(struct sockaddr_in *socketp, int type, cm_cell_t *cellp, afs_uint32 flags) { +cm_server_t *cm_NewServer(struct sockaddr_in *socketp, int type, cm_cell_t *cellp, afsUUID *uuidp, afs_uint32 flags) { cm_server_t *tsp; osi_assertx(socketp->sin_family == AF_INET, "unexpected socket family"); @@ -886,6 +887,10 @@ cm_server_t *cm_NewServer(struct sockaddr_in *socketp, int type, cm_cell_t *cell memset(tsp, 0, sizeof(*tsp)); tsp->type = type; tsp->cellp = cellp; + if (uuidp && !afs_uuid_is_nil(uuidp)) { + tsp->uuid = *uuidp; + tsp->flags |= CM_SERVERFLAG_UUID; + } tsp->refCount = 1; lock_InitializeMutex(&tsp->mx, "cm_server_t mutex", LOCK_HIERARCHY_SERVER); tsp->addr = *socketp; @@ -908,7 +913,7 @@ cm_server_t *cm_NewServer(struct sockaddr_in *socketp, int type, cm_cell_t *cell lock_ReleaseWrite(&cm_serverLock); /* release server lock */ if ( !(flags & CM_FLAG_NOPROBE) ) { - tsp->flags = CM_SERVERFLAG_DOWN; /* assume down; ping will mark up if available */ + tsp->flags |= CM_SERVERFLAG_DOWN; /* assume down; ping will mark up if available */ cm_PingServer(tsp); /* Obtain Capabilities and check up/down state */ } } @@ -1294,3 +1299,62 @@ void cm_FreeServerList(cm_serverRef_t** list, afs_uint32 flags) lock_ReleaseWrite(&cm_serverLock); } + +/* dump all servers to a file. + * cookie is used to identify this batch for easy parsing, + * and it a string provided by a caller + */ +int cm_DumpServers(FILE *outputFile, char *cookie, int lock) +{ + int zilch; + cm_server_t *tsp; + char output[1024]; + char uuidstr[128]; + char hoststr[16]; + + if (lock) + lock_ObtainRead(&cm_serverLock); + + sprintf(output, "%s - dumping servers - cm_numFileServers=%d, cm_numVldbServers=%d\r\n", + cookie, cm_numFileServers, cm_numVldbServers); + WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); + + for (tsp = cm_allServersp; tsp; tsp=tsp->allNextp) + { + char * type; + char * down; + + switch (tsp->type) { + case CM_SERVER_VLDB: + type = "vldb"; + break; + case CM_SERVER_FILE: + type = "file"; + break; + default: + type = "unknown"; + } + + afsUUID_to_string(&tsp->uuid, uuidstr, sizeof(uuidstr)); + afs_inet_ntoa_r(tsp->addr.sin_addr.s_addr, hoststr); + down = ctime(&tsp->downTime); + down[strlen(down)-1] = '\0'; + + sprintf(output, "%s - tsp=0x%p cell=%s addr=%-15s uuid=%s type=%s caps=0x%x flags=0x%x waitCount=%u rank=%u downTime=\"%s\" refCount=%u\r\n", + cookie, tsp, tsp->cellp ? tsp->cellp->name : "", hoststr, uuidstr, type, + tsp->capabilities, tsp->flags, tsp->waitCount, tsp->ipRank, + (tsp->flags & CM_SERVERFLAG_DOWN) ? down : "up", + tsp->refCount); + WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); + } + sprintf(output, "%s - Done dumping servers.\r\n", cookie); + WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); + + if (lock) + lock_ReleaseRead(&cm_serverLock); + + return (0); +} + + + diff --git a/src/WINNT/afsd/cm_server.h b/src/WINNT/afsd/cm_server.h index 93001b668e..61a7d8a0e3 100644 --- a/src/WINNT/afsd/cm_server.h +++ b/src/WINNT/afsd/cm_server.h @@ -37,6 +37,7 @@ typedef struct cm_server { unsigned short ipRank; /* server priority */ cm_server_vols_t * vols; /* by mx */ time_t downTime; /* by mx */ + afsUUID uuid; /* by mx */ } cm_server_t; enum repstate {srv_not_busy, srv_busy, srv_offline, srv_deleted}; @@ -60,6 +61,7 @@ typedef struct cm_serverRef { #define CM_SERVERFLAG_NO64BIT 0x8 /* server has no support for 64-bit operations. */ #define CM_SERVERFLAG_NOINLINEBULK 0x10 /* server has no support for inline bulk */ +#define CM_SERVERFLAG_UUID 0x20 /* server uuid is known */ /* flags for procedures */ #define CM_FLAG_CHECKUPSERVERS 1 /* check working servers */ @@ -78,7 +80,7 @@ typedef struct cm_serverRef { #define CM_MAXINTERFACE_ADDR 16 extern cm_server_t *cm_NewServer(struct sockaddr_in *addrp, int type, - struct cm_cell *cellp, afs_uint32 flags); + struct cm_cell *cellp, afsUUID *uuidp, afs_uint32 flags); extern cm_serverRef_t *cm_NewServerRef(struct cm_server *serverp, afs_uint32 volID); @@ -130,6 +132,8 @@ extern void cm_SetLanAdapterChangeDetected(void); extern void cm_RemoveVolumeFromServer(cm_server_t * serverp, afs_uint32 volID); +extern int cm_DumpServers(FILE *outputFile, char *cookie, int lock); + /* Protected by cm_syscfgLock (rw) */ extern int cm_noIPAddr; /* number of client network interfaces */ extern int cm_IPAddr[CM_MAXINTERFACE_ADDR]; /* client's IP address in host order */ diff --git a/src/WINNT/afsd/cm_user.c b/src/WINNT/afsd/cm_user.c index f09181612d..42b629141b 100644 --- a/src/WINNT/afsd/cm_user.c +++ b/src/WINNT/afsd/cm_user.c @@ -215,7 +215,7 @@ void cm_CheckTokenCache(time_t now) lock_ReleaseMutex(&userp->mx); if (bExpired) { bExpired=FALSE; - cm_ResetACLCache(userp); + cm_ResetACLCache(NULL, userp); } } } diff --git a/src/WINNT/afsd/cm_utils.c b/src/WINNT/afsd/cm_utils.c index 575f78deca..90c12d3a94 100644 --- a/src/WINNT/afsd/cm_utils.c +++ b/src/WINNT/afsd/cm_utils.c @@ -270,6 +270,8 @@ long cm_MapRPCError(long error, cm_req_t *reqp) error = CM_ERROR_QUOTA; else if (error == VNOVNODE) error = CM_ERROR_BADFD; + else if (error == VNOSERVICE || error == VSALVAGE || error == VOFFLINE) + error = CM_ERROR_ALLOFFLINE; else if (error == EISDIR) return CM_ERROR_ISDIR; return error; diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index 81229786a8..480396b90b 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -147,7 +147,7 @@ long cm_CheckOpen(cm_scache_t *scp, int openMode, int trunc, cm_user_t *userp, code = cm_Lock(scp, sLockType, LOffset, LLength, key, 0, userp, reqp, NULL); if (code == 0) { - cm_Unlock(scp, sLockType, LOffset, LLength, key, userp, reqp); + cm_Unlock(scp, sLockType, LOffset, LLength, key, 0, userp, reqp); } else { /* In this case, we allow the file open to go through even though we can't enforce mandatory locking on the @@ -302,7 +302,7 @@ extern long cm_CheckNTOpenDone(cm_scache_t *scp, cm_user_t *userp, cm_req_t *req lock_ObtainWrite(&scp->rw); if (*ldpp) { cm_Unlock(scp, (*ldpp)->sLockType, (*ldpp)->LOffset, (*ldpp)->LLength, - (*ldpp)->key, userp, reqp); + (*ldpp)->key, 0, userp, reqp); free(*ldpp); *ldpp = NULL; } @@ -1188,7 +1188,7 @@ long cm_LookupInternal(cm_scache_t *dscp, clientchar_t *cnamep, long flags, cm_u code = cm_FreelanceAddSymlink(fnamep, fullname, &rock.fid); } } - if (!found || code < 0) { /* add mount point failed, so give up */ + if (!found || code) { /* add mount point failed, so give up */ if (flags & CM_FLAG_CHECKPATH) code = CM_ERROR_NOSUCHPATH; else @@ -1932,17 +1932,13 @@ long cm_NameI(cm_scache_t *rootSCachep, clientchar_t *pathp, long flags, fid_count = i+1; } else { /* add the new fid to the list */ - for ( i=0; ifid, &fids[i]) ) { - code = CM_ERROR_TOO_MANY_SYMLINKS; - cm_ReleaseSCache(nscp); - nscp = NULL; - break; - } - } - if (i == fid_count && fid_count < MAX_FID_COUNT) { - fids[fid_count++] = nscp->fid; - } + if (fid_count == MAX_FID_COUNT) { + code = CM_ERROR_TOO_MANY_SYMLINKS; + cm_ReleaseSCache(nscp); + nscp = NULL; + break; + } + fids[fid_count++] = nscp->fid; } } @@ -3366,9 +3362,6 @@ long cm_Rename(cm_scache_t *oldDscp, fschar_t *oldNamep, clientchar_t *cOldNamep } else { code = 0; } - cm_ReleaseSCache(oldScp); - oldScp = NULL; - if (code) goto done; @@ -3549,31 +3542,28 @@ long cm_Rename(cm_scache_t *oldDscp, fschar_t *oldNamep, clientchar_t *cOldNamep userp, CM_MERGEFLAG_DIROP); lock_ReleaseWrite(&oldDscp->rw); - if (code == 0) { - if (cm_CheckDirOpForSingleChange(&oldDirOp)) { - + if (code == 0 && cm_CheckDirOpForSingleChange(&oldDirOp)) { #ifdef USE_BPLUS - diropCode = cm_BPlusDirLookup(&oldDirOp, cOldNamep, &fileFid); - if (diropCode == CM_ERROR_INEXACT_MATCH) - diropCode = 0; - else if (diropCode == EINVAL) + diropCode = cm_BPlusDirLookup(&oldDirOp, cOldNamep, &fileFid); + if (diropCode == CM_ERROR_INEXACT_MATCH) + diropCode = 0; + else if (diropCode == EINVAL) #endif - diropCode = cm_DirLookup(&oldDirOp, oldNamep, &fileFid); + diropCode = cm_DirLookup(&oldDirOp, oldNamep, &fileFid); - if (diropCode == 0) { - if (oneDir) { - diropCode = cm_DirCreateEntry(&oldDirOp, newNamep, &fileFid); -#ifdef USE_BPLUS - cm_BPlusDirCreateEntry(&oldDirOp, cNewNamep, &fileFid); + if (diropCode == 0) { + if (oneDir) { + diropCode = cm_DirCreateEntry(&oldDirOp, newNamep, &fileFid); +#ifdef USE_BPLUS + cm_BPlusDirCreateEntry(&oldDirOp, cNewNamep, &fileFid); #endif - } + } - if (diropCode == 0) { - diropCode = cm_DirDeleteEntry(&oldDirOp, oldNamep); + if (diropCode == 0) { + diropCode = cm_DirDeleteEntry(&oldDirOp, oldNamep); #ifdef USE_BPLUS - cm_BPlusDirDeleteEntry(&oldDirOp, cOldNamep); -#endif - } + cm_BPlusDirDeleteEntry(&oldDirOp, cOldNamep); +#endif } } } @@ -3592,6 +3582,17 @@ long cm_Rename(cm_scache_t *oldDscp, fschar_t *oldNamep, clientchar_t *cOldNamep userp, CM_MERGEFLAG_DIROP); lock_ReleaseWrite(&newDscp->rw); +#if 0 + /* + * The following optimization does not work. + * When the file server processed a RXAFS_Rename() request the + * FID of the object being moved between directories is not + * preserved. The client does not know the new FID nor the + * version number of the target. Not only can we not create + * the directory entry in the new directory, but we can't + * preserve the cached data for the file. It must be re-read + * from the file server. - jaltman, 2009/02/20 + */ if (code == 0) { /* we only make the local change if we successfully made the change in the old directory AND there was only one @@ -3603,10 +3604,23 @@ long cm_Rename(cm_scache_t *oldDscp, fschar_t *oldNamep, clientchar_t *cOldNamep #endif } } +#endif /* 0 */ cm_EndDirOp(&newDirOp); } + /* + * After the rename the file server has invalidated the callbacks + * on the file that was moved nor do we have a directory reference + * to it anymore. + */ + lock_ObtainWrite(&oldScp->rw); + cm_DiscardSCache(oldScp); + lock_ReleaseWrite(&oldScp->rw); + done: + if (oldScp) + cm_ReleaseSCache(oldScp); + if (free_oldNamep) free(oldNamep); @@ -4854,6 +4868,7 @@ long cm_Unlock(cm_scache_t *scp, unsigned char sLockType, LARGE_INTEGER LOffset, LARGE_INTEGER LLength, cm_key_t key, + afs_uint32 flags, cm_user_t *userp, cm_req_t *reqp) { @@ -4862,12 +4877,19 @@ long cm_Unlock(cm_scache_t *scp, cm_file_lock_t *fileLock; osi_queue_t *q; int release_userp = FALSE; + int exact_match = !(flags & CM_UNLOCK_FLAG_MATCH_RANGE); + int lock_found = 0; + LARGE_INTEGER RangeEnd; osi_Log4(afsd_logp, "cm_Unlock scp 0x%p type 0x%x offset %d length %d", scp, sLockType, (unsigned long)LOffset.QuadPart, (unsigned long)LLength.QuadPart); - osi_Log3(afsd_logp, "... key <0x%x,0x%x,0x%x>", - key.process_id, key.session_id, key.file_id); + osi_Log4(afsd_logp, "... key <0x%x,0x%x,0x%x> flags 0x%x", + key.process_id, key.session_id, key.file_id, flags); + if (!exact_match) + RangeEnd.QuadPart = LOffset.QuadPart + LLength.QuadPart; + + try_again: lock_ObtainRead(&cm_scacheLock); for (q = scp->fileLocksH; q; q = osi_QNext(q)) { @@ -4890,21 +4912,39 @@ long cm_Unlock(cm_scache_t *scp, osi_assertx(FALSE, "invalid fid value"); } #endif - if (!IS_LOCK_DELETED(fileLock) && - cm_KeyEquals(&fileLock->key, &key, 0) && - fileLock->range.offset == LOffset.QuadPart && - fileLock->range.length == LLength.QuadPart) { - break; + if (exact_match) { + if (!IS_LOCK_DELETED(fileLock) && + cm_KeyEquals(&fileLock->key, &key, 0) && + fileLock->range.offset == LOffset.QuadPart && + fileLock->range.length == LLength.QuadPart) { + lock_found = 1; + break; + } + } else { + + if (!IS_LOCK_DELETED(fileLock) && + cm_KeyEquals(&fileLock->key, &key, 0) && + fileLock->range.offset >= LOffset.QuadPart && + fileLock->range.offset < RangeEnd.QuadPart && + (fileLock->range.offset + fileLock->range.length) <= RangeEnd.QuadPart) { + lock_found = 1; + break; + } } } if (!q) { - osi_Log0(afsd_logp, "cm_Unlock lock not found; failure"); - lock_ReleaseRead(&cm_scacheLock); - /* The lock didn't exist anyway. *shrug* */ - return CM_ERROR_RANGE_NOT_LOCKED; + if (lock_found && !exact_match) { + code = 0; + goto done; + } else { + osi_Log0(afsd_logp, "cm_Unlock lock not found; failure"); + + /* The lock didn't exist anyway. *shrug* */ + return CM_ERROR_RANGE_NOT_LOCKED; + } } /* discard lock record */ @@ -5029,8 +5069,13 @@ long cm_Unlock(cm_scache_t *scp, } } - if (release_userp) + if (release_userp) { cm_ReleaseUser(userp); + release_userp = FALSE; + } + + if (!exact_match) + goto try_again; /* might be more than one lock in the range */ done: @@ -5069,7 +5114,7 @@ void cm_LockMarkSCacheLost(cm_scache_t * scp) } scp->serverLock = -1; - scp->lockDataVersion = -1; + scp->lockDataVersion = CM_SCACHE_VERSION_BAD; lock_ReleaseWrite(&cm_scacheLock); } diff --git a/src/WINNT/afsd/cm_vnodeops.h b/src/WINNT/afsd/cm_vnodeops.h index 4f403cb2c7..0c3a8a4029 100644 --- a/src/WINNT/afsd/cm_vnodeops.h +++ b/src/WINNT/afsd/cm_vnodeops.h @@ -204,9 +204,11 @@ extern long cm_UnlockByKey(cm_scache_t * scp, cm_user_t * userp, cm_req_t * reqp); +#define CM_UNLOCK_FLAG_MATCH_RANGE 0x01 + extern long cm_Unlock(cm_scache_t *scp, unsigned char sLockType, LARGE_INTEGER LOffset, LARGE_INTEGER LLength, cm_key_t key, - cm_user_t *userp, cm_req_t *reqp); + afs_uint32 flags, cm_user_t *userp, cm_req_t *reqp); extern long cm_LockCheckRead(cm_scache_t *scp, LARGE_INTEGER LOffset, @@ -235,7 +237,7 @@ extern cm_key_t cm_GenerateKey(afs_uint16 session_id, afs_offs_t process_id, afs extern int cm_KeyEquals(cm_key_t * k1, cm_key_t * k2, int flags); -#define MAX_SYMLINK_COUNT 16 +#define MAX_SYMLINK_COUNT 64 /* make this big enough so that one buffer of dir pages won't overflow. We'll * check anyway, but we want to minimize the chance that we have to leave stuff diff --git a/src/WINNT/afsd/cm_volume.c b/src/WINNT/afsd/cm_volume.c index 5f8fe841bd..e41d05a737 100644 --- a/src/WINNT/afsd/cm_volume.c +++ b/src/WINNT/afsd/cm_volume.c @@ -163,7 +163,8 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * cm_volume_t *volp) { cm_conn_t *connp; - int i, j, k; + int i; + afs_uint32 j, k; cm_serverRef_t *tsrp; cm_server_t *tsp; struct sockaddr_in tsockAddr; @@ -321,6 +322,7 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * afs_int32 bkID; afs_int32 serverNumber[NMAXNSERVERS]; afs_int32 serverFlags[NMAXNSERVERS]; + afsUUID serverUUID[NMAXNSERVERS]; afs_int32 rwServers_alldown = 1; afs_int32 roServers_alldown = 1; afs_int32 bkServers_alldown = 1; @@ -331,6 +333,8 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * rwServers_alldown = 0; #endif + memset(serverUUID, 0, sizeof(serverUUID)); + switch ( method ) { case 0: flags = vldbEntry.flags; @@ -406,9 +410,10 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * for (k = 0; k < nentries && j < NMAXNSERVERS; j++, k++) { serverFlags[j] = uvldbEntry.serverFlags[i]; serverNumber[j] = addrp[k]; + serverUUID[j] = uuid; } - free(addrs.bulkaddrs_val); /* This is wrong */ + xdr_free(addrs.bulkaddrs_val, addrs.bulkaddrs_len * sizeof(*addrs.bulkaddrs_val)); if (nentries == 0) code = CM_ERROR_INVAL; @@ -491,19 +496,48 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * tempAddr = htonl(serverNumber[i]); tsockAddr.sin_addr.s_addr = tempAddr; tsp = cm_FindServer(&tsockAddr, CM_SERVER_FILE); + if (tsp && (method == 2) && (tsp->flags & CM_SERVERFLAG_UUID)) { + /* + * Check to see if the uuid of the server we know at this address + * matches the uuid of the server we are being told about by the + * vlserver. If not, ...? + */ + if (!afs_uuid_equal(&serverUUID[i], &tsp->uuid)) { + char uuid1[128], uuid2[128]; + char hoststr[16]; + + afsUUID_to_string(&serverUUID[i], uuid1, sizeof(uuid1)); + afsUUID_to_string(&tsp->uuid, uuid2, sizeof(uuid2)); + afs_inet_ntoa_r(serverNumber[i], hoststr); + + osi_Log3(afsd_logp, "cm_UpdateVolumeLocation UUIDs do not match! %s != %s (%s)", + osi_LogSaveString(afsd_logp, uuid1), + osi_LogSaveString(afsd_logp, uuid2), + osi_LogSaveString(afsd_logp, hoststr)); + } + } if (!tsp) { /* cm_NewServer will probe the server which in turn will * update the state on the volume group object */ lock_ReleaseWrite(&volp->rw); - tsp = cm_NewServer(&tsockAddr, CM_SERVER_FILE, cellp, 0); + tsp = cm_NewServer(&tsockAddr, CM_SERVER_FILE, cellp, &serverUUID[i], 0); lock_ObtainWrite(&volp->rw); } - /* if this server was created by fs setserverprefs */ - if ( !tsp->cellp ) - tsp->cellp = cellp; - osi_assertx(tsp != NULL, "null cm_server_t"); + /* + * if this server was created by fs setserverprefs + * then it won't have either a cell assignment or + * a server uuid. + */ + if ( !tsp->cellp ) + tsp->cellp = cellp; + if ( (method == 2) && !(tsp->flags & CM_SERVERFLAG_UUID) && + !afs_uuid_is_nil(&serverUUID[i])) { + tsp->uuid = serverUUID[i]; + tsp->flags |= CM_SERVERFLAG_UUID; + } + /* and add it to the list(s). */ /* * Each call to cm_NewServerRef() increments the @@ -1283,6 +1317,7 @@ cm_UpdateVolumeStatusInt(cm_volume_t *volp, struct cm_vol_state *statep) cm_serverRef_t *tsrp; cm_server_t *tsp; int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1; + char addr[16]; if (!volp || !statep) { #ifdef DEBUG @@ -1293,29 +1328,50 @@ cm_UpdateVolumeStatusInt(cm_volume_t *volp, struct cm_vol_state *statep) lock_ObtainWrite(&cm_serverLock); for (tsrp = statep->serversp; tsrp; tsrp=tsrp->next) { - if (tsrp->status == srv_deleted) - continue; tsp = tsrp->server; + sprintf(addr, "%d.%d.%d.%d", + ((tsp->addr.sin_addr.s_addr & 0xff)), + ((tsp->addr.sin_addr.s_addr & 0xff00)>> 8), + ((tsp->addr.sin_addr.s_addr & 0xff0000)>> 16), + ((tsp->addr.sin_addr.s_addr & 0xff000000)>> 24)); + + if (tsrp->status == srv_deleted) { + osi_Log2(afsd_logp, "cm_UpdateVolumeStatusInt volume %d server reference %s deleted", + statep->ID, osi_LogSaveString(afsd_logp,addr)); + continue; + } if (tsp) { cm_GetServerNoLock(tsp); if (!(tsp->flags & CM_SERVERFLAG_DOWN)) { allDown = 0; if (tsrp->status == srv_busy) { + osi_Log2(afsd_logp, "cm_UpdateVolumeStatusInt volume %d server reference %s busy", + statep->ID, osi_LogSaveString(afsd_logp,addr)); allOffline = 0; someBusy = 1; } else if (tsrp->status == srv_offline) { + osi_Log2(afsd_logp, "cm_UpdateVolumeStatusInt volume %d server reference %s offline", + statep->ID, osi_LogSaveString(afsd_logp,addr)); allBusy = 0; someOffline = 1; } else { + osi_Log2(afsd_logp, "cm_UpdateVolumeStatusInt volume %d server reference %s online", + statep->ID, osi_LogSaveString(afsd_logp,addr)); allOffline = 0; allBusy = 0; } + } else { + osi_Log2(afsd_logp, "cm_UpdateVolumeStatusInt volume %d server reference %s online", + statep->ID, osi_LogSaveString(afsd_logp,addr)); } cm_PutServerNoLock(tsp); } } lock_ReleaseWrite(&cm_serverLock); + osi_Log5(afsd_logp, "cm_UpdateVolumeStatusInt allDown %d allBusy %d someBusy %d someOffline %d allOffline %d", + allDown, allBusy, someBusy, someOffline, allOffline); + if (allDown) newStatus = vl_alldown; else if (allBusy || (someBusy && someOffline)) diff --git a/src/WINNT/afsd/rawops.c b/src/WINNT/afsd/rawops.c index 1debe4c156..4858379a31 100644 --- a/src/WINNT/afsd/rawops.c +++ b/src/WINNT/afsd/rawops.c @@ -284,7 +284,7 @@ long WriteData(cm_scache_t *scp, osi_hyper_t offset, long count, char *op, (count >= buf_bufferSize || LargeIntegerGreaterThanOrEqualTo(LargeIntegerAdd(offset, ConvertLongToLargeInteger(count)), minLength))) { if (count < buf_bufferSize - && bufferp->dataVersion == -1) + && bufferp->dataVersion == CM_BUF_VERSION_BAD) memset(bufferp->datap, 0, buf_bufferSize); bufferp->dataVersion = scp->dataVersion; diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index f5a0092630..02a6ff041e 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -819,6 +819,61 @@ void smb_UnixTimeFromDosUTime(time_t *unixTimep, afs_uint32 dosTime) *unixTimep = dosTime + smb_localZero; } +void smb_MarkAllVCsDead(smb_vc_t * exclude) +{ + smb_vc_t *vcp; + smb_vc_t **vcp_to_cleanup = NULL; + int n_to_cleanup = 0; + int i; + + osi_Log1(smb_logp, "Marking all VCs as dead excluding %p", exclude); + + lock_ObtainWrite(&smb_globalLock); /* for dead_sessions[] */ + lock_ObtainWrite(&smb_rctLock); + for (vcp = smb_allVCsp; vcp; vcp = vcp->nextp) { + + if (vcp->magic != SMB_VC_MAGIC) + osi_panic("afsd: invalid smb_vc_t detected in smb_allVCsp", + __FILE__, __LINE__); + + if (vcp == exclude) + continue; + + lock_ObtainMutex(&vcp->mx); + if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) { + vcp->flags |= SMB_VCFLAG_ALREADYDEAD; + lock_ReleaseMutex(&vcp->mx); + dead_sessions[vcp->session] = TRUE; + } else { + lock_ReleaseMutex(&vcp->mx); + } + n_to_cleanup ++; + } + + vcp_to_cleanup = malloc(sizeof(vcp_to_cleanup[0]) * n_to_cleanup); + i = 0; + for (vcp = smb_allVCsp; vcp; vcp = vcp->nextp) { + if (vcp == exclude) + continue; + + vcp_to_cleanup[i++] = vcp; + smb_HoldVCNoLock(vcp); + } + + osi_assert(i == n_to_cleanup); + + lock_ReleaseWrite(&smb_rctLock); + lock_ReleaseWrite(&smb_globalLock); + + for (i=0; i < n_to_cleanup; i++) { + smb_CleanupDeadVC(vcp_to_cleanup[i]); + smb_ReleaseVC(vcp_to_cleanup[i]); + vcp_to_cleanup[i] = 0; + } + + free(vcp_to_cleanup); +} + #ifdef DEBUG_SMB_REFCOUNT smb_vc_t *smb_FindVCDbg(unsigned short lsn, int flags, int lana, char *file, long line) #else @@ -834,11 +889,14 @@ smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana) osi_panic("afsd: invalid smb_vc_t detected in smb_allVCsp", __FILE__, __LINE__); + lock_ObtainMutex(&vcp->mx); if (lsn == vcp->lsn && lana == vcp->lana && !(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) { + lock_ReleaseMutex(&vcp->mx); smb_HoldVCNoLock(vcp); break; } + lock_ReleaseMutex(&vcp->mx); } if (!vcp && (flags & SMB_FLAG_CREATE)) { vcp = malloc(sizeof(*vcp)); @@ -929,7 +987,6 @@ static int smb_Is8Dot3StarMask(clientchar_t *maskp) static int smb_IsStarMask(clientchar_t *maskp) { - int i; clientchar_t tc; while (*maskp) { @@ -1609,25 +1666,61 @@ smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags) return fidp; } + +/* Must not be called with scp->rw held because smb_ReleaseFID might be called */ #ifdef DEBUG_SMB_REFCOUNT smb_fid_t *smb_FindFIDByScacheDbg(smb_vc_t *vcp, cm_scache_t * scp, char *file, long line) #else smb_fid_t *smb_FindFIDByScache(smb_vc_t *vcp, cm_scache_t * scp) #endif { - smb_fid_t *fidp = NULL; - int newFid = 0; + smb_fid_t *fidp = NULL, *nextp = NULL; if (!scp) return NULL; + /* + * If the fidp->scp changes out from under us then + * we must not grab a refCount. It means the *fidp + * was processed by smb_CloseFID() and the *fidp is + * no longer valid for use. + */ lock_ObtainWrite(&smb_rctLock); - for(fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q)) { + for(fidp = vcp->fidsp, (fidp ? fidp->refCount++ : 0); fidp; fidp = nextp, nextp = NULL) { + nextp = (smb_fid_t *) osi_QNext(&fidp->q); + if (nextp) + nextp->refCount++; + if (scp == fidp->scp) { - fidp->refCount++; - break; + lock_ReleaseWrite(&smb_rctLock); + lock_ObtainMutex(&fidp->mx); + lock_ObtainWrite(&smb_rctLock); + if (scp == fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + break; + } + lock_ReleaseMutex(&fidp->mx); + } + + if (fidp->refCount > 1) { + fidp->refCount--; + } else { + lock_ReleaseWrite(&smb_rctLock); + smb_ReleaseFID(fidp); + lock_ObtainWrite(&smb_rctLock); } } + + if (nextp) { + if (nextp->refCount > 1) { + nextp->refCount--; + } else { + lock_ReleaseWrite(&smb_rctLock); + smb_ReleaseFID(nextp); + lock_ObtainWrite(&smb_rctLock); + } + } + #ifdef DEBUG_SMB_REFCOUNT if (fidp) { afsi_log("%s:%d smb_FindFIDByScache fidp 0x%p ref %d", file, line, fidp, fidp->refCount); @@ -1635,7 +1728,7 @@ smb_fid_t *smb_FindFIDByScache(smb_vc_t *vcp, cm_scache_t * scp) } #endif lock_ReleaseWrite(&smb_rctLock); - return fidp; + return (fidp); } #ifdef DEBUG_SMB_REFCOUNT @@ -1653,8 +1746,8 @@ void smb_HoldFIDNoLock(smb_fid_t *fidp) } -/* smb_ReleaseFID cannot be called while an cm_scache_t mutex lock is held */ -/* the sm_fid_t->mx and smb_rctLock must not be held */ +/* smb_ReleaseFID cannot be called while a cm_scache_t rwlock is held */ +/* the smb_fid_t->mx and smb_rctLock must not be held */ #ifdef DEBUG_SMB_REFCOUNT void smb_ReleaseFIDDbg(smb_fid_t *fidp, char *file, long line) #else @@ -3090,7 +3183,7 @@ void smb_MapNTError(long code, unsigned long *NTStatusp) #endif /* COMMENT */ } else if (code == CM_ERROR_BADSHARENAME) { - NTStatus = 0xC00000CCL; /* Bad network name */ + NTStatus = 0xC00000BEL; /* Bad network path (server valid, share bad) */ } else if (code == CM_ERROR_NOIPC) { #ifdef COMMENT @@ -3161,7 +3254,7 @@ void smb_MapNTError(long code, unsigned long *NTStatusp) NTStatus = 0xC000022DL; /* Retry */ } else if (code == CM_ERROR_ALLOFFLINE || code == CM_ERROR_ALLDOWN) { - NTStatus = 0xC00000BEL; /* Bad Network Path */ + NTStatus = 0xC000003AL; /* Path not found */ } else if (code >= ERROR_TABLE_BASE_RXK && code < ERROR_TABLE_BASE_RXK + 256) { NTStatus = 0xC0000322L; /* No Kerberos key */ @@ -3437,13 +3530,20 @@ long smb_ReceiveCoreReadRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp if (!fidp) goto send1; - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ObtainMutex(&fidp->mx); + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFD; + } + + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); code = CM_ERROR_NOSUCHFILE; goto send1a; } - pid = smbp->pid; { LARGE_INTEGER LOffset, LLength; @@ -3461,6 +3561,7 @@ long smb_ReceiveCoreReadRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp lock_ReleaseWrite(&fidp->scp->rw); } if (code) { + lock_ReleaseMutex(&fidp->mx); goto send1a; } @@ -3471,13 +3572,13 @@ long smb_ReceiveCoreReadRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp smb_RawBufs = *(char **)smb_RawBufs; } lock_ReleaseMutex(&smb_RawBufLock); - if (!rawBuf) + if (!rawBuf) { + lock_ReleaseMutex(&fidp->mx); goto send1a; + } - lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { - lock_ReleaseMutex(&fidp->mx); rc = smb_IoctlReadRaw(fidp, vcp, inp, outp); if (rawBuf) { /* Give back raw buffer */ @@ -4008,7 +4109,7 @@ void smb_WaitingLocksDaemon() if (wl->state == SMB_WAITINGLOCKSTATE_DONE) cm_Unlock(scp, wlRequest->lockType, wl->LOffset, - wl->LLength, wl->key, NULL, &req); + wl->LLength, wl->key, 0, NULL, &req); osi_QRemove((osi_queue_t **) &wlRequest->locks, &wl->q); @@ -4677,7 +4778,7 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5112,7 +5213,7 @@ long smb_ReceiveCoreCheckPath(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5200,7 +5301,7 @@ long smb_ReceiveCoreSetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5333,7 +5434,7 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } else #endif /* DFS_SUPPORT */ if (dscp->fileType == CM_SCACHETYPE_MOUNTPOINT && !dscp->mountRootFid.volume) @@ -5370,7 +5471,7 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5530,7 +5631,7 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5554,17 +5655,6 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE); osi_assertx(fidp, "null smb_fid_t"); - /* save a pointer to the vnode */ - fidp->scp = scp; - osi_Log2(smb_logp,"smb_ReceiveCoreOpen fidp 0x%p scp 0x%p", fidp, scp); - lock_ObtainWrite(&scp->rw); - scp->flags |= CM_SCACHEFLAG_SMB_FID; - lock_ReleaseWrite(&scp->rw); - - /* and the user */ - cm_HoldUser(userp); - fidp->userp = userp; - lock_ObtainMutex(&fidp->mx); if ((share & 0xf) == 0) fidp->flags |= SMB_FID_OPENREAD_LISTDIR; @@ -5572,9 +5662,17 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fidp->flags |= SMB_FID_OPENWRITE; else fidp->flags |= (SMB_FID_OPENREAD_LISTDIR | SMB_FID_OPENWRITE); - lock_ReleaseMutex(&fidp->mx); - lock_ObtainRead(&scp->rw); + /* save the user */ + cm_HoldUser(userp); + fidp->userp = userp; + + /* and a pointer to the vnode */ + fidp->scp = scp; + osi_Log2(smb_logp,"smb_ReceiveCoreOpen fidp 0x%p scp 0x%p", fidp, scp); + lock_ObtainWrite(&scp->rw); + scp->flags |= CM_SCACHEFLAG_SMB_FID; + smb_SetSMBParm(outp, 0, fidp->fid); smb_SetSMBParm(outp, 1, smb_Attributes(scp)); smb_DosUTimeFromUnixTime(&dosTime, scp->clientModTime); @@ -5585,6 +5683,7 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) /* pass the open mode back; XXXX add access checks */ smb_SetSMBParm(outp, 6, (share & 0xf)); smb_SetSMBDataLength(outp, 0); + lock_ReleaseMutex(&fidp->mx); lock_ReleaseRead(&scp->rw); /* notify open */ @@ -5713,7 +5812,7 @@ long smb_ReceiveCoreUnlink(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5905,7 +6004,7 @@ smb_Rename(smb_vc_t *vcp, smb_packet_t *inp, clientchar_t * oldPathp, clientchar if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5928,7 +6027,7 @@ smb_Rename(smb_vc_t *vcp, smb_packet_t *inp, clientchar_t * oldPathp, clientchar if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -6115,7 +6214,7 @@ smb_Link(smb_vc_t *vcp, smb_packet_t *inp, clientchar_t * oldPathp, clientchar_t if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -6137,7 +6236,7 @@ smb_Link(smb_vc_t *vcp, smb_packet_t *inp, clientchar_t * oldPathp, clientchar_t if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -6363,7 +6462,7 @@ long smb_ReceiveCoreRemoveDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -6456,40 +6555,39 @@ long smb_ReceiveCoreFlush(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fid = smb_ChainFID(fid, inp); fidp = smb_FindFID(vcp, fid, 0); if (!fidp) - return CM_ERROR_BADFD; + return CM_ERROR_BADFD; - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + userp = smb_GetUserFromVCP(vcp, inp); + + lock_ObtainMutex(&fidp->mx); + if (!fidp->scp || (fidp->flags & SMB_FID_IOCTL)) { + cm_ReleaseUser(userp); + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFD; + } + + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); + cm_ReleaseUser(userp); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } - lock_ObtainMutex(&fidp->mx); - if (fidp->flags & SMB_FID_IOCTL) { - lock_ReleaseMutex(&fidp->mx); - smb_ReleaseFID(fidp); - return CM_ERROR_BADFD; - } - lock_ReleaseMutex(&fidp->mx); - - userp = smb_GetUserFromVCP(vcp, inp); - - lock_ObtainMutex(&fidp->mx); if ((fidp->flags & SMB_FID_OPENWRITE) && smb_AsyncStore != 2) { - cm_scache_t * scp = fidp->scp; - cm_HoldSCache(scp); - lock_ReleaseMutex(&fidp->mx); + cm_scache_t * scp = fidp->scp; + cm_HoldSCache(scp); + lock_ReleaseMutex(&fidp->mx); code = cm_FSync(scp, userp, &req); - cm_ReleaseSCache(scp); + cm_ReleaseSCache(scp); } else { + lock_ReleaseMutex(&fidp->mx); code = 0; - lock_ReleaseMutex(&fidp->mx); } - smb_ReleaseFID(fidp); - cm_ReleaseUser(userp); - + smb_ReleaseFID(fidp); return code; } @@ -6586,26 +6684,25 @@ long smb_CloseFID(smb_vc_t *vcp, smb_fid_t *fidp, cm_user_t *userp, lock_ObtainWrite(&smb_rctLock); if (fidp->deleteOk) { - osi_Log0(smb_logp, " Fid already closed."); - lock_ReleaseWrite(&smb_rctLock); - return CM_ERROR_BADFD; + osi_Log0(smb_logp, " Fid already closed."); + lock_ReleaseWrite(&smb_rctLock); + return CM_ERROR_BADFD; } fidp->deleteOk = 1; lock_ReleaseWrite(&smb_rctLock); lock_ObtainMutex(&fidp->mx); if (fidp->NTopen_dscp) { - dscp = fidp->NTopen_dscp; - cm_HoldSCache(dscp); + dscp = fidp->NTopen_dscp; + cm_HoldSCache(dscp); } - if (fidp->NTopen_pathp) { - pathp = cm_ClientStrDup(fidp->NTopen_pathp); - } + if (fidp->NTopen_pathp) + pathp = cm_ClientStrDup(fidp->NTopen_pathp); if (fidp->scp) { - scp = fidp->scp; - cm_HoldSCache(scp); + scp = fidp->scp; + cm_HoldSCache(scp); } /* Don't jump the gun on an async raw write */ @@ -6623,7 +6720,7 @@ long smb_CloseFID(smb_vc_t *vcp, smb_fid_t *fidp, cm_user_t *userp, scp->mask |= CM_SCACHEMASK_CLIENTMODTIME; /* This fixes defect 10958 */ CompensateForSmbClientLastWriteTimeBugs(&dosTime); - smb_UnixTimeFromDosUTime(&fidp->scp->clientModTime, dosTime); + smb_UnixTimeFromDosUTime(&scp->clientModTime, dosTime); } if (smb_AsyncStore != 2) { lock_ReleaseMutex(&fidp->mx); @@ -6640,10 +6737,10 @@ long smb_CloseFID(smb_vc_t *vcp, smb_fid_t *fidp, cm_user_t *userp, cm_key_t key; long tcode; - lock_ReleaseMutex(&fidp->mx); + lock_ReleaseMutex(&fidp->mx); - /* CM_UNLOCK_BY_FID doesn't look at the process ID. We pass - in zero. */ + /* CM_UNLOCK_BY_FID doesn't look at the process ID. We pass + * in zero. */ key = cm_GenerateKey(vcp->vcID, 0, fidp->fid); lock_ObtainWrite(&scp->rw); @@ -6744,16 +6841,16 @@ long smb_CloseFID(smb_vc_t *vcp, smb_fid_t *fidp, cm_user_t *userp, } if (scp) { - lock_ObtainWrite(&scp->rw); + lock_ObtainWrite(&scp->rw); if (nullcreator && scp->creator == userp) scp->creator = NULL; - scp->flags &= ~CM_SCACHEFLAG_SMB_FID; - lock_ReleaseWrite(&scp->rw); - cm_ReleaseSCache(scp); + scp->flags &= ~CM_SCACHEFLAG_SMB_FID; + lock_ReleaseWrite(&scp->rw); + cm_ReleaseSCache(scp); } if (pathp) - free(pathp); + free(pathp); return code; } @@ -6821,7 +6918,13 @@ long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, afs_uint32 count, char code = CM_ERROR_BADFDOP; goto done2; } - + + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + code = CM_ERROR_BADFD; + goto done2; + } + smb_InitReq(&req); bufferp = NULL; @@ -7229,6 +7332,7 @@ long smb_ReceiveCoreWrite(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_t* smbp = (smb_t*) inp; long code = 0; cm_user_t *userp; + cm_scache_t *scp; cm_attr_t truncAttr; /* attribute struct used for truncating file */ char *op; int inDataBlockCount; @@ -7252,12 +7356,6 @@ long smb_ReceiveCoreWrite(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return CM_ERROR_BADFD; } - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { - smb_CloseFID(vcp, fidp, NULL, 0); - smb_ReleaseFID(fidp); - return CM_ERROR_NOSUCHFILE; - } - lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { lock_ReleaseMutex(&fidp->mx); @@ -7266,6 +7364,22 @@ long smb_ReceiveCoreWrite(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) osi_Log1(smb_logp, "smb_ReceiveCoreWrite ioctl code 0x%x", code); return code; } + + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFD; + } + + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); + smb_CloseFID(vcp, fidp, NULL, 0); + smb_ReleaseFID(fidp); + return CM_ERROR_NOSUCHFILE; + } + + scp = fidp->scp; + cm_HoldSCache(scp); lock_ReleaseMutex(&fidp->mx); userp = smb_GetUserFromVCP(vcp, inp); @@ -7282,9 +7396,9 @@ long smb_ReceiveCoreWrite(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) LLength.HighPart = 0; LLength.LowPart = count; - lock_ObtainWrite(&fidp->scp->rw); - code = cm_LockCheckWrite(fidp->scp, LOffset, LLength, key); - lock_ReleaseWrite(&fidp->scp->rw); + lock_ObtainWrite(&scp->rw); + code = cm_LockCheckWrite(scp, LOffset, LLength, key); + lock_ReleaseWrite(&scp->rw); if (code) { osi_Log1(smb_logp, "smb_ReceiveCoreWrite lock check failure 0x%x", code); @@ -7356,6 +7470,7 @@ long smb_ReceiveCoreWrite(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) done: smb_ReleaseFID(fidp); cm_ReleaseUser(userp); + cm_ReleaseSCache(scp); return code; } @@ -7373,12 +7488,21 @@ void smb_CompleteWriteRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, fd = smb_GetSMBParm(inp, 0); fidp = smb_FindFID(vcp, fd, 0); - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { - smb_CloseFID(vcp, fidp, NULL, 0); + lock_ObtainMutex(&fidp->mx); + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); smb_ReleaseFID(fidp); return; } + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); + smb_CloseFID(vcp, fidp, NULL, 0); + smb_ReleaseFID(fidp); + return; + } + lock_ReleaseMutex(&fidp->mx); + osi_Log3(smb_logp, "Completing Raw Write offset 0x%x:%08x count %x", rwcp->offset.HighPart, rwcp->offset.LowPart, rwcp->count); @@ -7386,7 +7510,7 @@ void smb_CompleteWriteRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, rawBuf = rwcp->buf; code = smb_WriteData(fidp, &rwcp->offset, rwcp->count, rawBuf, userp, - &written); + &written); if (rwcp->writeMode & 0x1) { /* synchronous */ smb_t *op; @@ -7433,6 +7557,7 @@ long smb_ReceiveCoreWriteRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out smb_t *smbp = (smb_t*) inp; long code = 0; cm_user_t *userp; + cm_scache_t *scp; char *op; unsigned short writeMode; char *rawBuf; @@ -7481,16 +7606,27 @@ long smb_ReceiveCoreWriteRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out fd = smb_ChainFID(fd, inp); fidp = smb_FindFID(vcp, fd, 0); - if (!fidp) { + if (!fidp) + return CM_ERROR_BADFD; + + lock_ObtainMutex(&fidp->mx); + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); return CM_ERROR_BADFD; } - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } + scp = fidp->scp; + cm_HoldSCache(scp); + lock_ReleaseMutex(&fidp->mx); + { unsigned pid; cm_key_t key; @@ -7505,11 +7641,12 @@ long smb_ReceiveCoreWriteRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out LLength.HighPart = 0; LLength.LowPart = count; - lock_ObtainWrite(&fidp->scp->rw); - code = cm_LockCheckWrite(fidp->scp, LOffset, LLength, key); - lock_ReleaseWrite(&fidp->scp->rw); + lock_ObtainWrite(&scp->rw); + code = cm_LockCheckWrite(scp, LOffset, LLength, key); + lock_ReleaseWrite(&scp->rw); if (code) { + cm_ReleaseSCache(scp); smb_ReleaseFID(fidp); return code; } @@ -7573,6 +7710,7 @@ long smb_ReceiveCoreWriteRaw(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out smb_ReleaseFID(fidp); cm_ReleaseUser(userp); + cm_ReleaseSCache(scp); if (code) { smb_SetSMBParm(outp, 0, total_written); @@ -7613,6 +7751,7 @@ long smb_ReceiveCoreRead(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_t *smbp = (smb_t*) inp; long code = 0; cm_user_t *userp; + cm_scache_t *scp; char *op; fd = smb_GetSMBParm(inp, 0); @@ -7627,12 +7766,6 @@ long smb_ReceiveCoreRead(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fidp = smb_FindFID(vcp, fd, 0); if (!fidp) return CM_ERROR_BADFD; - - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { - smb_CloseFID(vcp, fidp, NULL, 0); - smb_ReleaseFID(fidp); - return CM_ERROR_NOSUCHFILE; - } lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { @@ -7641,6 +7774,22 @@ long smb_ReceiveCoreRead(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_ReleaseFID(fidp); return code; } + + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFD; + } + + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); + smb_CloseFID(vcp, fidp, NULL, 0); + smb_ReleaseFID(fidp); + return CM_ERROR_NOSUCHFILE; + } + + scp = fidp->scp; + cm_HoldSCache(scp); lock_ReleaseMutex(&fidp->mx); { @@ -7655,11 +7804,12 @@ long smb_ReceiveCoreRead(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) LLength.HighPart = 0; LLength.LowPart = count; - lock_ObtainWrite(&fidp->scp->rw); - code = cm_LockCheckRead(fidp->scp, LOffset, LLength, key); - lock_ReleaseWrite(&fidp->scp->rw); + lock_ObtainWrite(&scp->rw); + code = cm_LockCheckRead(scp, LOffset, LLength, key); + lock_ReleaseWrite(&scp->rw); } if (code) { + cm_ReleaseSCache(scp); smb_ReleaseFID(fidp); return code; } @@ -7697,6 +7847,7 @@ long smb_ReceiveCoreRead(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_ReleaseFID(fidp); cm_ReleaseUser(userp); + cm_ReleaseSCache(scp); return code; } @@ -7762,7 +7913,7 @@ long smb_ReceiveCoreMakeDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -7903,7 +8054,7 @@ long smb_ReceiveCoreCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -8059,21 +8210,23 @@ long smb_ReceiveCoreSeek(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fidp = smb_FindFID(vcp, fd, 0); if (!fidp) return CM_ERROR_BADFD; - - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + + lock_ObtainMutex(&fidp->mx); + if (!fidp->scp || (fidp->flags & SMB_FID_IOCTL)) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFD; + } + + if (fidp->scp->flags & CM_SCACHEFLAG_DELETED) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } - lock_ObtainMutex(&fidp->mx); - if (fidp->flags & SMB_FID_IOCTL) { - lock_ReleaseMutex(&fidp->mx); - smb_ReleaseFID(fidp); - return CM_ERROR_BADFD; - } lock_ReleaseMutex(&fidp->mx); - + userp = smb_GetUserFromVCP(vcp, inp); lock_ObtainMutex(&fidp->mx); @@ -8205,25 +8358,30 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, if (dp->procp) { /* we have a recognized operation */ char * opName = myCrt_Dispatch(inp->inCom); + smb_t *smbp; - if (inp->inCom == 0x1d) + smbp = (smb_t *) inp; + + osi_Log5(smb_logp,"Dispatch %s mid 0x%x vcp 0x%p lana %d lsn %d", + opName, smbp->mid, vcp,vcp->lana,vcp->lsn); + if (inp->inCom == 0x1d) { /* Raw Write */ code = smb_ReceiveCoreWriteRaw (vcp, inp, outp, rwcp); - else { - osi_Log4(smb_logp,"Dispatch %s vcp 0x%p lana %d lsn %d", - opName,vcp,vcp->lana,vcp->lsn); + } else { code = (*(dp->procp)) (vcp, inp, outp); - osi_Log4(smb_logp,"Dispatch return code 0x%x vcp 0x%p lana %d lsn %d", - code,vcp,vcp->lana,vcp->lsn); -#ifdef LOG_PACKET - if ( code == CM_ERROR_BADSMB || - code == CM_ERROR_BADOP ) - smb_LogPacket(inp); -#endif /* LOG_PACKET */ } + osi_Log5(smb_logp,"Dispatch return code 0x%x mid 0x%x vcp 0x%p lana %d lsn %d", + code, smbp->mid, vcp,vcp->lana,vcp->lsn); newTime = GetTickCount(); - osi_Log2(smb_logp, "Dispatch %s duration %d ms", opName, newTime - oldTime); + osi_Log3(smb_logp, "Dispatch %s mid 0x%x duration %d ms", + opName, smbp->mid, newTime - oldTime); + +#ifdef LOG_PACKET + if ( code == CM_ERROR_BADSMB || + code == CM_ERROR_BADOP ) + smb_LogPacket(inp); +#endif /* LOG_PACKET */ /* ReceiveV3Tran2A handles its own logging */ if (inp->inCom != 0x32 && newTime - oldTime > 45000) { @@ -8234,24 +8392,31 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, cm_fid_t afid = {0,0,0,0,0}; uidp = smb_FindUID(vcp, smbp->uid, 0); - smb_LookupTIDPath(vcp,((smb_t *)inp)->tid, &treepath); + smb_LookupTIDPath(vcp, smbp->tid, &treepath); fidp = smb_FindFID(vcp, inp->fid, 0); - if (fidp && fidp->NTopen_pathp) - pathname = fidp->NTopen_pathp; - else if (inp->stringsp->wdata) - pathname = inp->stringsp->wdata; + if (fidp) { + lock_ObtainMutex(&fidp->mx); + if (fidp->NTopen_pathp) + pathname = fidp->NTopen_pathp; + if (fidp->scp) + afid = fidp->scp->fid; + } else { + if (inp->stringsp->wdata) + pathname = inp->stringsp->wdata; + } - if (fidp && fidp->scp) - afid = fidp->scp->fid; - - afsi_log("Request %s duration %d ms user %S tid \"%S\" path? \"%S\" afid (%d.%d.%d.%d)", - opName, newTime - oldTime, - uidp ? uidp->unp->name : NULL, + afsi_log("Request %s duration %d ms user 0x%x \"%S\" pid 0x%x mid 0x%x tid 0x%x \"%S\" path? \"%S\" afid (%d.%d.%d.%d)", + opName, newTime - oldTime, + smbp->uid, uidp ? uidp->unp->name : NULL, + smbp->pid, smbp->mid, smbp->tid, treepath, pathname, afid.cell, afid.volume, afid.vnode, afid.unique); + if (fidp) + lock_ReleaseMutex(&fidp->mx); + if (uidp) smb_ReleaseUID(uidp); if (fidp) @@ -9918,13 +10083,12 @@ void smb_Init(osi_log_t *logp, int useV3, int nThreads, void *aMBfunc) ); if (nts != STATUS_SUCCESS && ntsEx != STATUS_SUCCESS) { - char message[AFSPATHMAX]; - sprintf(message,"MsV1_0SetProcessOption failure: nts 0x%x ntsEx 0x%x", - nts, ntsEx); - OutputDebugString(message); - afsi_log(message); + osi_Log2(smb_logp, "MsV1_0SetProcessOption failure: nts 0x%x ntsEx 0x%x", + nts, ntsEx); + + afsi_log("MsV1_0SetProcessOption failure: nts 0x%x ntsEx 0x%x", nts, ntsEx); } else { - OutputDebugString("MsV1_0SetProcessOption success"); + osi_Log0(smb_logp, "MsV1_0SetProcessOption success"); afsi_log("MsV1_0SetProcessOption success"); } /* END - code from Larry */ diff --git a/src/WINNT/afsd/smb.h b/src/WINNT/afsd/smb.h index 31f5212b40..111769e8ab 100644 --- a/src/WINNT/afsd/smb.h +++ b/src/WINNT/afsd/smb.h @@ -543,6 +543,8 @@ extern void smb_ReleaseVCNoLock(smb_vc_t *vcp); extern void smb_CleanupDeadVC(smb_vc_t *vcp); +extern void smb_MarkAllVCsDead(smb_vc_t *exclude_vcp); + #ifdef DEBUG_SMB_REFCOUNT extern smb_tid_t *smb_FindTIDDbg(smb_vc_t *vcp, unsigned short tid, int flags, char *, long); #define smb_FindTID(a,b,c) smb_FindTIDDbg(a,b,c,__FILE__,__LINE__); diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 4463f6e31f..146baab382 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -144,8 +144,6 @@ void OutputDebugF(clientchar_t * format, ...) { va_start( args, format ); cm_ClientStrPrintfV(vbuffer, lengthof(vbuffer), format, args); osi_Log1(smb_logp, "%S", osi_LogSaveClientString(smb_logp, vbuffer)); - cm_ClientStrCat(vbuffer, lengthof(vbuffer), _C("\n")); - OutputDebugStringW(vbuffer); } void OutputDebugHexDump(unsigned char * buffer, int len) { @@ -159,8 +157,6 @@ void OutputDebugHexDump(unsigned char * buffer, int len) { if(!(i%16)) { if(i) { osi_Log1(smb_logp, "%s", osi_LogSaveString(smb_logp, buf)); - StringCchCatA(buf, lengthof(buf), "\r\n"); - OutputDebugString(buf); } StringCchPrintfA(buf, lengthof(buf), "%5x", i); memset(buf+5,' ',80); @@ -180,8 +176,6 @@ void OutputDebugHexDump(unsigned char * buffer, int len) { } if(i) { osi_Log1(smb_logp, "%s", osi_LogSaveString(smb_logp, buf)); - StringCchCatA(buf, lengthof(buf), "\r\n"); - OutputDebugString(buf); } } @@ -686,11 +680,39 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * clientchar_t usern[SMB_MAX_USERNAME_LENGTH]; char *secBlobOut = NULL; int secBlobOutLength = 0; + int maxBufferSize = 0; + int maxMpxCount = 0; + int vcNumber = 0; /* Check for bad conns */ if (vcp->flags & SMB_VCFLAG_REMOTECONN) return CM_ERROR_REMOTECONN; + /* maxBufferSize */ + maxBufferSize = smb_GetSMBParm(inp, 2); + maxMpxCount = smb_GetSMBParm(inp, 3); + vcNumber = smb_GetSMBParm(inp, 4); + + osi_Log3(smb_logp, "SESSION_SETUP_ANDX with MaxBufferSize=%d, MaxMpxCount=%d, VCNumber=%d", + maxBufferSize, maxMpxCount, vcNumber); + + if (maxMpxCount > smb_maxMpxRequests) { + LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_SMB_MAX_MPX_COUNT, maxMpxCount, smb_maxMpxRequests); + osi_Log2(smb_logp, "MaxMpxCount for client is too large (Client=%d, Server=%d)", + maxMpxCount, smb_maxMpxRequests); + } + + if (maxBufferSize < SMB_PACKETSIZE) { + LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_SMB_MAX_BUFFER_SIZE, maxBufferSize, SMB_PACKETSIZE); + osi_Log2(smb_logp, "MaxBufferSize for client is too small (Client=%d, Server=%d)", + maxBufferSize, SMB_PACKETSIZE); + } + + if (vcNumber == 0) { + osi_Log0(smb_logp, "Resetting all VCs"); + smb_MarkAllVCsDead(vcp); + } + if (vcp->flags & SMB_VCFLAG_USENT) { if (smb_authType == SMB_AUTH_EXTENDED) { /* extended authentication */ @@ -1827,7 +1849,7 @@ long smb_ReceiveRAPNetShareGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_pack } else { userp = smb_GetTran2User(vcp, p); if (!userp) { - osi_Log1(smb_logp,"ReceiveTran2GetDfsReferral unable to resolve user [%d]", p->uid); + osi_Log1(smb_logp,"ReceiveRAPNetShareGetInfo unable to resolve user [%d]", p->uid); return CM_ERROR_BADSMB; } code = cm_NameI(cm_data.rootSCachep, shareName, @@ -2222,21 +2244,28 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_LookupTIDPath(vcp, asp->tid, &treepath); fidp = smb_FindFID(vcp, inp->fid, 0); - if (fidp && fidp->NTopen_pathp) - pathname = fidp->NTopen_pathp; - else if (inp->stringsp->wdata) - pathname = inp->stringsp->wdata; + if (fidp) { + lock_ObtainMutex(&fidp->mx); + if (fidp->NTopen_pathp) + pathname = fidp->NTopen_pathp; + if (fidp->scp) + afid = fidp->scp->fid; + } else { + if (inp->stringsp->wdata) + pathname = inp->stringsp->wdata; + } - if (fidp && fidp->scp) - afid = fidp->scp->fid; - - afsi_log("Request %s duration %d ms user %S tid \"%S\" path? \"%S\" afid (%d.%d.%d.%d)", + afsi_log("Request %s duration %d ms user 0x%x \"%S\" pid 0x%x mid 0x%x tid 0x%x \"%S\" path? \"%S\" afid (%d.%d.%d.%d)", myCrt_2Dispatch(asp->opcode), newTime - oldTime, - uidp ? uidp->unp->name : NULL, + asp->uid, uidp ? uidp->unp->name : NULL, + asp->pid, asp->mid, asp->tid, treepath, pathname, afid.cell, afid.volume, afid.vnode, afid.unique); + if (fidp) + lock_ReleaseMutex(&fidp->mx); + if (uidp) smb_ReleaseUID(uidp); if (fidp) @@ -2436,7 +2465,7 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) if ( WANTS_DFS_PATHNAMES(p) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -2466,7 +2495,7 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) if ( WANTS_DFS_PATHNAMES(p) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -3008,7 +3037,7 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else - code = CM_ERROR_BADSHARENAME; + code = CM_ERROR_NOSUCHPATH; } else #endif /* DFS_SUPPORT */ if (dscp->fileType == CM_SCACHETYPE_MOUNTPOINT && !dscp->mountRootFid.volume) @@ -3057,7 +3086,7 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else - code = CM_ERROR_BADSHARENAME; + code = CM_ERROR_NOSUCHPATH; smb_SendTran2Error(vcp, p, opx, code); smb_FreeTran2Packet(outp); return 0; @@ -3212,7 +3241,6 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet return CM_ERROR_BADOP; #else long code = 0; - smb_fid_t *fidp; unsigned short infoLevel; clientchar_t * pathp; smb_tran2Packet_t *outp; @@ -3296,7 +3324,7 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else - code = CM_ERROR_BADSHARENAME; + code = CM_ERROR_NOSUCHPATH; } else #endif /* DFS_SUPPORT */ if (dscp->fileType == CM_SCACHETYPE_MOUNTPOINT && !dscp->mountRootFid.volume) @@ -3334,25 +3362,6 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet return 0; } - fidp = smb_FindFIDByScache(vcp, scp); - if (!fidp) { - cm_ReleaseSCache(scp); - cm_ReleaseUser(userp); - smb_SendTran2Error(vcp, p, opx, code); - return 0; - } - - lock_ObtainMutex(&fidp->mx); - if (!(fidp->flags & SMB_FID_OPENWRITE)) { - lock_ReleaseMutex(&fidp->mx); - cm_ReleaseSCache(scp); - smb_ReleaseFID(fidp); - cm_ReleaseUser(userp); - smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOACCESS); - return 0; - } - lock_ReleaseMutex(&fidp->mx); - outp = smb_GetTran2ResponsePacket(vcp, p, opx, 2, 0); outp->totalParms = 2; @@ -3375,10 +3384,6 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet } cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); - lock_ReleaseWrite(&scp->rw); - lock_ObtainMutex(&fidp->mx); - lock_ObtainRead(&scp->rw); - /* prepare for setattr call */ attr.mask = CM_ATTRMASK_LENGTH; attr.length.LowPart = spi->u.QPstandardInfo.dataSize; @@ -3387,7 +3392,6 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet if (spi->u.QPstandardInfo.lastWriteDateTime != 0) { smb_UnixTimeFromSearchTime(&attr.clientModTime, spi->u.QPstandardInfo.lastWriteDateTime); attr.mask |= CM_ATTRMASK_CLIENTMODTIME; - fidp->flags |= SMB_FID_MTIMESETDONE; } if (spi->u.QPstandardInfo.attributes != 0) { @@ -3405,7 +3409,6 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet } } lock_ReleaseRead(&scp->rw); - lock_ReleaseMutex(&fidp->mx); /* call setattr */ if (attr.mask) @@ -3421,7 +3424,6 @@ long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet done: cm_ReleaseSCache(scp); cm_ReleaseUser(userp); - smb_ReleaseFID(fidp); if (code == 0) smb_SendTran2Packet(vcp, outp, opx); else @@ -3460,12 +3462,15 @@ long smb_ReceiveTran2QFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t return 0; } + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOSUCHFILE); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return 0; } + lock_ReleaseMutex(&fidp->mx); infoLevel = p->parmsp[1]; if (infoLevel == SMB_QUERY_FILE_BASIC_INFO) @@ -3603,13 +3608,6 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet return 0; } - if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { - smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOSUCHFILE); - smb_CloseFID(vcp, fidp, NULL, 0); - smb_ReleaseFID(fidp); - return 0; - } - infoLevel = p->parmsp[1]; osi_Log2(smb_logp,"ReceiveTran2SetFileInfo type 0x%x fid %d", infoLevel, fid); if (infoLevel > SMB_SET_FILE_END_OF_FILE_INFO || infoLevel < SMB_SET_FILE_BASIC_INFO) { @@ -3621,6 +3619,14 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet } lock_ObtainMutex(&fidp->mx); + if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); + smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOSUCHFILE); + smb_CloseFID(vcp, fidp, NULL, 0); + smb_ReleaseFID(fidp); + return 0; + } + if (infoLevel == SMB_SET_FILE_DISPOSITION_INFO && !(fidp->flags & SMB_FID_OPENDELETE)) { osi_Log3(smb_logp,"smb_ReceiveTran2SetFileInfo !SMB_FID_OPENDELETE fidp 0x%p scp 0x%p fidp->flags 0x%x", @@ -3890,10 +3896,10 @@ smb_ReceiveTran2GetDFSReferral(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t /* * We have a requested path. Check to see if it is something * we know about. - * - * But be careful because the name that we might be searching - * for might be a known name with the final character stripped - * off. If we + * + * But be careful because the name that we might be searching + * for might be a known name with the final character stripped + * off. */ code = cm_NameI(cm_data.rootSCachep, &requestFileName[nbnLen+2], CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL, @@ -4556,7 +4562,7 @@ long smb_T2SearchDirSingle(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else - code = CM_ERROR_BADSHARENAME; + code = CM_ERROR_NOSUCHPATH; smb_SendTran2Error(vcp, p, opx, code); smb_FreeTran2Packet(outp); return 0; @@ -5076,7 +5082,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else - code = CM_ERROR_BADSHARENAME; + code = CM_ERROR_NOSUCHPATH; smb_SendTran2Error(vcp, p, opx, code); smb_FreeTran2Packet(outp); lock_ReleaseMutex(&dsp->mx); @@ -5767,7 +5773,7 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -5789,7 +5795,7 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ /* otherwise, scp points to the parent directory. Do a lookup, @@ -6021,13 +6027,14 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (!fidp) return CM_ERROR_BADFD; + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } - lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { osi_Log0(smb_logp, "smb_ReceiveV3Locking BadFD"); lock_ReleaseMutex(&fidp->mx); @@ -6044,7 +6051,6 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) userp = smb_GetUserFromVCP(vcp, inp); - lock_ObtainWrite(&scp->rw); code = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_NEEDCALLBACK @@ -6112,7 +6118,7 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) key = cm_GenerateKey(vcp->vcID, pid, fidp->fid); - code = cm_Unlock(scp, LockType, LOffset, LLength, key, userp, &req); + code = cm_Unlock(scp, LockType, LOffset, LLength, key, 0, userp, &req); if (code) goto done; @@ -6234,7 +6240,7 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) wlNext = (smb_waitingLock_t *) osi_QNext(&wl->q); - ul_code = cm_Unlock(scp, LockType, wl->LOffset, wl->LLength, wl->key, userp, &req); + ul_code = cm_Unlock(scp, LockType, wl->LOffset, wl->LLength, wl->key, 0, userp, &req); if(ul_code != 0) { osi_Log1(smb_logp, "smb_ReceiveV3Locking cm_Unlock returns code %d", ul_code); @@ -6307,13 +6313,14 @@ long smb_ReceiveV3GetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * if (!fidp) return CM_ERROR_BADFD; + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } - lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { lock_ReleaseMutex(&fidp->mx); smb_ReleaseFID(fidp); @@ -6397,13 +6404,14 @@ long smb_ReceiveV3SetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * if (!fidp) return CM_ERROR_BADFD; + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } - lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { lock_ReleaseMutex(&fidp->mx); smb_ReleaseFID(fidp); @@ -6416,7 +6424,6 @@ long smb_ReceiveV3SetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * userp = smb_GetUserFromVCP(vcp, inp); - /* now prepare to call cm_setattr. This message only sets various times, * and AFS only implements mtime, and we'll set the mtime if that's * requested. The others we'll ignore. @@ -6455,6 +6462,7 @@ long smb_ReceiveV3WriteX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_fid_t *fidp; smb_t *smbp = (smb_t*) inp; long code = 0; + cm_scache_t *scp; cm_user_t *userp; char *op; int inDataBlockCount; @@ -6491,20 +6499,31 @@ long smb_ReceiveV3WriteX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (!fidp) return CM_ERROR_BADFD; + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } - lock_ObtainMutex(&fidp->mx); if (fidp->flags & SMB_FID_IOCTL) { lock_ReleaseMutex(&fidp->mx); code = smb_IoctlV3Write(fidp, vcp, inp, outp); smb_ReleaseFID(fidp); return code; } + + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFDOP; + } + + scp = fidp->scp; + cm_HoldSCache(scp); lock_ReleaseMutex(&fidp->mx); + userp = smb_GetUserFromVCP(vcp, inp); /* special case: 0 bytes transferred means there is no data @@ -6516,7 +6535,6 @@ long smb_ReceiveV3WriteX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cm_key_t key; LARGE_INTEGER LOffset; LARGE_INTEGER LLength; - cm_scache_t * scp; pid = smbp->pid; key = cm_GenerateKey(vcp->vcID, pid, fd); @@ -6526,7 +6544,6 @@ long smb_ReceiveV3WriteX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) LLength.HighPart = 0; LLength.LowPart = count; - scp = fidp->scp; lock_ObtainWrite(&scp->rw); code = cm_LockCheckWrite(scp, LOffset, LLength, key); lock_ReleaseWrite(&scp->rw); @@ -6547,8 +6564,8 @@ long smb_ReceiveV3WriteX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) */ lock_ObtainMutex(&fidp->mx); if ((fidp->flags & SMB_FID_MTIMESETDONE) != SMB_FID_MTIMESETDONE) { - fidp->scp->mask |= CM_SCACHEMASK_CLIENTMODTIME; - fidp->scp->clientModTime = time(NULL); + scp->mask |= CM_SCACHEMASK_CLIENTMODTIME; + scp->clientModTime = time(NULL); } lock_ReleaseMutex(&fidp->mx); @@ -6574,6 +6591,8 @@ long smb_ReceiveV3WriteX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_SetSMBDataLength(outp, 0); done: + + cm_ReleaseSCache(scp); cm_ReleaseUser(userp); smb_ReleaseFID(fidp); @@ -6591,6 +6610,7 @@ long smb_ReceiveV3ReadX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_fid_t *fidp; smb_t *smbp = (smb_t*) inp; long code = 0; + cm_scache_t *scp; cm_user_t *userp; cm_key_t key; char *op; @@ -6630,28 +6650,39 @@ long smb_ReceiveV3ReadX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return CM_ERROR_BADFD; } + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } + if (!fidp->scp) { + lock_ReleaseMutex(&fidp->mx); + smb_ReleaseFID(fidp); + return CM_ERROR_BADFDOP; + } + + scp = fidp->scp; + cm_HoldSCache(scp); + lock_ReleaseMutex(&fidp->mx); + pid = smbp->pid; key = cm_GenerateKey(vcp->vcID, pid, fd); { LARGE_INTEGER LOffset, LLength; - cm_scache_t *scp; LOffset.HighPart = offset.HighPart; LOffset.LowPart = offset.LowPart; LLength.HighPart = 0; LLength.LowPart = count; - scp = fidp->scp; lock_ObtainWrite(&scp->rw); code = cm_LockCheckRead(scp, LOffset, LLength, key); lock_ReleaseWrite(&scp->rw); } + cm_ReleaseSCache(scp); if (code) { smb_ReleaseFID(fidp); @@ -7006,7 +7037,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ code = cm_Lookup(dscp, (lastNamep)?(lastNamep+1):realPathp, CM_FLAG_FOLLOW, @@ -7040,7 +7071,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ /* we might have scp but not dscp */ @@ -7080,7 +7111,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ @@ -7571,15 +7602,15 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_SetSMBDataLength(outp, 0); if ((fidp->flags & SMB_FID_EXECUTABLE) && - LargeIntegerGreaterThanZero(fidp->scp->length) && + LargeIntegerGreaterThanZero(scp->length) && !(scp->flags & CM_SCACHEFLAG_PREFETCHING)) { prefetch = 1; } lock_ReleaseRead(&scp->rw); if (prefetch) - cm_QueueBKGRequest(fidp->scp, cm_BkgPrefetch, 0, 0, - fidp->scp->length.LowPart, fidp->scp->length.HighPart, + cm_QueueBKGRequest(scp, cm_BkgPrefetch, 0, 0, + scp->length.LowPart, scp->length.HighPart, userp); @@ -7828,7 +7859,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ code = cm_Lookup(dscp, (lastNamep)?(lastNamep+1):realPathp, CM_FLAG_FOLLOW, @@ -7862,7 +7893,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ } @@ -7887,7 +7918,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else - return CM_ERROR_BADSHARENAME; + return CM_ERROR_NOSUCHPATH; } #endif /* DFS_SUPPORT */ } else @@ -8334,15 +8365,15 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out } if ((fidp->flags & SMB_FID_EXECUTABLE) && - LargeIntegerGreaterThanZero(fidp->scp->length) && + LargeIntegerGreaterThanZero(scp->length) && !(scp->flags & CM_SCACHEFLAG_PREFETCHING)) { prefetch = 1; } lock_ReleaseRead(&scp->rw); if (prefetch) - cm_QueueBKGRequest(fidp->scp, cm_BkgPrefetch, 0, 0, - fidp->scp->length.LowPart, fidp->scp->length.HighPart, + cm_QueueBKGRequest(scp, cm_BkgPrefetch, 0, 0, + scp->length.LowPart, scp->length.HighPart, userp); osi_Log1(smb_logp, "SMB NTTranCreate opening fid %d", fidp->fid); @@ -8376,11 +8407,16 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp, return CM_ERROR_BADFD; } + lock_ObtainMutex(&fidp->mx); if (fidp->scp && (fidp->scp->flags & CM_SCACHEFLAG_DELETED)) { + lock_ReleaseMutex(&fidp->mx); smb_CloseFID(vcp, fidp, NULL, 0); smb_ReleaseFID(fidp); return CM_ERROR_NOSUCHFILE; } + scp = fidp->scp; + cm_HoldSCache(scp); + lock_ReleaseMutex(&fidp->mx); /* Create a copy of the Directory Watch Packet to use when sending the * notification if in the future a matching change is detected. @@ -8399,7 +8435,6 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp, smb_Directory_Watches = savedPacketp; lock_ReleaseMutex(&smb_Dir_Watch_Lock); - scp = fidp->scp; osi_Log3(smb_logp,"smb_ReceiveNTTranNotifyChange fidp 0x%p scp 0x%p file \"%S\"", fidp, scp, osi_LogSaveClientString(smb_logp, fidp->NTopen_wholepathp)); osi_Log3(smb_logp, "Request for NotifyChange filter 0x%x fid %d wtree %d", @@ -8435,6 +8470,7 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp, else scp->flags |= CM_SCACHEFLAG_WATCHED; lock_ReleaseWrite(&scp->rw); + cm_ReleaseSCache(scp); smb_ReleaseFID(fidp); outp->flags |= SMB_PACKETFLAG_NOSEND; @@ -8832,12 +8868,14 @@ long smb_ReceiveNTCancel(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) scp = fidp->scp; osi_Log2(smb_logp,"smb_ReceiveNTCancel fidp 0x%p scp 0x%p", fidp, scp); - lock_ObtainWrite(&scp->rw); - if (watchtree) - scp->flags &= ~CM_SCACHEFLAG_WATCHEDSUBTREE; - else - scp->flags &= ~CM_SCACHEFLAG_WATCHED; - lock_ReleaseWrite(&scp->rw); + if (scp) { + lock_ObtainWrite(&scp->rw); + if (watchtree) + scp->flags &= ~CM_SCACHEFLAG_WATCHEDSUBTREE; + else + scp->flags &= ~CM_SCACHEFLAG_WATCHED; + lock_ReleaseWrite(&scp->rw); + } smb_ReleaseFID(fidp); } else { osi_Log2(smb_logp,"NTCancel unable to resolve fid [%d] in vcp[%x]", fid,vcp); diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index eada4dfe3c..b7a996047b 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -1055,7 +1055,7 @@ smb_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) ioctlp->ioctl.flags |= CM_IOCTLFLAG_LOGON; } - cm_ResetACLCache(userp); + cm_ResetACLCache(cellp, userp); done: if (release_userp) diff --git a/src/WINNT/afskfw/afskfw.c b/src/WINNT/afskfw/afskfw.c index aab182a10b..77728633ea 100644 --- a/src/WINNT/afskfw/afskfw.c +++ b/src/WINNT/afskfw/afskfw.c @@ -138,7 +138,7 @@ KFW_initialize(void) KFW_initialize_funcs(); if ( KFW_is_available() ) { - char rootcell[MAXCELLCHARS+1]; + char rootcell[CELL_MAXNAMELEN+1]; #ifdef USE_MS2MIT KFW_import_windows_lsa(); #endif /* USE_MS2MIT */ @@ -1140,7 +1140,7 @@ KFW_AFS_get_cred( char * username, free(cellconfig.linkedCell); if ( code && reasonP ) { - *reasonP = (char *) afs_error_message(code); + *reasonP = afs_error_message(code); } return(code); } diff --git a/src/WINNT/client_osi/osistatl.c b/src/WINNT/client_osi/osistatl.c index 0526144020..d0e097e166 100644 --- a/src/WINNT/client_osi/osistatl.c +++ b/src/WINNT/client_osi/osistatl.c @@ -641,7 +641,7 @@ static void lock_FinalizeRWLockStat(osi_rwlock_t *lockp) LeaveCriticalSection(&osi_statFDCS); } -void lock_InitializeRWLockStat(osi_rwlock_t *lockp, char *namep) +void lock_InitializeRWLockStat(osi_rwlock_t *lockp, char *namep, unsigned short level) { osi_rwlockStat_t *realp; @@ -660,7 +660,7 @@ void lock_InitializeRWLockStat(osi_rwlock_t *lockp, char *namep) LeaveCriticalSection(&osi_statFDCS); } -void lock_InitializeMutexStat(osi_mutex_t *lockp, char *namep) +void lock_InitializeMutexStat(osi_mutex_t *lockp, char *namep, unsigned short level) { osi_mutexStat_t *realp; diff --git a/src/WINNT/client_osi/osistatl.h b/src/WINNT/client_osi/osistatl.h index 3de16465cc..a9bb9488c4 100644 --- a/src/WINNT/client_osi/osistatl.h +++ b/src/WINNT/client_osi/osistatl.h @@ -99,9 +99,9 @@ typedef struct osi_rwlockStat { typedef void (osi_watchProc_t)(void *rockp, long actualMs, void *lockp); -extern void lock_InitializeRWLockStat(osi_rwlock_t *, char *); +extern void lock_InitializeRWLockStat(osi_rwlock_t *, char *, unsigned short level); -extern void lock_InitializeMutexStat(osi_mutex_t *, char *); +extern void lock_InitializeMutexStat(osi_mutex_t *, char *, unsigned short level); extern osi_activeInfo_t *osi_QueueActiveInfo(osi_qiStat_t *, int); diff --git a/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm b/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm index e69365482c..c63d2bcbc6 100644 --- a/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm +++ b/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm @@ -18,7 +18,7 @@ w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} -OpenAFS for Windows 1.5.57 Release Notes +OpenAFS for Windows 1.5.59 Release Notes -OpenAFS for Windows 1.5.57 Release Notes +OpenAFS for Windows 1.5.59 Release Notes
-

OpenAFS for Windows 1.5.57 (with Unicode Support)
+

OpenAFS for Windows 1.5.59 (with Unicode Support)
Release Notes

The Andrew File System (AFS) is a location-independent diff --git a/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes_files/filelist.xml b/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes_files/filelist.xml index 38fe5a5088..be2ff175e9 100644 --- a/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes_files/filelist.xml +++ b/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes_files/filelist.xml @@ -1,10 +1,15 @@ + + + + + - - - + + + \ No newline at end of file diff --git a/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm b/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm index 691ed49087..21eea6b482 100644 --- a/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm +++ b/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm @@ -12,7 +12,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> -OpenAFS for Windows 1.5.57 Table of Contents +OpenAFS for Windows 1.5.59 Table of Contents