Skip to contentSkip to conversation

AOE fixes for 2.6.11

PATCH New Greg KH 1 participant 7 messages Mar 10, 2005

Subsystems (3)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 AOE fixes for 2.6.11

Hi,

Here are some AOE driver fixes and documentation updates. These have all been in the -mm releases for a while.

Please pull from: bk://kernel.bkbits.net/gregkh/linux/2.6.11/aoe

Individual patches will follow, sent to the linux-kernel list.

thanks,

greg k-h

 Documentation/aoe/aoe.txt         |   13 +++++++++---
 Documentation/aoe/status.sh       |    7 ++++--
 Documentation/aoe/udev-install.sh |   36 ++++++++++++++++++++++++++++-----
 Documentation/aoe/udev.txt        |   23 +++++++++++++++++++++
 drivers/block/aoe/aoe.h           |    1 
 drivers/block/aoe/aoechr.c        |   41 ++------------------------------------
 drivers/block/aoe/aoecmd.c        |    8 ++++---
 7 files changed, 77 insertions(+), 52 deletions(-)

-----

Alexander Nyberg:
o AoE warning on 64-bit archs

Ed L. Cashin:
o aoe: drivers/block/aoe/aoechr.c cleanups
o aoe status.sh: handle sysfs not in /etc/mtab
o aoe: fail IO on disk errors
o aoe: update documentation for udev users
o aoe: add documentation for udev users

author
#1 lore raw

PATCH 1/1 AoE warning on 64-bit archs

ChangeSet 1.2035, 2005/03/09 10:20:37-08:00, [email protected]

[PATCH] AoE warning on 64-bit archs

I just accidently built AoE on x86-64 and it emits a warning due to conversion of types of different size, trivial fix:

 drivers/block/aoe/aoechr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/block/aoe/aoechr.c +2 -2
