All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath-tools/path_priority/pp_alua rtpg.c
@ 2009-04-08 21:38 bmarzins
  2009-04-08 22:08 ` Konrad Rzeszutek
  0 siblings, 1 reply; 4+ messages in thread
From: bmarzins @ 2009-04-08 21:38 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2009-04-08 21:38:45

Modified files:
	path_priority/pp_alua: rtpg.c 

Log message:
	Fix for bz #490633. Adjust SCSI RTPG request buffer size in ALUA prioritizer.
	Already upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/rtpg.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3&r2=1.3.2.1

--- multipath-tools/path_priority/pp_alua/rtpg.c	2006/07/13 19:49:23	1.3
+++ multipath-tools/path_priority/pp_alua/rtpg.c	2009/04/08 21:38:44	1.3.2.1
@@ -21,6 +21,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #define __user
 #include <scsi/sg.h>
@@ -251,14 +252,38 @@
 int
 get_asymmetric_access_state(int fd, unsigned int tpg)
 {
-	unsigned char		buf[128];
+	unsigned char		*buf;
 	struct rtpg_data *	tpgd;
 	struct rtpg_tpg_dscr *	dscr;
 	int			rc;
+	int			buflen;
+	uint32_t		scsi_buflen;
 
-	rc = do_rtpg(fd, buf, sizeof(buf));
+	buflen = 128; /* Initial value from old code */
+	buf = (unsigned char *)malloc(buflen);
+	if (!buf) {
+		PRINT_DEBUG ("malloc failed: could not allocate"
+			"%u bytes\n", buflen);
+		return -RTPG_RTPG_FAILED;
+	}
+	rc = do_rtpg(fd, buf, buflen);
 	if (rc < 0)
 		return rc;
+	scsi_buflen = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
+	if (buflen < (scsi_buflen + 4)) {
+		free(buf);
+		buf = (unsigned char *)malloc(scsi_buflen);
+		if (!buf) {
+			PRINT_DEBUG ("malloc failed: could not allocate"
+				"%u bytes\n", scsi_buflen);
+			return -RTPG_RTPG_FAILED;
+		}
+		buflen = scsi_buflen;
+		rc = do_rtpg(fd, buf, buflen);
+		if (rc < 0)
+			goto out;
+	}
+
 
 	tpgd = (struct rtpg_data *) buf;
 	rc   = -RTPG_TPG_NOT_FOUND;
@@ -274,7 +299,8 @@
 			}
 		}
 	}
-
+out:
+	free(buf);
 	return rc;
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread
* multipath-tools/path_priority/pp_alua rtpg.c
@ 2009-07-07 18:44 bmarzins
  0 siblings, 0 replies; 4+ messages in thread
From: bmarzins @ 2009-07-07 18:44 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2009-07-07 18:44:12

Modified files:
	path_priority/pp_alua: rtpg.c 

Log message:
	Multipath needs to actually allocate the correct size buffer when it realizes
	that the existing rtpg buffer is too small.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/rtpg.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3.2.3&r2=1.3.2.4

--- multipath-tools/path_priority/pp_alua/rtpg.c	2009/05/06 22:57:58	1.3.2.3
+++ multipath-tools/path_priority/pp_alua/rtpg.c	2009/07/07 18:44:11	1.3.2.4
@@ -269,8 +269,8 @@
 	rc = do_rtpg(fd, buf, buflen);
 	if (rc < 0)
 		goto out;
-	scsi_buflen = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
-	if (buflen < (scsi_buflen + 4)) {
+	scsi_buflen = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] + 4;
+	if (buflen < scsi_buflen) {
 		free(buf);
 		buf = (unsigned char *)malloc(scsi_buflen);
 		if (!buf) {

^ permalink raw reply	[flat|nested] 4+ messages in thread
* multipath-tools/path_priority/pp_alua rtpg.c
@ 2011-10-26  4:53 bmarzins
  0 siblings, 0 replies; 4+ messages in thread
From: bmarzins @ 2011-10-26  4:53 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2011-10-26 04:53:44

Modified files:
	path_priority/pp_alua: rtpg.c 

Log message:
	Fix for bz #740512.  zero out buffers for do_inquiry and do_rtpg.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/rtpg.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3.2.6&r2=1.3.2.7

--- multipath-tools/path_priority/pp_alua/rtpg.c	2011/10/24 13:41:32	1.3.2.6
+++ multipath-tools/path_priority/pp_alua/rtpg.c	2011/10/26 04:53:44	1.3.2.7
@@ -165,6 +165,7 @@
 	struct inquiry_data	inq;
 	int			rc;
 
+	memset((unsigned char *)&inq, 0, sizeof(inq));
 	rc = do_inquiry(fd, 0, 0x00, &inq, sizeof(inq));
 	if (!rc) {
 		rc = inquiry_data_get_tpgs(&inq);
@@ -181,6 +182,7 @@
 	struct vpd83_dscr *	dscr;
 	int			rc;
 
+	memset(buf, 0, sizeof(buf));
 	rc = do_inquiry(fd, 1, 0x83, buf, sizeof(buf));
 	if (!rc) {
 		vpd83 = (struct vpd83_data *) buf;
@@ -266,6 +268,7 @@
 			"%u bytes\n", buflen);
 		return -RTPG_RTPG_FAILED;
 	}
+	memset(buf, 0, buflen);
 	rc = do_rtpg(fd, buf, buflen);
 	if (rc < 0)
 		goto out;
@@ -279,6 +282,7 @@
 			return -RTPG_RTPG_FAILED;
 		}
 		buflen = scsi_buflen;
+		memset(buf, 0, buflen);
 		rc = do_rtpg(fd, buf, buflen);
 		if (rc < 0)
 			goto out;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-26  4:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 21:38 multipath-tools/path_priority/pp_alua rtpg.c bmarzins
2009-04-08 22:08 ` Konrad Rzeszutek
  -- strict thread matches above, loose matches on Subject: below --
2009-07-07 18:44 bmarzins
2011-10-26  4:53 bmarzins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.