Browse Source

Merge upstream version 30

David Martínez Moreno 14 years ago
parent
commit
5445a73a07
24 changed files with 129 additions and 45 deletions
  1. 1 1
      Makefile
  2. 21 0
      NEWS
  3. 4 2
      README
  4. 1 1
      aoe-discover.in
  5. 1 1
      aoe-flush.in
  6. 1 1
      aoe-interfaces.in
  7. 1 1
      aoe-mkdevs
  8. 1 1
      aoe-mkshelf.in
  9. 1 1
      aoe-revalidate.in
  10. 3 2
      aoe-stat.8
  11. 1 1
      aoe-stat.in
  12. 23 4
      aoe-version
  13. 1 1
      aoecfg.8
  14. 1 1
      aoecfg.c
  15. 11 3
      aoeping.8
  16. 42 10
      aoeping.c
  17. 1 1
      aoetools.8
  18. 2 2
      coraid-update
  19. 2 2
      coraid-update.8
  20. 3 1
      dat.h
  21. 3 3
      devnodes.txt
  22. 1 1
      fns.h
  23. 1 1
      linux.c
  24. 2 3
      sos-linux

+ 1 - 1
Makefile

@@ -27,7 +27,7 @@ MANDIR = ${PREFIX}/usr/share/man
 #
 # You can see the setting in your driver like this in the driver
 # source directory.  (Change into the "linux" directory if you're
-# using the standalone driver from the Coraid.)
+# using the standalone driver from CORAID.)
 #
 #   grep 'NPERSHELF.*=' drivers/block/aoe/aoe.h
 #

+ 21 - 0
NEWS

@@ -1,3 +1,24 @@
+2009-03-03 Ed Cashin <ecashin@coraid.com>
+	aoe-version modinfo workaround: cd to a directory without aoe
+	release 30
+
+2008-12-09 Ed Cashin <ecashin@coraid.com>
+	mention that aoeping uses raw sockets in manpage
+	use absolute path to aoe.ko when ./aoe is readable
+	release 29
+
+2008-11-11 Ed Cashin <ecashin@coraid.com>
+	remove "function" reserved word from aoe-flush (for dash shell)
+	release 28
+
+2008-08-01 Ed Cashin <ecashin@coraid.com>
+	use ".txt" extension for output file of sos-linux
+
+2008-06-27 Ed Cashin <ecashin@coraid.com>
+	aoeping: recognize errors in SMART command response
+	aoe-stat manpage improvements
+	release 27
+
 2008-05-14 "Ed L. Cashin" <ecashin@coraid.com>
 	add sos-linux tool for collecting localhost information
 	release 26

+ 4 - 2
README

@@ -38,6 +38,8 @@ These two are legacy commands for systems without udev.
 The aoetools homepage
   http://aoetools.sourceforge.net/
 
-The Coraid homepage
+The CORAID homepage
   http://www.coraid.com/
-  http://www.coraid.com/support/linux/
+
+The Linux Support Page at CORAID
+  http://support.coraid.com/support/linux/

+ 1 - 1
aoe-discover.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-discover - trigger an AoE device discovery
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 zero=`basename $0`
 f=@devdir@/discover

+ 1 - 1
aoe-flush.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-flush - ask aoe driver to forget about devices
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 zero="`basename $0`"
 f="@devdir@/flush"

+ 1 - 1
aoe-interfaces.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-interfaces - set or list the allowed AoE network interfaces
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 zero="`basename $0`"
 devf=@devdir@/interfaces

+ 1 - 1
aoe-mkdevs

@@ -1,6 +1,6 @@
 #!/bin/sh
 # aoe-mkdevs - make static device nodes on systems without udev
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 n_shelves=${n_shelves:-10}
 n_partitions=${n_partitions:-16}

+ 1 - 1
aoe-mkshelf.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-mkshelf - device nodes for one shelf without udev
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 zero=`basename $0`
 

+ 1 - 1
aoe-revalidate.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-revalidate - ask aoe driver to query AoE target
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 zero=`basename $0`
 f=@devdir@/revalidate

+ 3 - 2
aoe-stat.8

@@ -32,8 +32,9 @@ The size of the AoE device is in gigabytes (billions of bytes).
 The network interface name is printed in the third column.
 .TP
 .BI payload
-If the driver exports the per-packet data payload size, it
-will appear in the fourth column, expressed in bytes.
+The number of bytes read from or written to the storage target in
+each AoE packet appears in the fourth column, unless the aoe driver
+does not export this information.
 .TP
 .BI status
 The device status is in the last column.  Possible values