diff -Nru a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
@@ -178,13 +178,13 @@
 static ssize_t
 aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
 {
-	int n;
+	unsigned long n;
 	char *mp;
 	struct ErrMsg *em;
 	ssize_t len;
 	ulong flags;
 
-	n = (int) filp->private_data;
+	n = (unsigned long) filp->private_data;
 	switch (n) {
 	case MINOR_ERR:
 		spin_lock_irqsave(&emsgs_lock, flags);
author
#2 lore raw

PATCH 1/1 aoe: add documentation for udev users

ChangeSet 1.2036, 2005/03/09 10:20:56-08:00, [email protected]

[PATCH] aoe: add documentation for udev users

add documentation for udev users

 Documentation/aoe/aoe.txt         |   13 ++++++++++---
 Documentation/aoe/udev-install.sh |   22 ++++++++++++++++++++++
 Documentation/aoe/udev.txt        |   23 +++++++++++++++++++++++
 3 files changed, 55 insertions(+), 3 deletions(-)
Documentation/aoe/aoe.txt +10 -3
diff -Nru a/Documentation/aoe/aoe.txt b/Documentation/aoe/aoe.txt
@@ -6,9 +6,16 @@
 
 CREATING DEVICE NODES
 
-  Users of udev should find device nodes created automatically.  Two
-  scripts are provided in Documentation/aoe as examples of static
-  device node creation for using the aoe driver.
+  Users of udev should find the block device nodes created
+  automatically, but to create all the necessary device nodes, use the
+  udev configuration rules provided in udev.txt (in this directory).
+
+  There is a udev-install.sh script that shows how to install these
+  rules on your system.
+
+  If you are not using udev, two scripts are provided in
+  Documentation/aoe as examples of static device node creation for
+  using the aoe driver.
 
     rm -rf /dev/etherd
     sh Documentation/aoe/mkdevs.sh /dev/etherd
Documentation/aoe/udev-install.sh new file +22 -0
diff -Nru a/Documentation/aoe/udev-install.sh b/Documentation/aoe/udev-install.sh
@@ -0,0 +1,22 @@
+# install the aoe-specific udev rules from udev.txt into 
+# the system's udev configuration
+# 
+
+me="`basename $0`"
+
+# find udev.conf, often /etc/udev/udev.conf
+# (or environment can specify where to find udev.conf)
+#
+if test -z "$conf"; then
+	conf="`find /etc -type f -name udev.conf 2> /dev/null`"
+fi
+if test -z "$conf" || test ! -r $conf; then
+	echo "$me Error: could not find readable udev.conf in /etc" 1>&2
+	exit 1
+fi
+
+# find the directory where udev rules are stored, often
+# /etc/udev/rules.d
+#
+rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`"
+test "$rules_d" && sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"
Documentation/aoe/udev.txt new file +23 -0
diff -Nru a/Documentation/aoe/udev.txt b/Documentation/aoe/udev.txt
@@ -0,0 +1,23 @@
+# These rules tell udev what device nodes to create for aoe support.
+# They may be installed along the following lines (adjusted to what
+# you see on your system).
+# 
+#   ecashin@makki ~$ su
+#   Password:
+#   bash# find /etc -type f -name udev.conf
+#   /etc/udev/udev.conf
+#   bash# grep udev_rules= /etc/udev/udev.conf
+#   udev_rules="/etc/udev/rules.d/"
+#   bash# ls /etc/udev/rules.d/
+#   10-wacom.rules  50-udev.rules
+#   bash# cp /path/to/linux-2.6.xx/Documentation/aoe/udev.txt \
+#           /etc/udev/rules.d/60-aoe.rules
+#  
+
+# aoe char devices
+SUBSYSTEM="aoe", KERNEL="discover",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+SUBSYSTEM="aoe", KERNEL="err",		NAME="etherd/%k", GROUP="disk", MODE="0440"
+SUBSYSTEM="aoe", KERNEL="interfaces",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+
+# aoe block devices     
+KERNEL="etherd*",       NAME="%k", GROUP="disk"
author
#3 lore raw

PATCH 1/1 aoe: update documentation for udev users

ChangeSet 1.2037, 2005/03/09 10:21:15-08:00, [email protected]

[PATCH] aoe: update documentation for udev users

Quoted 4 lines · Bodo Eggert
Quoted 2 lines · Ed L Cashin

+if=A0test=A0-z=A0"$conf";=A0then +=A0=A0=A0=A0=A0=A0=A0=A0conf=3D"`find=A0/etc=A0-type=A0f=A0-name=A0udev=

.conf=A02>=A0/dev/null`"

Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+fi
+if=A0test=A0-z=A0"$conf"=A0||=A0test=A0!=A0-r=A0$conf;=A0then
+=A0=A0=A0=A0=A0=A0=A0=A0echo=A0"$me=A0Error:=A0could=A0not=A0find=A0rea=

dable=A0udev.conf=A0in=A0/etc"=A01>&2

Quoted 10 lines
Quoted 2 lines

+=A0=A0=A0=A0=A0=A0=A0=A0exit=A01
+fi

This will fail and print
---
bash: test: etc/udev.conf: binary operator expected
---
if there is more than one udev.conf.

Fix: Always put quotes around variables.

Thanks. With the changes below, it still will complain if it finds more than one udev.conf, but only if /etc/udev/udev.conf doesn't exist.

Quote all shell variables, and use /etc/udev/udev.conf if available.

 Documentation/aoe/udev-install.sh |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
Documentation/aoe/udev-install.sh +9 -5
diff -Nru a/Documentation/aoe/udev-install.sh b/Documentation/aoe/udev-install.sh
@@ -8,11 +8,15 @@
 # (or environment can specify where to find udev.conf)
 #
 if test -z "$conf"; then
-	conf="`find /etc -type f -name udev.conf 2> /dev/null`"
-fi
-if test -z "$conf" || test ! -r $conf; then
-	echo "$me Error: could not find readable udev.conf in /etc" 1>&2
-	exit 1
+	if test -r /etc/udev/udev.conf; then
+		conf=/etc/udev/udev.conf
+	else
+		conf="`find /etc -type f -name udev.conf 2> /dev/null`"
+		if test -z "$conf" || test ! -r "$conf"; then
+			echo "$me Error: no udev.conf found" 1>&2
+			exit 1
+		fi
+	fi
 fi
 
 # find the directory where udev rules are stored, often
author
#4 lore raw

PATCH 1/1 aoe: fail IO on disk errors

ChangeSet 1.2038, 2005/03/09 10:21:33-08:00, [email protected]

[PATCH] aoe: fail IO on disk errors

This patch makes disk errors fail the IO instead of getting logged and ignored.

Fail IO on disk errors

 drivers/block/aoe/aoecmd.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/block/aoe/aoecmd.c +5 -3
diff -Nru a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
@@ -416,7 +416,9 @@
 
 	if (ahin->cmdstat & 0xa9) {	/* these bits cleared on success */
 		printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh "
-			"stat=%2.2Xh\n", ahout->cmdstat, ahin->cmdstat);
+			"stat=%2.2Xh from e%ld.%ld\n", 
+			ahout->cmdstat, ahin->cmdstat,
+			d->aoemajor, d->aoeminor);
 		if (buf)
 			buf->flags |= BUFFL_FAIL;
 	} else {
@@ -458,8 +460,8 @@
 	if (buf) {
 		buf->nframesout -= 1;
 		if (buf->nframesout == 0 && buf->resid == 0) {
-			n = !(buf->flags & BUFFL_FAIL);
-			bio_endio(buf->bio, buf->bio->bi_size, 0);
+			n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
+			bio_endio(buf->bio, buf->bio->bi_size, n);
 			mempool_free(buf, d->bufpool);
 		}
 	}
author
#5 lore raw

PATCH 1/1 aoe status.sh: handle sysfs not in /etc/mtab

ChangeSet 1.2039, 2005/03/09 10:21:52-08:00, [email protected]

[PATCH] aoe status.sh: handle sysfs not in /etc/mtab

Suse 9.1 Pro doesn't put /sys in /etc/mtab. This patch makes the example aoe status.sh script work when sysfs is mounted but mount doesn't mention sysfs.

aoe status.sh: handle sysfs not in /etc/mtab

 Documentation/aoe/status.sh |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Documentation/aoe/status.sh +5 -2
diff -Nru a/Documentation/aoe/status.sh b/Documentation/aoe/status.sh
@@ -4,10 +4,13 @@
 set -e
 format="%8s\t%8s\t%8s\n"
 me=`basename $0`
+sysd=${sysfs_dir:-/sys}
 
 # printf "$format" device mac netif state
 
-test -z "`mount | grep sysfs`" && {
+# Suse 9.1 Pro doesn't put /sys in /etc/mtab
+#test -z "`mount | grep sysfs`" && {
+test ! -d "$sysd/block" && {
 	echo "$me Error: sysfs is not mounted" 1>&2
 	exit 1
 }
@@ -16,7 +19,7 @@
 	exit 1
 }
 
-for d in `ls -d /sys/block/etherd* 2>/dev/null | grep -v p` end; do
+for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
 	# maybe ls comes up empty, so we use "end"
 	test $d = end && continue
 
author
#6 lore raw

PATCH 1/1 aoe: drivers/block/aoe/aoechr.c cleanups

ChangeSet 1.2040, 2005/03/09 10:22:12-08:00, [email protected]

[PATCH] aoe: drivers/block/aoe/aoechr.c cleanups

Quoted 3 lines · Adrian Bunk

This patch contains the following cleanups:
- make the needlessly global struct aoe_fops static
- #if 0 the unused global function aoechr_hdump

Thanks for the patch. The original patch leaves the prototype for aoechr_hdump in aoe.h, but since this function is just for debugging, it seems better to just take both prototype and definition out.

remove aoechr_hdump
make aoe_fops static

 drivers/block/aoe/aoe.h    |    1 -
 drivers/block/aoe/aoechr.c |   37 +------------------------------------
 2 files changed, 1 insertion(+), 37 deletions(-)
drivers/block/aoe/aoe.h +0 -1
diff -Nru a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
@@ -143,7 +143,6 @@
 int aoechr_init(void);
 void aoechr_exit(void);
 void aoechr_error(char *);
-void aoechr_hdump(char *, int len);
 
 void aoecmd_work(struct aoedev *d);
 void aoecmd_cfg(ushort, unsigned char);
drivers/block/aoe/aoechr.c +1 -36
diff -Nru a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
@@ -99,41 +99,6 @@
 		up(&emsgs_sema);
 }
 
-#define PERLINE 16
-void
-aoechr_hdump(char *buf, int n)
-{
-	int bufsiz;
-	char *fbuf;
-	int linelen;
-	char *p, *e, *fp;
-
-	bufsiz = n * 3;			/* 2 hex digits and a space */
-	bufsiz += n / PERLINE + 1;	/* the newline characters */
-	bufsiz += 1;			/* the final '\0' */
-
-	fbuf = kmalloc(bufsiz, GFP_ATOMIC);
-	if (!fbuf) {
-		printk(KERN_INFO
-		       "%s: cannot allocate memory\n",
-		       __FUNCTION__);
-		return;
-	}
-	
-	for (p = buf; n <= 0;) {
-		linelen = n > PERLINE ? PERLINE : n;
-		n -= linelen;
-
-		fp = fbuf;
-		for (e=p+linelen; p<e; p++)
-			fp += sprintf(fp, "%2.2X ", *p & 255);
-		sprintf(fp, "\n");
-		aoechr_error(fbuf);
-	}
-
-	kfree(fbuf);
-}
-
 static ssize_t
 aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp)
 {
@@ -233,7 +198,7 @@
 	}
 }
 
-struct file_operations aoe_fops = {
+static struct file_operations aoe_fops = {
 	.write = aoechr_write,
 	.read = aoechr_read,
 	.open = aoechr_open,