Hello community, here is the log from the commit of package drbd checked in at Tue Oct 31 00:10:29 CET 2006. -------- --- drbd/drbd.changes 2006-10-06 14:05:13.000000000 +0200 +++ /mounts/work_src_done/STABLE/drbd/drbd.changes 2006-10-30 23:33:26.000000000 +0100 @@ -1,0 +2,7 @@ +Mon Oct 30 23:33:13 CET 2006 - lmb@suse.de + +- Update to the officially released 0.7.22 version. +- Implement "freeze_io" feature. +- convert-MODULE_PARM.diff: drop unneeded patch. + +------------------------------------------------------------------- Old: ---- convert-MODULE_PARM.diff New: ---- drbd-kver.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ drbd.spec ++++++ --- /var/tmp/diff_new_pack.hjkqG2/_old 2006-10-31 00:10:06.000000000 +0100 +++ /var/tmp/diff_new_pack.hjkqG2/_new 2006-10-31 00:10:06.000000000 +0100 @@ -13,14 +13,14 @@ BuildRequires: glib-devel kernel-source kernel-syms Summary: Distributed Replicated Block Device Version: 0.7.22 -Release: 1 +Release: 15 Source: %{name}-%{version}.tar.gz # Source: drbd-SVN.tar.bz2 Source1: drbd-Makefile.module Source2: drbd-modprobe.d Patch0: drbd-optflags.patch -Patch2: convert-MODULE_PARM.diff -License: GPL +Patch1: drbd-kver.patch +License: GNU General Public License (GPL) - all versions Group: Productivity/Clustering/HA Provides: drbdsetup drbd-control URL: http://www.drbd.org/ @@ -59,7 +59,7 @@ %prep %setup -n drbd-%{version} %patch0 -p1 -%patch2 -p1 +%patch1 -p0 mkdir source cp -a drbd/. source/. || : cp %{SOURCE1} source/Makefile @@ -139,16 +139,20 @@ %doc scripts/drbd.conf %changelog -n drbd +* Mon Oct 30 2006 - lmb@suse.de +- Update to the officially released 0.7.22 version. +- Implement "freeze_io" feature. +- convert-MODULE_PARM.diff: drop unneeded patch. * Fri Oct 06 2006 - lmb@suse.de - Update to 0.7.22: -- In protocol A and B, on connection loss, drbd could "forget" to set + - In protocol A and B, on connection loss, drbd could "forget" to set certain areas out of sync. -- fix races between failure in drbd_send_dblock and concurrently + - fix races between failure in drbd_send_dblock and concurrently running tl_clear. -- fix potential access-afer-free in drbd_dio_end. -- fix possible list corruption respective resulting deadlock in + - fix potential access-afer-free in drbd_dio_end. + - fix possible list corruption respective resulting deadlock in receive_DataRequest. -- improved the drbd_thread_stop / start code. + - improved the drbd_thread_stop / start code. * Mon Aug 14 2006 - lmb@suse.de - Update to 0.7.21. * Fixed the "syncer stalled" after reconnect symptom. @@ -195,18 +199,18 @@ GFP_NOIO) to avoid possible deadlock. * Mon Mar 06 2006 - lmb@suse.de - Import upstream fixes from 0.7.17: -- There was a bug that could cause the activity log to be not applied + - There was a bug that could cause the activity log to be not applied after a primary crash, when an other size than 127 elements was configured. -- There was a bug in the activity log code, that could cause that the + - There was a bug in the activity log code, that could cause that the latest update to the AL is omitted at recovery time. -- The "Marked additional XXKB as out-of-synced based on AL." message + - The "Marked additional XXKB as out-of-synced based on AL." message showed one one eighth of the real amount. * Thu Feb 16 2006 - lmb@suse.de - Update to 0.7.16, new fixes: -- DRBD no longer shrinks an consistent device if it gets connected to + - DRBD no longer shrinks an consistent device if it gets connected to an smaller peer or attached to a smaller disk. -- There was a bug related to the degr-wcf-timeout config option, it was + - There was a bug related to the degr-wcf-timeout config option, it was never used in recent DRBD releases. Fixed. * Fri Feb 03 2006 - agruen@suse.de - drbd.spec: Replace %%arch with %%_target_cpu. @@ -262,15 +266,15 @@ smooth. * Fri Aug 06 2004 - lmb@suse.de - Update to 0.7.2-final (still from SVN). -- Proper handling of backing storage devices that occasionally fail + - Proper handling of backing storage devices that occasionally fail READA (=read ahead) requests. (E.g. LVM and MD) DRBD now fails READA requests itself, if a resynchronisation is running and it would need to fetch the block from its peer. -- "drbdadm adjust" had a race, which caused random errors. ( Missing + - "drbdadm adjust" had a race, which caused random errors. ( Missing waitpid() ). Fixed now. -- Properly substract SyncPause times from the syncer performance + - Properly substract SyncPause times from the syncer performance numbers. -- Fix to the syncer progress bar in /proc/drbd. + - Fix to the syncer progress bar in /proc/drbd. * Fri Aug 06 2004 - lmb@suse.de - Fix minor module build issue. * Wed Aug 04 2004 - lmb@suse.de @@ -290,11 +294,11 @@ - Merge upstream code cleanups. * Fri Jun 18 2004 - lmb@suse.de - Update to drbd-0.7-pre8 from upstream: -- Disabling zero-copy IO for now (#41852). -- Bitmap code restructured and lots of bugs fixed. -- Safe default: Always force a full-resync on initial setup. -- Ensuring that we never sync/read from an inconsistent peer. -- Various other fixes. + - Disabling zero-copy IO for now (#41852). + - Bitmap code restructured and lots of bugs fixed. + - Safe default: Always force a full-resync on initial setup. + - Ensuring that we never sync/read from an inconsistent peer. + - Various other fixes. * Wed Jun 09 2004 - lmb@suse.de - fix ioctls on s390x - Fix failure in local disk handling. @@ -374,21 +378,21 @@ - Add all directories to filelist * Tue Jun 03 2003 - jg@suse.de - Update to 0.6.4, changes: -- Reworked build system (i.e. better Makefiles) -- SyncAll works forward insead of backwards. Improves performance on some + - Reworked build system (i.e. better Makefiles) + - SyncAll works forward insead of backwards. Improves performance on some storage controlers. -- Reworked /etc/init.d/drbd script (i.e. better support of different bash + - Reworked /etc/init.d/drbd script (i.e. better support of different bash releases) * Wed Mar 26 2003 - jg@suse.de - Update to 0.6.3, changes: -- Lockup of primary if secondary fails during resync. Fixed. (Stupid!) -- Probabely SMP only deadlock in the drop-conection code path. -- Improved connect code. (The old code could trap into a distributed + - Lockup of primary if secondary fails during resync. Fixed. (Stupid!) + - Probabely SMP only deadlock in the drop-conection code path. + - Improved connect code. (The old code could trap into a distributed deadlock, resulting in an endless connect/disconnect loop.) -- The 'BitMap too small bug' was actually caused by a patch in + - The 'BitMap too small bug' was actually caused by a patch in SuSE's distribution kernel. This patch makes DRBD 'more' compatible with SuSE's kernel. -- Improved code to allocate buffers for the rsynchronisation process. + - Improved code to allocate buffers for the rsynchronisation process. The old code allocated physical adjacent pages although the syncer does not need them! The old code could fail under high memory pressure. - Removed BitMap too small patch (is part of 0.6.3) @@ -399,8 +403,8 @@ - Added "BitMap too small" fix (Bug #25384) * Wed Feb 12 2003 - jg@suse.de - Updated to 0.6.2 -- SMP fix in drbd_dio_end_sec() -- /etc/init.d/drbd knows about returncodes of fsck + - SMP fix in drbd_dio_end_sec() + - /etc/init.d/drbd knows about returncodes of fsck * Tue Dec 17 2002 - jg@suse.de - Moved drbdsetup from /usr/sbin to /sbin to support /usr on nfs - Removed accidentialy included CVS directories from tar-file @@ -411,20 +415,20 @@ - changed neededforbuild <sp> to <opensp> * Wed Oct 02 2002 - jg@suse.de - Updated to 0.6.1-pre17, changes: -- Merged syncer speedup code by Lars G. Ellenberg -- Merged most of Lars' modifications to the ioctl interface -- Marged the bug-fixes from the lge-branch -- Implemented the TimoutCounter in the meta-data code. -- Fixed a bug that could cause lockup of the primary node on + - Merged syncer speedup code by Lars G. Ellenberg + - Merged most of Lars' modifications to the ioctl interface + - Marged the bug-fixes from the lge-branch + - Implemented the TimoutCounter in the meta-data code. + - Fixed a bug that could cause lockup of the primary node on SMP systems using a SCSI device for DRBD, it always happened during resynchronisation. (!) - Checking /.buildenv now in buildsystem instead of /etc/*-release * Tue Sep 03 2002 - jg@suse.de - Init script fixes: -- Removed abortion on non existing block devices (may + - Removed abortion on non existing block devices (may break LVM setups) -- Sourcing . /etc/rc.status earlier now -- Allowing execution via rcdrbd link + - Sourcing . /etc/rc.status earlier now + - Allowing execution via rcdrbd link * Mon Sep 02 2002 - jg@suse.de - Incorporated latest changes from CVS - Using lge branch now (syncer much faster) @@ -445,9 +449,9 @@ - Fixed broken specfile * Mon Mar 04 2002 - jg@suse.de - updated to bugfix release 0.6.1pre10 -- Data-corruption bug in SyncAll fixed (was introduced in pre9) -- Fixed an OOPS in tl_check_sector() (was introduced in pre9) -- Fixed Linux-2.2.x compability (was broken in pre9) + - Data-corruption bug in SyncAll fixed (was introduced in pre9) + - Fixed an OOPS in tl_check_sector() (was introduced in pre9) + - Fixed Linux-2.2.x compability (was broken in pre9) - removed documentation patch (not needed anymore) * Wed Feb 20 2002 - jg@suse.de - modified init script to honor inittimeout settings ++++++ drbd-0.7.22.tar.gz ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/.filelist new/drbd-0.7.22/.filelist --- old/drbd-0.7.22/.filelist 2006-10-06 14:00:14.000000000 +0200 +++ new/drbd-0.7.22/.filelist 2006-10-30 22:52:11.000000000 +0100 @@ -1,36 +1,38 @@ drbd-0.7.22/upgrade_0.6.x_to_0.7.0.txt -drbd-0.7.22/ChangeLog drbd-0.7.22/scripts/drbd.conf +drbd-0.7.22/scripts/get_uts_release.sh drbd-0.7.22/scripts/drbd.gentoo drbd-0.7.22/scripts/drbddisk drbd-0.7.22/scripts/adjust_drbd_config_h.sh drbd-0.7.22/scripts/drbd drbd-0.7.22/scripts/Makefile -drbd-0.7.22/scripts/patch-kernel drbd-0.7.22/scripts/README +drbd-0.7.22/scripts/patch-kernel +drbd-0.7.22/ChangeLog drbd-0.7.22/benchmark/dm.c +drbd-0.7.22/benchmark/io-latency-test.c drbd-0.7.22/benchmark/report_to_html.pl drbd-0.7.22/benchmark/Makefile -drbd-0.7.22/benchmark/run.sh drbd-0.7.22/benchmark/README +drbd-0.7.22/benchmark/run.sh drbd-0.7.22/README drbd-0.7.22/INSTALL drbd-0.7.22/COPYING -drbd-0.7.22/drbd.spec.in drbd-0.7.22/documentation/drbd.conf.sgml drbd-0.7.22/documentation/drbddisk.sgml drbd-0.7.22/documentation/drbd.sgml -drbd-0.7.22/documentation/drbdsetup.sgml drbd-0.7.22/documentation/Makefile drbd-0.7.22/documentation/Makefile.lang +drbd-0.7.22/documentation/drbdsetup.sgml drbd-0.7.22/documentation/drbdadm.sgml +drbd-0.7.22/drbd.spec.in drbd-0.7.22/drbd/drbd_proc.c drbd-0.7.22/drbd/drbd_receiver.c drbd-0.7.22/drbd/Makefile-2.6 drbd-0.7.22/drbd/Kconfig drbd-0.7.22/drbd/drbd_fs.c -drbd-0.7.22/drbd/drbd_actlog.c drbd-0.7.22/drbd/drbd_worker.c +drbd-0.7.22/drbd/drbd_actlog.c drbd-0.7.22/drbd/drbd_compat_wrappers.h drbd-0.7.22/drbd/drbd_compat_types.h drbd-0.7.22/drbd/drbd_bitmap.c @@ -48,38 +50,38 @@ drbd-0.7.22/drbd/Makefile drbd-0.7.22/drbd/Makefile-2.4 drbd-0.7.22/upgrade_0.7.0_to_0.7.1.txt -drbd-0.7.22/testing/uml-2.6.gdbinit drbd-0.7.22/testing/ioctl_structs_sizes.c +drbd-0.7.22/testing/uml-2.6.gdbinit drbd-0.7.22/testing/compare.pl drbd-0.7.22/testing/test_al.pl drbd-0.7.22/testing/uml_profile-USER@HOST drbd-0.7.22/testing/access_and_verify.c drbd-0.7.22/testing/show_size.c -drbd-0.7.22/testing/uml-2.4.gdbinit drbd-0.7.22/testing/Makefile drbd-0.7.22/testing/README +drbd-0.7.22/testing/uml-2.4.gdbinit drbd-0.7.22/testing/write_gc.pl drbd-0.7.22/testing/CTH/T-006.sh -drbd-0.7.22/testing/CTH/LGE_CTH.pm drbd-0.7.22/testing/CTH/T-007.sh +drbd-0.7.22/testing/CTH/LGE_CTH.pm drbd-0.7.22/testing/CTH/functions.sh drbd-0.7.22/testing/CTH/uml-minna.conf drbd-0.7.22/testing/CTH/CTH_bash.sh drbd-0.7.22/testing/CTH/generic_test.pl drbd-0.7.22/testing/CTH/tiobench/BUGS -drbd-0.7.22/testing/CTH/tiobench/tiotest.h drbd-0.7.22/testing/CTH/tiobench/tiobench-0.3.3.diff +drbd-0.7.22/testing/CTH/tiobench/tiotest.h drbd-0.7.22/testing/CTH/tiobench/crc32.h drbd-0.7.22/testing/CTH/tiobench/TODO drbd-0.7.22/testing/CTH/tiobench/tiobench.pl drbd-0.7.22/testing/CTH/tiobench/COPYING drbd-0.7.22/testing/CTH/tiobench/tiosum.pl drbd-0.7.22/testing/CTH/tiobench/tiotest.c -drbd-0.7.22/testing/CTH/tiobench/crc32.c -drbd-0.7.22/testing/CTH/tiobench/README drbd-0.7.22/testing/CTH/tiobench/Makefile -drbd-0.7.22/testing/CTH/chipdale.conf +drbd-0.7.22/testing/CTH/tiobench/README +drbd-0.7.22/testing/CTH/tiobench/crc32.c drbd-0.7.22/testing/CTH/README +drbd-0.7.22/testing/CTH/chipdale.conf drbd-0.7.22/testing/CTH/CTH_bash.conf drbd-0.7.22/testing/CTH/LGE_CTH/FileSystem.pm drbd-0.7.22/testing/CTH/LGE_CTH/Node.pm @@ -96,8 +98,8 @@ drbd-0.7.22/testing/CTH/T-000.sh drbd-0.7.22/testing/CTH/T-001.sh drbd-0.7.22/testing/CTH/T-002.sh -drbd-0.7.22/testing/CTH/CTH_bash.helpers drbd-0.7.22/testing/CTH/T-003.sh +drbd-0.7.22/testing/CTH/CTH_bash.helpers drbd-0.7.22/testing/CTH/T-004.sh drbd-0.7.22/testing/CTH/bloodymary.sh.conf drbd-0.7.22/testing/CTH/T-005.sh @@ -105,13 +107,13 @@ drbd-0.7.22/testing/uml-screen-debug drbd-0.7.22/Makefile drbd-0.7.22/user/drbdadm_parser.y -drbd-0.7.22/user/drbdadm_main.c drbd-0.7.22/user/drbd_limits.h +drbd-0.7.22/user/drbdadm_main.c drbd-0.7.22/user/drbdadm.h drbd-0.7.22/user/drbdadm_scanner.fl drbd-0.7.22/user/drbdadm_adjust.c -drbd-0.7.22/user/drbdsetup.c drbd-0.7.22/user/Makefile +drbd-0.7.22/user/drbdsetup.c drbd-0.7.22/documentation/drbd.8 drbd-0.7.22/documentation/drbd.conf.5 drbd-0.7.22/documentation/drbdsetup.8 diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/ChangeLog new/drbd-0.7.22/ChangeLog --- old/drbd-0.7.22/ChangeLog 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/ChangeLog 2006-10-30 22:51:52.000000000 +0100 @@ -1,25 +1,25 @@ Latest: ------ - ChangeLog last updated: $LastChangedRevision: 2505 $ - $LastChangedDate: 2006-10-04 11:57:57 +0200 (Wed, 04 Oct 2006) $ + ChangeLog last updated: $LastChangedRevision: 2554 $ + $LastChangedDate: 2006-10-23 10:57:37 +0200 (Mon, 23 Oct 2006) $ Cumulative changes since last tarball. For even more detail, use "svn log" and "svn diff". 0.7.22 (api:79/proto:74) ----- - * *** anyone using protocol A or B should upgrade! *** - while rewriting the request code for drbd8, + * Fixed bugs in the implementation of protocol A and B. we noticed that in protocol A and B, on connection loss, we could "forget" to set certain areas out of sync. so resync in those protocol has been broken all along! - * fix races between failure in drbd_send_dblock + * Fix races between failure in drbd_send_dblock and concurrently running tl_clear - * fix potential access-afer-free in drbd_dio_end - * fix possible list corruption - respective resulting deadlock in receive_DataRequest - * improved the drbd_thread_stop / start code - * gracefull removal of devfs and other updates... + * Fix potential access-afer-free in drbd_dio_end + * Fix possible list corruption respective resulting deadlock in + receive_DataRequest + * Improved the drbd_thread_stop / start code + * Gracefull removal of devfs and other updates. + * Implemented the "freeze_io" option for "on-disconnect" 0.7.21 (api:79/proto:74) ----- diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/Makefile new/drbd-0.7.22/Makefile --- old/drbd-0.7.22/Makefile 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/Makefile 2006-10-30 22:51:52.000000000 +0100 @@ -159,10 +159,10 @@ all tools doc .filelist: drbd/drbd_buildtag.c KDIR := $(shell echo /lib/modules/`uname -r`/build) -KVER := $(shell \ - echo -e "\#include <linux/version.h>\ndrbd_kernel_release UTS_RELEASE" | \ - gcc -nostdinc -E -P -I$(KDIR)/include - 2>&1 | \ - sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p') +KVER := $(shell KDIR=$(KDIR) O=$(O) scripts/get_uts_release.sh) +ifeq ($(KVER),) +$(error "could not determine uts_release") +endif kernel-patch: drbd/drbd_buildtag.c set -o errexit; \ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/benchmark/Makefile new/drbd-0.7.22/benchmark/Makefile --- old/drbd-0.7.22/benchmark/Makefile 2004-10-08 11:22:47.000000000 +0200 +++ new/drbd-0.7.22/benchmark/Makefile 2006-10-30 22:51:48.000000000 +0100 @@ -1,6 +1,9 @@ CFLAGS=-Wall -all: dm +all: dm io-latency-test + +io-latency-test: io-latency-test.c + $(CC) -pthread -o $@ $^ install: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/benchmark/io-latency-test.c new/drbd-0.7.22/benchmark/io-latency-test.c --- old/drbd-0.7.22/benchmark/io-latency-test.c 1970-01-01 01:00:00.000000000 +0100 +++ new/drbd-0.7.22/benchmark/io-latency-test.c 2006-10-30 22:51:48.000000000 +0100 @@ -0,0 +1,259 @@ +/* + io-latency-test.c + + By Philipp Reisner. + + Copyright (C) 2006, Philipp Reisner <philipp.reisner@linbit.com>. + Initial author. + + io-latency-test is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + dm is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with dm; see the file COPYING. If not, write to + the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + + */ + +/* In case this crashes (in your UML) + touch /etc/ld.so.nohwcap + */ + +// compile with gcc -pthread -o io-latency-test io-latency-test.c + +#include <sys/poll.h> +#include <sys/time.h> +#include <unistd.h> +#include <time.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#define _GNU_SOURCE +#include <getopt.h> + +#define MONITOR_TIME 300000 +// Check every 300 milliseconds. (3.33 times per second) + +#define RECORD_TIME 20000 +// Try to write a record every 20 milliseconds (50 per second) + +unsigned int monitor_time=MONITOR_TIME; +unsigned int record_time=RECORD_TIME; +unsigned long records=0; + +struct shared_data { + pthread_mutex_t mutex; + unsigned long record_nr; + unsigned int write_duration_us; + unsigned int write_duration_records; + double avg_write_duration; +}; + +void* wd_thread(void *arg) +{ + struct shared_data *data = (struct shared_data*) arg; + unsigned long last_record_nr=-1, current_record_nr=0; + unsigned int avg_write,wd,wr; + double avg_write_duration; + + enum { IO_RUNNING, IO_BLOCKED } io_state = IO_RUNNING; + + while(1) { + usleep(monitor_time); // sleep some milliseconds + + pthread_mutex_lock(&data->mutex); + current_record_nr = data->record_nr; + wd = data->write_duration_us; + wr = data->write_duration_records; + data->write_duration_us = 0; + data->write_duration_records = 0; + avg_write_duration = data->avg_write_duration; + pthread_mutex_unlock(&data->mutex); + + if( records && current_record_nr == records) break; + + switch(io_state) { + case IO_RUNNING: + if(current_record_nr == last_record_nr) { + printf("IO got frozen. Last completely " + "written record: %lu\n", + last_record_nr); + io_state = IO_BLOCKED; + } else { + if(wr==0) wr=1; + avg_write = wd/wr; + + printf("Current record: %lu " + "( cur. write duration %d.%02dms; " + "avg. wd. %.2fms)\r", + current_record_nr, + avg_write/1000,(avg_write%1000)/10, + avg_write_duration/1000); + fflush(stdout); + } + last_record_nr = current_record_nr; + case IO_BLOCKED: + if(current_record_nr != last_record_nr) { + printf("IO just resumed.\n"); + io_state = IO_RUNNING; + } + } + } + if(io_state == IO_RUNNING) printf("\n"); +} + +void usage(char *prgname) +{ + fprintf(stderr, "USAGE: %s [options] recordfile\n" + " Available options:\n" + " --records val -n val\n" + " --record-interval-ms -r val\n" + " --monitor-interval-ms -m val\n", + prgname); + exit(20); +} + +int main(int argc, char** argv) +{ + pthread_t watch_dog; + unsigned long record_nr=0; + FILE* record_f; + + struct timeval now_tv, then_tv; + struct tm now_tm; + int write_duration_us=0; + int min_wd=(1<<30), max_wd=0; + double avg_write_duration; + int avg_wd_nr=0,c; + + struct shared_data data; + + static struct option options[] = { + {"records", required_argument, 0, 'n'}, + {"record-interval-ms", required_argument, 0, 'r'}, + {"monitor-interval-ms", required_argument, 0, 'm'}, + {0, 0, 0, 0 } + }; + + while (1) { + c = getopt_long(argc, argv, "n:r:m:", options, 0); + if (c == -1) + break; + switch (c) { + case 'n': + records = atol(optarg); + break; + case 'r': + record_time = atoi(optarg) * 1000; + break; + case 'm': + monitor_time = atoi(optarg) * 1000; + break; + default: + usage(argv[0]); + } + } + + if(optind != argc-1) { + usage(argv[0]); + } + + if(!(record_f = fopen(argv[optind],"w"))) { + perror("fopen:"); + fprintf(stderr,"Failed to open '%s' for writing\n", + argv[optind]); + return 10; + } + + printf("\n" + "This programm writes records to a file, shows the write latency\n" + "of the file system and block device combination and informs\n" + "you in case IO completely stalls.\n\n" + " Due to the nature of the 'D' process state on Linux\n" + " (and other Unix operating systems) you can not kill this\n" + " test programm while IO is frozen. You have to kill it with\n" + " Ctrl-C (SIGINT) while IO is running.\n\n" + "In case the record file's block device freezes, this " + "program will\n" + "inform you here which record was completely written before it " + "freezed.\n\n" + ); + + pthread_mutex_init(&data.mutex,NULL); + data.record_nr = record_nr; + data.write_duration_us = 0; + data.write_duration_records = 1; + pthread_create(&watch_dog,NULL,wd_thread,&data); + + for( ; !records || record_nr < records ; record_nr++) { + gettimeofday(&now_tv, NULL); + localtime_r(&now_tv.tv_sec,&now_tm); + + fprintf(record_f, + "%04d-%02d-%02d %02d:%02d:%02d.%06ld: " + "Record number: %-6lu " + "(L.r.w.t.: %d.%02dms)\n", + 1900+ now_tm.tm_year, + 1+ now_tm.tm_mon, + now_tm.tm_mday, + now_tm.tm_hour, + now_tm.tm_min, + now_tm.tm_sec, + now_tv.tv_usec, + record_nr, + write_duration_us/1000, + (write_duration_us%1000)/10); + + fflush(record_f); // flush it from glibc to the kernel. + fdatasync(fileno(record_f)); // from buffer cache to disk. + + // eventually wait for full record_time + gettimeofday(&then_tv, NULL); + write_duration_us = + ( (then_tv.tv_sec - now_tv.tv_sec ) * 1000000 + + (then_tv.tv_usec - now_tv.tv_usec) ); + + if(write_duration_us < monitor_time) { + if(write_duration_us < min_wd) min_wd = write_duration_us; + if(write_duration_us > max_wd) max_wd = write_duration_us; + + avg_write_duration = + (avg_write_duration * avg_wd_nr + + write_duration_us) / (++avg_wd_nr); + } + + pthread_mutex_lock(&data.mutex); + data.record_nr = record_nr; + data.write_duration_us += write_duration_us; + data.write_duration_records++; + data.avg_write_duration = avg_write_duration; + pthread_mutex_unlock(&data.mutex); + + if(write_duration_us < record_time ) { + usleep(record_time - write_duration_us); + } + } + + pthread_mutex_lock(&data.mutex); + data.record_nr = record_nr; + pthread_mutex_unlock(&data.mutex); + + pthread_join(watch_dog,NULL); + + printf( "STATS:\n" + " Records written: %lu\n" + " Average write duration: %.2fms\n" + " Longest write duration (<%dms): %.2fms\n" + " Shortest write duration: %.2fms\n", + records, + avg_write_duration/1000, + monitor_time/1000,(double)max_wd/1000, + (double)min_wd/1000); +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbd.8 new/drbd-0.7.22/documentation/drbd.8 --- old/drbd-0.7.22/documentation/drbd.8 2006-10-06 14:00:11.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbd.8 2006-10-30 22:52:08.000000000 +0100 @@ -3,7 +3,7 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "DRBD" "8" "06 October 2006" "" "" +.TH "DRBD" "8" "30 October 2006" "" "" .SH NAME /etc/init.d/drbd \- The start and stop script for DRBD diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbd.conf.5 new/drbd-0.7.22/documentation/drbd.conf.5 --- old/drbd-0.7.22/documentation/drbd.conf.5 2006-10-06 14:00:10.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbd.conf.5 2006-10-30 22:52:07.000000000 +0100 @@ -3,7 +3,7 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "DRBD.CONF" "5" "06 October 2006" "" "" +.TH "DRBD.CONF" "5" "30 October 2006" "" "" .SH NAME drbd.conf \- Configuration file for DRBD's devices @@ -305,10 +305,11 @@ The default is 0, which disables this feature. .TP \fBon-disconnect \fIhandler\fB\fR -When the connection to the peer is lost, DRBD can either -go into stand alone mode, or try to reconnect to the peer. -Valid handler specifiers are \fBstand_alone\fR and -\fBreconnect\fR\&. +When the connection to the peer is lost, DRBD can either go into standd +alone mode, try to reconnect to the peer, or try to reconnect and freeze +application IO while not not connected. +Valid handler specifiers are \fBstand_alone\fR, +\fBreconnect\fR and \fBfreeze_io\fR\&. The default handler is \fBreconnect\fR\&. \fBstand_alone\fR: Do not reconnect, go into diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbd.conf.sgml new/drbd-0.7.22/documentation/drbd.conf.sgml --- old/drbd-0.7.22/documentation/drbd.conf.sgml 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbd.conf.sgml 2006-10-30 22:51:48.000000000 +0100 @@ -456,10 +456,11 @@ <varlistentry> <term><option>on-disconnect <replaceable>handler</replaceable></option></term> <listitem><para> - When the connection to the peer is lost, DRBD can either - go into stand alone mode, or try to reconnect to the peer. - Valid handler specifiers are <option>stand_alone</option> and - <option>reconnect</option>. + When the connection to the peer is lost, DRBD can either go into standd + alone mode, try to reconnect to the peer, or try to reconnect and freeze + application IO while not not connected. + Valid handler specifiers are <option>stand_alone</option>, + <option>reconnect</option> and <option>freeze_io</option>. The default handler is <option>reconnect</option>. </para> <para><option>stand_alone</option>: Do not reconnect, go into diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbdadm.8 new/drbd-0.7.22/documentation/drbdadm.8 --- old/drbd-0.7.22/documentation/drbdadm.8 2006-10-06 14:00:12.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbdadm.8 2006-10-30 22:52:09.000000000 +0100 @@ -3,7 +3,7 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "DRBDADM" "8" "06 October 2006" "" "" +.TH "DRBDADM" "8" "30 October 2006" "" "" .SH NAME drbdadm \- Administration tool for DRBD diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbddisk.8 new/drbd-0.7.22/documentation/drbddisk.8 --- old/drbd-0.7.22/documentation/drbddisk.8 2006-10-06 14:00:13.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbddisk.8 2006-10-30 22:52:10.000000000 +0100 @@ -3,7 +3,7 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "DRBDDISK" "8" "06 October 2006" "" "" +.TH "DRBDDISK" "8" "30 October 2006" "" "" .SH NAME /etc/ha.d/resource.d/drbddisk \- Script to mark devices as primary and mount filesystems diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbdsetup.8 new/drbd-0.7.22/documentation/drbdsetup.8 --- old/drbd-0.7.22/documentation/drbdsetup.8 2006-10-06 14:00:09.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbdsetup.8 2006-10-30 22:52:06.000000000 +0100 @@ -3,7 +3,7 @@ .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng <steve@ggi-project.org>. -.TH "DRBDSETUP" "8" "06 October 2006" "" "" +.TH "DRBDSETUP" "8" "30 October 2006" "" "" .SH NAME drbdsetup \- Setup tool for DRBD @@ -182,9 +182,11 @@ .TP \fB-d, --on-disconnect \fIdiscon_handler\fB\fR When the connection to the peer is lost, DRBD can either -go into stand alone mode, or try to reconnect to the peer. -The keywords are: \fBstand_alone\fR and -\fBreconnect\fR\&. +go into stand alone mode, try to reconnect to the peer, or +try to reconnect and freeze application IO while not +not connected. +The keywords are: \fBstand_alone\fR, +\fBreconnect\fR or \fBfreeze_io\fR The default handler is \fBreconnect\fR\&. .SS "SYNCER" .PP diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/documentation/drbdsetup.sgml new/drbd-0.7.22/documentation/drbdsetup.sgml --- old/drbd-0.7.22/documentation/drbdsetup.sgml 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/documentation/drbdsetup.sgml 2006-10-30 22:51:48.000000000 +0100 @@ -333,9 +333,11 @@ <listitem> <para> When the connection to the peer is lost, DRBD can either - go into stand alone mode, or try to reconnect to the peer. - The keywords are: <option>stand_alone</option> and - <option>reconnect</option>. + go into stand alone mode, try to reconnect to the peer, or + try to reconnect and freeze application IO while not + not connected. + The keywords are: <option>stand_alone</option>, + <option>reconnect</option> or <option>freeze_io</option> The default handler is <option>reconnect</option>. </para> </listitem> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/Makefile new/drbd-0.7.22/drbd/Makefile --- old/drbd-0.7.22/drbd/Makefile 2006-08-10 13:45:32.000000000 +0200 +++ new/drbd-0.7.22/drbd/Makefile 2006-10-30 22:51:50.000000000 +0100 @@ -121,16 +121,19 @@ endif -mv .drbd_kernelrelease.new .drbd_kernelrelease @echo -n "Memorizing module configuration ... " - @{ echo -e "#\n# drbd.o was compiled with" ; \ + @config=$$( (for x in $(KDIR)/.config $(O)/.config ; do \ + if test -e $$x ; then echo $$x ; exit 0; fi ; \ + done; echo $(KDIR)/.config) | sed -e 's,//,/,g') ; \ + { echo -e "#\n# drbd.o was compiled with" ; \ echo "# `gcc -v 2>&1 | tail -1`" ; \ echo "# against this kernelrelease:" ; \ sed 's/^/# /' .drbd_kernelrelease ; \ echo "# kernel .config from" ; \ - echo -n "# $(KDIR)/.config" ; \ - test -L "$(KDIR)" && echo " alias" && \ - echo "# $$(readlink $(KDIR))/.config" || echo "" ; \ + echo -n "# $$config" ; \ + test -L "$${config%/.config}" && echo " alias" && \ + echo "# $$(readlink $${config%/.config})/.config" || echo "" ; \ echo -e "# follows\n#\n" ; \ - cat $(KDIR)/.config ; } | gzip > .kernel.config.gz + cat $$config ; } | gzip > .kernel.config.gz @echo "done." ifneq ($(KDIR_Makefile_PATCHLEVEL),6) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_buildtag.c new/drbd-0.7.22/drbd/drbd_buildtag.c --- old/drbd-0.7.22/drbd/drbd_buildtag.c 2006-10-06 14:00:14.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_buildtag.c 2006-10-30 22:52:11.000000000 +0100 @@ -1,6 +1,6 @@ /* automatically generated. DO NOT EDIT. */ const char * drbd_buildtag(void) { - return "SVN Revision: 2515" - " build by lmb@dale, 2006-10-06 14:00:14"; + return "SVN Revision: 2554" + " build by lmb@dale, 2006-10-30 22:52:11"; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_compat_types.h new/drbd-0.7.22/drbd/drbd_compat_types.h --- old/drbd-0.7.22/drbd/drbd_compat_types.h 2005-06-21 11:53:20.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_compat_types.h 2006-10-30 22:51:49.000000000 +0100 @@ -8,6 +8,8 @@ typedef struct buffer_head drbd_bio_t; typedef unsigned long sector_t; +#define REQ_NEXT b_reqnext + #define NOT_IN_26(x...) x #define ONLY_IN_26(x...) @@ -316,6 +318,8 @@ typedef struct bio drbd_bio_t; +#define REQ_NEXT bi_next + #define SIGHAND_HACK #define NOT_IN_26(x...) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_compat_wrappers.h new/drbd-0.7.22/drbd/drbd_compat_wrappers.h --- old/drbd-0.7.22/drbd/drbd_compat_wrappers.h 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_compat_wrappers.h 2006-10-30 22:51:49.000000000 +0100 @@ -625,7 +625,7 @@ static inline int _drbd_send_bio(drbd_dev *mdev, struct bio *bio) { - struct bio_vec *bvec = bio_iovec(bio); + struct bio_vec *bvec = bio_iovec_idx(bio,0); struct page *page = bvec->bv_page; size_t size = bvec->bv_len; int offset = bvec->bv_offset; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_fs.c new/drbd-0.7.22/drbd/drbd_fs.c --- old/drbd-0.7.22/drbd/drbd_fs.c 2006-08-10 13:45:32.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_fs.c 2006-10-30 22:51:49.000000000 +0100 @@ -1293,8 +1293,7 @@ err=-ENODATA; break; } - /* FIXME what if fsync returns error */ - drbd_sync_me(mdev); + set_bit(DO_NOT_INC_CONCNT,&mdev->flags); set_cstate(mdev,Unconnected); drbd_thread_stop(&mdev->receiver); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_int.h new/drbd-0.7.22/drbd/drbd_int.h --- old/drbd-0.7.22/drbd/drbd_int.h 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_int.h 2006-10-30 22:51:50.000000000 +0100 @@ -690,7 +690,8 @@ MD_DIRTY, // current gen counts and flags not yet on disk SYNC_STARTED, // Needed to agree on the exact point in time.. USE_DEGR_WFC_T, // Use degr-wfc-timeout instad of wfc-timeout. - CRASHED_PRIMARY // This node was a crashed primary + CRASHED_PRIMARY, // This node was a crashed primary + IO_FROZEN // IO Frozen. }; struct drbd_bitmap; // opaque for Drbd_Conf @@ -801,6 +802,8 @@ struct list_head done_ee; // send ack struct list_head read_ee; // IO in progress struct list_head net_ee; // zero-copy network send in progress + drbd_bio_t *first_frozen_bio; + drbd_bio_t *last_frozen_bio; spinlock_t pr_lock; struct list_head app_reads; struct list_head resync_reads; @@ -832,6 +835,7 @@ extern void tl_release(drbd_dev *mdev,unsigned int barrier_nr, unsigned int set_size); extern void tl_clear(drbd_dev *mdev); +extern void tl_resend(drbd_dev *mdev); extern int tl_dependence(drbd_dev *mdev, drbd_request_t * item, int free_it); extern void drbd_free_sock(drbd_dev *mdev); extern int drbd_send(drbd_dev *mdev, struct socket *sock, @@ -863,6 +867,9 @@ extern int drbd_io_error(drbd_dev* mdev); extern void drbd_mdev_cleanup(drbd_dev *mdev); +extern int drbd_resend_barrier(drbd_dev *mdev,struct drbd_barrier *b); +extern int drbd_resend_dblock(drbd_dev *mdev, drbd_request_t *req); + // drbd_meta-data.c (still in drbd_main.c) extern void drbd_md_write(drbd_dev *mdev); extern int drbd_md_read(drbd_dev *mdev); @@ -1035,6 +1042,7 @@ #endif extern int drbd_read_remote(drbd_dev *mdev, drbd_request_t *req); +extern void drbd_thaw_frozen_reqs(drbd_dev *mdev); // drbd_fs.c extern char* ppsize(char* buf, size_t size); extern int drbd_determin_dev_size(drbd_dev*); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_main.c new/drbd-0.7.22/drbd/drbd_main.c --- old/drbd-0.7.22/drbd/drbd_main.c 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_main.c 2006-10-30 22:51:49.000000000 +0100 @@ -214,7 +214,7 @@ new_item->barrier = b; new_item->rq_status |= RQ_DRBD_IN_TL; - list_add(&new_item->w.list,&b->requests); + list_add_tail(&new_item->w.list,&b->requests); if( b->n_req++ > mdev->conf.max_epoch_size ) { set_bit(ISSUE_BARRIER,&mdev->flags); @@ -282,10 +282,49 @@ D_ASSERT(b->br_number == barrier_nr); D_ASSERT(b->n_req == set_size); +#if 1 + if(b->br_number != barrier_nr) { + DUMPI(b->br_number); + DUMPI(barrier_nr); + } + if(b->n_req != set_size) { + DUMPI(b->n_req); + DUMPI(set_size); + } +#endif + list_del(&b->requests); kfree(b); } +/* Since IO is frozen, nobody may modifiy the Transfer right log now... + */ +void tl_resend(drbd_dev *mdev) +{ + struct drbd_request *req; + struct list_head *le; + struct drbd_barrier *b; + int n_req; + + D_ASSERT(test_bit(IO_FROZEN,&mdev->flags)); + + b = mdev->oldest_barrier; + while(1) { + n_req=0; + list_for_each(le, &b->requests) { + req = list_entry(le, struct drbd_request,w.list); + drbd_resend_dblock(mdev,req); + n_req++; + } + b->n_req = n_req; // only necessary for the oldest... + if( b == mdev->newest_barrier ) break; + drbd_resend_barrier(mdev,b); + b = b->next; + } + D_ASSERT(test_bit(IO_FROZEN,&mdev->flags)); +} + + void tl_clear(drbd_dev *mdev) { struct list_head *le,*tle; @@ -455,6 +494,19 @@ // FIXME EXPLAIN clear_bit(MD_IO_ALLOWED,&mdev->flags); } + + if(mdev->conf.on_disconnect == FreezeIO && mdev->state == Primary) { + if(os >= Connected && ns < Connected) { + set_bit(IO_FROZEN, &mdev->flags); + } + } + + if( ns <= StandAlone && test_bit(IO_FROZEN, &mdev->flags)) { + WARN("Going to thaw IO, setting out of sync %d requests.\n", + atomic_read(&mdev->ap_pending_cnt)); + tl_clear(mdev); + clear_bit(IO_FROZEN, &mdev->flags); + } } STATIC int drbd_thread_setup(void* arg) @@ -803,6 +855,17 @@ return ok; } +int drbd_resend_barrier(drbd_dev *mdev,struct drbd_barrier *b) +{ + int ok; + Drbd_Barrier_Packet p; + + p.barrier=b->br_number; + ok=drbd_send_cmd(mdev,USE_DATA_SOCKET, Barrier,(Drbd_Header*)&p,sizeof(p)); + + return ok; +} + int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr,u32 set_size) { int ok; @@ -1051,15 +1114,31 @@ * in down(). we have to check that, to avoid a race with tl_clear * cleaning up before we can tl_add */ if (unlikely(!mdev->data.socket)) { - /* this req is not in the tl, tl_clear cannot find it. - * we cannot just tl_add it here, either, because tl_clear - * might be done already. so we have to mark this request - * "SENT" here, otherwise it won't ever complete. - * FIXME won't work for freeze io. - * FIXME if we are Diskless, we complete a WRITE - * as successful here, that has never been written! */ - drbd_set_out_of_sync(mdev, req->sector, req->size); - drbd_end_req(req,RQ_DRBD_SENT,1); + /* this req is not in the tl, tl_clear cannot find it. + * + * For Freeze-IO, + * we add the req to the tl anyways, possibly creating + * a new epoch, and then do nothing. It will then still be + * submitted locally, but it cannot possibly signal + * completion to the upper layers before it was + * resent (tl_resend) or canceled (tl_clear). + * + * Otherwise, + * we cannot just tl_add it here, either, because tl_clear + * might be done already. so we have to mark this request + * "SENT" here, otherwise it won't ever complete. + * FIXME if we are Diskless, we complete a WRITE + * as successful here, that has never been written! */ + if (test_bit(IO_FROZEN,&mdev->flags)) { + if(test_and_clear_bit(ISSUE_BARRIER,&mdev->flags)) { + inc_ap_pending(mdev); + tl_add_barrier(mdev); + } + tl_add(mdev,req); + } else { + drbd_set_out_of_sync(mdev, req->sector, req->size); + drbd_end_req(req,RQ_DRBD_SENT,1); + } goto out; } @@ -1098,6 +1177,39 @@ return ok; } +int drbd_resend_dblock(drbd_dev *mdev, drbd_request_t *req) +{ + int ok; + Drbd_Data_Packet p; + + p.head.magic = BE_DRBD_MAGIC; + p.head.command = cpu_to_be16(Data); + p.head.length = cpu_to_be16(sizeof(p)-sizeof(Drbd_Header)+req->size); + + p.sector = cpu_to_be64(req->sector); + p.block_id = (unsigned long)req; + + down(&mdev->data.mutex); + + spin_lock(&mdev->send_task_lock); + mdev->send_task=current; + spin_unlock(&mdev->send_task_lock); + + dump_packet(mdev,mdev->data.socket,0,(void*)&p, __FILE__, __LINE__); + ok = sizeof(p) == drbd_send(mdev,mdev->data.socket,&p,sizeof(p),MSG_MORE); + if(ok) { + ok = _drbd_send_bio(mdev,req->master_bio); + } + + spin_lock(&mdev->send_task_lock); + mdev->send_task=NULL; + spin_unlock(&mdev->send_task_lock); + + up(&mdev->data.mutex); + return ok; +} + + int drbd_send_block(drbd_dev *mdev, Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e) { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_proc.c new/drbd-0.7.22/drbd/drbd_proc.c --- old/drbd-0.7.22/drbd/drbd_proc.c 2006-08-10 13:45:32.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_proc.c 2006-10-30 22:51:49.000000000 +0100 @@ -254,7 +254,7 @@ seq_printf( seq, "%2d: cs:Unconfigured\n", i); else seq_printf( seq, - "%2d: cs:%s st:%s/%s ld:%s\n" + "%2d: cs:%s st:%s/%s ld:%s %c\n" " ns:%u nr:%u dw:%u dr:%u al:%u bm:%u " "lo:%d pe:%d ua:%d ap:%d\n", i, sn, @@ -262,7 +262,7 @@ nodestate_to_name(drbd_conf[i].o_state), (drbd_conf[i].gen_cnt[Flags] & MDF_Consistent) ? "Consistent" : "Inconsistent", - // FIXME partner consistent? + test_bit(IO_FROZEN, &drbd_conf[i].flags)? 'F' : ' ', drbd_conf[i].send_cnt/2, drbd_conf[i].recv_cnt/2, drbd_conf[i].writ_cnt/2, diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_receiver.c new/drbd-0.7.22/drbd/drbd_receiver.c --- old/drbd-0.7.22/drbd/drbd_receiver.c 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_receiver.c 2006-10-30 22:51:49.000000000 +0100 @@ -810,7 +810,7 @@ drbd_thread_start(&mdev->asender); - drbd_send_param(mdev,0); + drbd_send_param(mdev,test_bit(IO_FROZEN, &mdev->flags) ? 4 : 0); clear_bit(USE_DEGR_WFC_T,&mdev->flags); return 1; @@ -1528,6 +1528,8 @@ } if(be32_to_cpu(p->flags)&2) consider_sync=1; + if(be32_to_cpu(p->flags)&4) consider_sync=0; + // XXX harmless race with ioctl ... mdev->sync_conf.rate = max_t(int,mdev->sync_conf.rate, be32_to_cpu(p->sync_rate)); @@ -1583,13 +1585,30 @@ if (mdev->cstate == WFReportParams) { INFO("Connection established.\n"); + + if(test_bit(IO_FROZEN, &mdev->flags)) { + WARN("Going to thaw IO, resending %d requests.\n", + atomic_read(&mdev->ap_pending_cnt)); + tl_resend(mdev); + set_bit(ISSUE_BARRIER,&mdev->flags); + if (mdev->cstate == WFReportParams) { + consider_sync = 0; + } else return FALSE; + } } if (consider_sync) { if (!drbd_sync_handshake(mdev,p)) return FALSE; } - if (mdev->cstate == WFReportParams) set_cstate(mdev,Connected); + if (mdev->cstate == WFReportParams) { + set_cstate(mdev,Connected); + if(test_bit(IO_FROZEN, &mdev->flags)) { + clear_bit(IO_FROZEN, &mdev->flags); + drbd_thaw_frozen_reqs(mdev); + consider_sync = 0; + } + } oo_state = mdev->o_state; mdev->o_state = be32_to_cpu(p->state); @@ -1869,11 +1888,20 @@ drbd_wait_ee(mdev,&mdev->sync_ee); drbd_clear_done_ee(mdev); - // primary - tl_clear(mdev); - clear_bit(ISSUE_BARRIER,&mdev->flags); - wait_event( mdev->cstate_wait, atomic_read(&mdev->ap_pending_cnt)==0 ); - D_ASSERT(mdev->oldest_barrier->n_req == 0); + if(test_bit(IO_FROZEN, &mdev->flags)) { + WARN("IO frozen with ap_pending_cnt = %d\n", + atomic_read(&mdev->ap_pending_cnt)); + } else { + tl_clear(mdev); + clear_bit(ISSUE_BARRIER,&mdev->flags); + wait_event( mdev->cstate_wait, atomic_read(&mdev->ap_pending_cnt)==0 ); + D_ASSERT(mdev->oldest_barrier->n_req == 0); + + if(atomic_read(&mdev->ap_pending_cnt)) { + ERR("ap_pending_cnt = %d\n",atomic_read(&mdev->ap_pending_cnt)); + atomic_set(&mdev->ap_pending_cnt,0); + } + } // both clear_bit(PARTNER_CONSISTENT, &mdev->flags); @@ -1905,11 +1933,6 @@ on the fly. */ atomic_set(&mdev->rs_pending_cnt,0); - if(atomic_read(&mdev->ap_pending_cnt)) { - ERR("ap_pending_cnt = %d\n",atomic_read(&mdev->ap_pending_cnt)); - atomic_set(&mdev->ap_pending_cnt,0); - } - wake_up(&mdev->cstate_wait); if ( mdev->state == Primary && @@ -2289,6 +2312,7 @@ int received = 0; int expect = sizeof(Drbd_Header); int cmd = -1; + int empty; static struct asender_cmd asender_tbl[] = { [Ping] ={ sizeof(Drbd_Header), got_Ping }, @@ -2320,12 +2344,12 @@ * this needs to be fixed properly, I'd vote for a separate * msock sender thread, but others will frown upon yet an other * kernel thread... - * -- lge + * -- lge */ set_bit(SIGNAL_ASENDER, &mdev->flags); - + if (!drbd_process_ee(mdev,0)) goto err; - + rv = drbd_recv_short(mdev,buf,expect-received); clear_bit(SIGNAL_ASENDER, &mdev->flags); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_req.c new/drbd-0.7.22/drbd/drbd_req.c --- old/drbd-0.7.22/drbd/drbd_req.c 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_req.c 2006-10-30 22:51:49.000000000 +0100 @@ -167,12 +167,34 @@ { drbd_request_t *req; int local, remote; + unsigned long flags; + ONLY_IN_26( + /* Currently our BARRIER code is disabled. */ + if(unlikely(bio_barrier(bio))) { + bio_endio(bio, bio->bi_size, -EOPNOTSUPP); + return 0; + } + ) if (unlikely(drbd_did_panic == DRBD_MAGIC)) { drbd_bio_IO_error(bio); return 0; } + if( rw == WRITE && test_bit(IO_FROZEN, &mdev->flags)) { + bio->REQ_NEXT = NULL; + + spin_lock_irqsave(&mdev->req_lock,flags); + if(mdev->last_frozen_bio == NULL) { + mdev->first_frozen_bio = bio; + mdev->last_frozen_bio = bio; + } else { + mdev->last_frozen_bio->REQ_NEXT = bio; + mdev->last_frozen_bio = bio; + } + spin_unlock_irqrestore(&mdev->req_lock,flags); + return 0; + } /* * If someone tries to mount on Secondary, and this is a 2.4 kernel, * it would lead to a readonly mounted, but not cache-coherent, @@ -243,8 +265,8 @@ // down_read(mdev->device_lock); wait_event( mdev->cstate_wait, - (volatile int)(mdev->cstate < WFBitMapS || - mdev->cstate > WFBitMapT) ); + (volatile int)mdev->cstate < WFBitMapS || + (volatile int) mdev->cstate > WFBitMapT); local = inc_local(mdev); NOT_IN_26( if (rw == READA) rw=READ ); @@ -411,3 +433,27 @@ bio->bi_sector,bio); } #endif + +void drbd_thaw_frozen_reqs(drbd_dev *mdev) +{ + drbd_bio_t *bio; + int reqs=0; + + spin_lock_irq(&mdev->req_lock); + bio = mdev->first_frozen_bio; + mdev->first_frozen_bio = NULL; + mdev->last_frozen_bio = NULL; + spin_unlock_irq(&mdev->req_lock); + + while(bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + drbd_make_request_common(mdev,WRITE,bio->b_size,bio->b_rsector,bio); +#else + drbd_make_request_common(mdev,WRITE,bio->bi_size,bio->bi_sector,bio); +#endif + bio = bio->REQ_NEXT; + reqs++; + } + WARN("Continued %d requests (which where issued after IO-freeze).\n", + reqs); +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/drbd_worker.c new/drbd-0.7.22/drbd/drbd_worker.c --- old/drbd-0.7.22/drbd/drbd_worker.c 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/drbd_worker.c 2006-10-30 22:51:49.000000000 +0100 @@ -150,7 +150,7 @@ drbd_chk_io_error(mdev,!uptodate); // req may get freed within drbd_end_req rsector = req->sector; - drbd_end_req(req, RQ_DRBD_LOCAL, uptodate, rsector); + drbd_end_req(req, RQ_DRBD_LOCAL, uptodate); drbd_al_complete_io(mdev,rsector); dec_local(mdev); } @@ -286,6 +286,8 @@ ERR_IF (bio->bi_size) return 1; + if(error) DUMPI(error); + drbd_chk_io_error(mdev,error); // req may get freed within drbd_end_req rsector = req->sector; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd/linux/drbd_config.h new/drbd-0.7.22/drbd/linux/drbd_config.h --- old/drbd-0.7.22/drbd/linux/drbd_config.h 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd/linux/drbd_config.h 2006-10-30 22:51:49.000000000 +0100 @@ -69,6 +69,6 @@ // but more recent kernels define it in arch/um/include/mem.h #define HAVE_UML_TO_VIRT -#define NO_MORE_DEV_FS +//#define NO_MORE_DEV_FS #endif diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/drbd.spec.in new/drbd-0.7.22/drbd.spec.in --- old/drbd-0.7.22/drbd.spec.in 2006-10-06 13:51:18.000000000 +0200 +++ new/drbd-0.7.22/drbd.spec.in 2006-10-30 22:51:52.000000000 +0100 @@ -64,9 +64,7 @@ %prep %setup test -d %{kdir}/. -test $(echo -e "#include <linux/version.h>\ndrbd_kernel_release UTS_RELEASE" | - gcc -nostdinc -E -P -I%{kdir}/include - | - sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p') = %{kernelversion} +test "$(scripts/get_uts_release.sh)" = %{kernelversion} %build echo kernelversion=%{kernelversion} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/scripts/adjust_drbd_config_h.sh new/drbd-0.7.22/scripts/adjust_drbd_config_h.sh --- old/drbd-0.7.22/scripts/adjust_drbd_config_h.sh 2006-10-06 13:51:17.000000000 +0200 +++ new/drbd-0.7.22/scripts/adjust_drbd_config_h.sh 2006-10-30 22:51:48.000000000 +0100 @@ -22,10 +22,20 @@ test -n "$KDIR" KDIR=${KDIR%/} +if test -z "$O"; then + O=$KDIR; +else + O=${O%/} +fi -ls >/dev/null \ -$KDIR/{.config,Makefile,include/{linux/{version,sched,list,fs},asm/bitops}.h} - +# some paranoia: check that all files are where we expect them +ls > /dev/null \ +$KDIR/{Makefile,include/linux/{sched,list,fs}.h} +ls > /dev/null \ +$O/{.config,Makefile,include/linux/version.h} +test -e $KDIR/include/asm/bitops.h || +test -e $O/include2/asm/bitops.h || +exit 1 if grep_q "^PATCHLEVEL *= *4" $KDIR/Makefile ; then # do we have the threadding stuff in the kernel, diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/scripts/drbd.conf new/drbd-0.7.22/scripts/drbd.conf --- old/drbd-0.7.22/scripts/drbd.conf 2006-10-06 13:51:17.000000000 +0200 +++ new/drbd-0.7.22/scripts/drbd.conf 2006-10-30 22:51:48.000000000 +0100 @@ -197,9 +197,6 @@ # "stand_alone" -> Do not reconnect (AKA StandAlone state) # "freeze_io" -> Try to reconnect but freeze all IO until # the connection is established again. - # [ lge: oops. freeze_io is not implemented yet... ] - # [ at least not in drbd 0.7.x; but nobody wanted to use ] - # [ that anyways, otherwise we had noticed earlier :-) ] # on-disconnect reconnect; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/scripts/get_uts_release.sh new/drbd-0.7.22/scripts/get_uts_release.sh --- old/drbd-0.7.22/scripts/get_uts_release.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/drbd-0.7.22/scripts/get_uts_release.sh 2006-10-30 22:51:48.000000000 +0100 @@ -0,0 +1,12 @@ +#!/bin/bash +{ + for x in include/linux/{utsrelease,version}.h; + do + for d in $KDIR $O; + do + test -e "$d/$x" || continue; + echo "#include \"$d/$x\""; + done; + done; + echo "drbd_kernel_release UTS_RELEASE" +} | gcc -nostdinc -E -P - | sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p' diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/drbd-0.7.22/user/drbdsetup.c new/drbd-0.7.22/user/drbdsetup.c --- old/drbd-0.7.22/user/drbdsetup.c 2006-08-10 13:45:32.000000000 +0200 +++ new/drbd-0.7.22/user/drbdsetup.c 2006-10-30 22:51:52.000000000 +0100 @@ -188,7 +188,7 @@ const char *dh_names[] = { [Reconnect] = "reconnect", [DropNetConf] = "stand_alone", - // [FreezeIO] = "freeze_io" // TODO on the kernel side... + [FreezeIO] = "freeze_io" }; unsigned long resolv(const char* name) ++++++ drbd-kver.patch ++++++ Index: drbd/linux/drbd_config.h =================================================================== --- drbd/linux/drbd_config.h (revision 2574) +++ drbd/linux/drbd_config.h (working copy) @@ -69,6 +69,6 @@ // but more recent kernels define it in arch/um/include/mem.h #define HAVE_UML_TO_VIRT -//#define NO_MORE_DEV_FS +#define NO_MORE_DEV_FS #endif Index: Makefile =================================================================== --- Makefile (revision 2574) +++ Makefile (working copy) @@ -160,9 +160,6 @@ KDIR := $(shell echo /lib/modules/`uname -r`/build) KVER := $(shell KDIR=$(KDIR) O=$(O) scripts/get_uts_release.sh) -ifeq ($(KVER),) -$(error "could not determine uts_release") -endif kernel-patch: drbd/drbd_buildtag.c set -o errexit; \ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@suse.de