+ 1 - 1
aoe-stat.in

@@ -1,6 +1,6 @@
 #! /bin/bash
 # aoe-stat - collate and present information about AoE storage
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
 set -e
 me=`basename $0`

+ 23 - 4
aoe-version

@@ -1,16 +1,35 @@
 #! /bin/sh
 # aoe-version - display versions of AoE-related software
-# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
 
-aoetools=26
+aoetools=30
+
+# modinfo doesn't always work correctly when there is a file
+# in the current working directory called "aoe", but it's
+# not hard to change the current working directory.
+for wd in . / /sys /var/run /usr /proc /etc /home; do
+	a=`{ cd "$wd" 2> /dev/null && test ! -r aoe && echo yes; } || echo no`
+	if test "$a" = "yes"; then
+		cd "$wd"
+		break
+	fi
+done
+# The aoe module isn't guaranteed to be in the location below,
+# but if we only try to use it when each of the directories
+# above was not usable, we shouldn't use the hard-coded location
+# often.
+aoe=aoe
+if test -r ./aoe; then
+	aoe="/lib/modules/`uname -r`/kernel/drivers/block/aoe/aoe.ko"
+fi
 
 # standalone aoe drivers have a module parameter "version"
-installed="`modinfo aoe 2>/dev/null | awk '/srcversion/ {next} /^parm:.*version:aoe module/ {print $NF; exit 0}'`"
+installed="`modinfo \"$aoe\" 2>/dev/null | awk '/srcversion/ {next} /^parm:.*version:aoe module/ {print $NF; exit 0}'`"
 if test -z "$installed"; then
 	# Recent kernels have a "version" of their own, so
 	# they didn't want our module parameter, so we look
 	# for that, too, in case user is using kernel.org driver.
-	installed="`modinfo aoe 2>/dev/null | awk '/^version:/ {print $NF; exit 0}'`"
+	installed="`modinfo \"$aoe\" 2>/dev/null | awk '/^version:/ {print $NF; exit 0}'`"
 fi
 if test "$?" != "0" || test -z "$installed"; then
 	installed="(unknown)"

+ 1 - 1
aoecfg.8

@@ -71,7 +71,7 @@ specifiy the network interface.  The default is
 .IR aoe-mkshelf (8),
 .IR aoe-stat (8),
 .IR aoeping (8),
-\fIAoE (ATA over Ethernet)\fP: http://www.coraid.com/documents/AoEr10.txt,
+\fIAoE (ATA over Ethernet)\fP: http://support.coraid.com/documents/AoEr10.txt,
 \fIATA specification\fP
 .SH AUTHOR
 Erik Quanstrom (quanstro@coraid.com)

+ 1 - 1
aoecfg.c

@@ -1,6 +1,6 @@
 /*
  * aoecfgstr.c - fiddle aoe configuration strings.
- * Copyright 2008, Erik Quanstrom, Coraid, Inc., Licenced under GPL v2
+ * Copyright 2009, Erik Quanstrom, CORAID, Inc., Licenced under GPL v2
  */
 #include <stdio.h>
 #include <string.h>

+ 11 - 3
aoeping.8

@@ -8,7 +8,8 @@ aoeping \- simple communication with AoE device
 The
 .IR aoeping (8)
 program performs simple one or two-round-trip communication with an
-ATA over Ethernet (AoE) device.
+ATA over Ethernet (AoE) device.  It creates and receives AoE packets
+directly, using raw network sockets.
 .PP
 Running
 .IR aoeping (8)
@@ -17,7 +18,7 @@ short usage summary being displayed.
 .PP
 The
 .IR aoeping (8)
-program will wait forever if if doesn't receive
+program will wait forever if it doesn't receive
 an expected response.  The caller should use a time out to catch
 this situation.
 .SS Arguments
@@ -85,6 +86,13 @@ reads from
 standard input the one sector of data to be
 written to the specified log.
 
+If the AoE device does not support SMART commands or if the command is
+aborted, an error message
+is printed to standard error and
+.IR aoeping (8)
+exits with a non-zero status.  A command may be aborted if SMART is
+disabled on the device.
+
 The
 .IR aoeping (8)
 command just sends and receives SMART commands, without
@@ -165,7 +173,7 @@ device fault bit (bit 5) set.
 .IR aoe-mkshelf (8),
 .IR aoe-stat (8),
 
