[stgt] [PATCH] tgt-admin: Fix race where large updates may fail

Andy Grover agrover at redhat.com
Thu Oct 6 23:19:43 CEST 2011


https://bugzilla.redhat.com/show_bug.cgi?id=736740

Sometimes tgt-admin will try to use a tid twice, causing an error and the
update to fail. This patch updates tgtadm_output_tid hash with $next_tid
directly, instead of re-querying tgtd to find max tid.

Signed-off-by: Andy Grover <agrover at redhat.com>
---
 scripts/tgt-admin |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index aa16b79..870f3bd 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -315,6 +315,7 @@ sub add_targets {
 						execute("# Target $target already exists!");
 					}
 				}
+				$tgtadm_output_tid{$target} = $next_tid;
 			}
 			if (length $single_target && $in_configfile == 0 && $configured == 0) {
 				print "Target $single_target is currently not configured\n";
@@ -1144,7 +1145,6 @@ EOF
 
 # Find the biggest tid
 sub find_max_tid {
-	process_targets;
 	my @all_targets = keys %tgtadm_output_tid;
 	my $maxtid = 0;
 	foreach my $var (@all_targets) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list