-\fIAoE (ATA over Ethernet)\fP: http://www.coraid.com/documents/AoEr10.txt,
+\fIAoE (ATA over Ethernet)\fP: http://support.coraid.com/documents/AoEr10.txt,
 
 \fIATA specification\fP
 .SH AUTHOR

+ 42 - 10
aoeping.c

@@ -1,5 +1,5 @@
 /* aoeping.c - userland aoe pinger
- * Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+ * Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
  *
  * run without arguments for usage
  */
@@ -210,8 +210,20 @@ pp_idtext(char *prefix, unsigned char *p, size_t len)
 	putchar('\n');
 }
 
+int smart_supported(unsigned char *p)
+{
+	u16 w;
+
+	p += 82 * 2;		/* skip to word 82 */
+	w = *p++;
+	w |= *p << 8;
+
+	/* word 82 bit 0 is SMART support per ATA spec */
+	return !!(w & 1);
+}
+
 void
-disk_identify(Conf *c, u32 tag)
+disk_identify(Conf *c, struct progopts *opts, int *smart)
 {
 	int n;
 	uchar buf[1400];
@@ -219,7 +231,7 @@ disk_identify(Conf *c, u32 tag)
 	Ata *p;
 	struct hd_driveid *id;
 
-	ata_prep(&a, c, tag);
+	ata_prep(&a, c, opts->tag);
 	a.sectors = 1;
 	a.cmd = ATAid_dev;
 	a.lba[3] = 0xa0;
@@ -229,15 +241,19 @@ disk_identify(Conf *c, u32 tag)
 		exit(EXIT_FAILURE);
 	}
 
-	n = aoe_pkt_read(buf, sizeof buf, c, tag);
+	n = aoe_pkt_read(buf, sizeof buf, c, opts->tag);
 	p = (Ata *) buf;
 
-	if (!opts.pp_ataid) {
+	*smart = smart_supported(p->data);
+
+	if (opts->ata_ident && !opts->pp_ataid) {
 		puts("device identify response:");
 		hex_print(stdout, p->data, 512, " ");
 		return;
 	}
-
+	if (!opts->pp_ataid)
+		return;
+	
 	for (n = 0; n < 1024; n += 2) {
 		unsigned char ch;
 		ch = p->data[n];
@@ -281,9 +297,15 @@ smart_registers(Ata *a, char *opts, struct smartcmd *s)
 		a->lba[0] = strtol(opts, NULL, 0);
 }
 
-void
+int
 show_smart_regs(Ata *a)
 {
+	if (a->err & ATAabrt) {
+		fputs("SMART command aborted on target.\n",
+		      stderr);
+		return -1;
+	}
+
 	puts("ATA registers:");
 	char *names[] = {
 		"Features", "Sector Count",
@@ -299,6 +321,8 @@ show_smart_regs(Ata *a)
 
 	for (i = 0; i < sizeof regs / sizeof regs[0]; ++i)
 		printf("%20s: 0x%02x\n", names[i], regs[i]);
+
+	return 0;
 }
 
 void
@@ -335,7 +359,8 @@ smart(Conf *c, u32 tag, char *smart_cmd)
 	}
 	n = aoe_pkt_read(buf, sizeof buf, c, tag);
 	p = (Ata *) buf;
-	show_smart_regs(p);
+	if (show_smart_regs(p) != 0)
+		exit(EXIT_FAILURE);
 	if (s->data & SmartDataRet) {
 		puts("SMART data:");
 		hex_print(stdout, p->data, 512, " ");
@@ -416,6 +441,7 @@ int
 main(int argc, char *argv[])
 {
 	Conf c;
+	int smartable = 0;
 
 	opts = defaults;
 	progname = strrchr(argv[0], '/');
@@ -448,14 +474,20 @@ main(int argc, char *argv[])
 		fflush(stdout);
 	}
 
-	if (opts.ata_ident) {
+	if (opts.ata_ident || opts.smart) {
 		alarm(opts.timeout);
-		disk_identify(&c, opts.tag);
+		disk_identify(&c, &opts, &smartable);
 		alarm(0);
 		opts.tag += 1;
 	}
 
 	if (opts.smart) {
+		if (!smartable) {
+			fprintf(stderr,
+				"Error: e%d.%d does not support SMART\n",
+				ntohs(c.h.maj), c.h.min);
+			exit(EXIT_FAILURE);
+		}
 		alarm(opts.timeout);
 		smart(&c, opts.tag, opts.smart);
 		alarm(0);

+ 1 - 1
aoetools.8

@@ -33,7 +33,7 @@ collate and present information about AoE storage
 display version numbers of AoE-related software
 .TP
 .BI coraid-update
-send updates to Coraid appliances
+send updates to CORAID appliances
 .TP
 .BI sos-linux
 collect AoE-related information about the localhost

+ 2 - 2
coraid-update

@@ -6,7 +6,7 @@
 #   1) an AoE target ready for I/O, and
 #   2) not too big to be an update target
 #
-# Later, when Coraid appliances mark update targets with special ATA
+# Later, when CORAID appliances mark update targets with special ATA
 # device identify content or special target content, a prompt should
 # be added after the check of the target's size if the identifying
 # content is not detected.
@@ -15,7 +15,7 @@
 #   1) be an SR tarc file that looks OK to the local tar, or
 #   2) any file not ending in ".tarc".
 
-# size of update lblade in /proc/partitions is 40000
+# size of update LUN in /proc/partitions is 40000
 max=70000
 
 usage="usage: coraid-update {update file} {AoE device}"

+ 2 - 2
coraid-update.8

@@ -1,6 +1,6 @@
 .TH coraid-update 8
 .SH NAME
-coraid-update \- upload an update file to a Coraid appliance
+coraid-update \- upload an update file to a CORAID appliance
 .SH SYNOPSIS
 .nf
 .B coraid-update {update file} {AoE device}
@@ -10,7 +10,7 @@ The
 .I coraid-update
 script performs a few sanity checks before copying the local
 update
-file to the remote update AoE target on the Coraid appliance.
+file to the remote update AoE target on the CORAID appliance.
 .PP
 Two arguments are provided: 1) the name of the update file
 to be uploaded, and 2) the special block device file corresponding

+ 3 - 1
dat.h

@@ -1,5 +1,5 @@
 /* dat.h - aoetools type definitions and macros
- * Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+ * Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
  */
 
 #define	nil	NULL
@@ -95,6 +95,8 @@ enum {
 	ATAid_dev = 0xec,	// ATA commands
 	ATAsmart = 0xb0,
 
+	ATAabrt = 0x4,		// ATA error bits
+
 	SmartDataPut = 0x01,
 	SmartDataRet = 0x10,
 };

+ 3 - 3
devnodes.txt

@@ -15,13 +15,13 @@ numbers in the kernel, you could accidentally perform reads and writes
 to the wrong AoE device.  (It really is easier to let udev take care
 of the device nodes.)
 
-If you use an aoe driver from the Coraid website
-(http://www.coraid.com/support/linux/) then just use the aoetools that
+If you use an aoe driver from the CORAID website
+(http://support.coraid.com/support/linux/) then just use the aoetools that
 come bundled with that deiver.  If you don't have udev, make sure you
 always load the aoe module with the aoe_dyndevs=0 option for any
 driver version above 49.
 
-If you didn't get your aoe driver from the Coraid website, and you
+If you didn't get your aoe driver from the CORAID website, and you
 can't use udev, then here's what to do:
 
     * Of course, read the README file in the aoetools sources.

+ 1 - 1
fns.h

@@ -1,4 +1,4 @@
-/* Copyright 2008, Coraid, Inc., and licensed under GPL v.2. */
+/* Copyright 2009, CORAID, Inc., and licensed under GPL v.2. */
 int dial(char *eth);
 int getea(int s, char *name, uchar *ea);
 

+ 1 - 1
linux.c

@@ -1,5 +1,5 @@
 /* linux.c: low level access routines for Linux
- * Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
+ * Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
  */
 #include "config.h"
 #include <sys/socket.h>

+ 2 - 3
sos-linux

@@ -1,7 +1,7 @@
 #! /bin/sh
 
 me="`basename $0`"
-outf="$HOME/sos-linux-`date +%Y%m%d-%H%M%S`.out"
+outf="$HOME/sos-`hostname`-`date +%Y%m%d-%H%M%S`.txt"
 
 if test "`whoami`" != "root"; then
 	echo "$me: please run $me as root" 1>&2
@@ -13,7 +13,7 @@ exec > $outf
 exec 2>&1
 set -x
 uname -a
-grep . /etc/*release*
+grep . /etc/*release* /etc/*version* | sed 50q
 find /sys/module/aoe -name version | xargs cat
 cat /proc/mounts
 aoe-version
@@ -24,7 +24,6 @@ ifconfig -a
 free
 dmesg | tail -n 50
 lspci
-grep . /sys/block/etherd\!e*.*/debug
 set +x
 for i in `aoe-stat | awk '{print $3}' | sed 's!,! !g'`; do
 	echo ethtool -S $i