<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Enabling/disabling BIO_RW_FAILFAST at load time</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1593" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=011353003-26092007>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=011353003-26092007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=011353003-26092007>One Typo below . Its as  </SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2> Flag can be set On/Off as 
follows</FONT> 
<P>        <FONT face="Courier New" 
size=2>modprobe dm-multipath fastfailbit=0     
        //seting it off</FONT> 
<BR>        <FONT face="Courier New" 
size=2>modprobe dm-multipath fastfailbit=<SPAN 
class=011353003-26092007>1</SPAN>             
//seting it on</FONT> </P></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><FONT 
face="Courier New">Thanks,</FONT><FONT face="Times New Roman" color=#000000 
size=3> </FONT>
<P><FONT face="Courier New" color=#0000ff size=2>Vijay Kumar</FONT> </P>
<P><FONT face="Courier New" color=#0000ff size=2>[Kumar, Vijay (STSD)]</FONT> 
<BR><FONT face="Courier New" color=#0000ff size=2>mailto: 
vijay.kumar7@hp.com</FONT> </P></FONT></DIV><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> dm-devel-bounces@redhat.com 
  [mailto:dm-devel-bounces@redhat.com] <B>On Behalf Of </B>Kumar, Vijay 
  (STSD)<BR><B>Sent:</B> Wednesday, September 26, 2007 12:18 AM<BR><B>To:</B> 
  device-mapper development; christophe.varoqui@free.fr<BR><B>Subject:</B> 
  [dm-devel] Enabling/disabling BIO_RW_FAILFAST at load 
time<BR></FONT><BR></DIV>
  <DIV></DIV><!-- Converted from text/rtf format -->
  <P><FONT face="Courier New" size=2>Hi Christophe and All, </FONT><BR><FONT 
  face="Courier New" size=2>During I/O on a path, the paths are marked as failed 
  at DM Multipath, when the I/O returns with Error status as 0x20000 (host code 
  0x2 denotes DID_BUS_BUSY). What we understand here is, since I/O on multipath 
  devices have BIO_RW_FAILFAST set(hence REQ_FASTFAIL ), retries are not allowed 
  at SCSI mid layer for errors such as QUEUEFULL, UNDERRUN....(as captured in 
  the below syslog snippet)</FONT></P>
  <P><FONT face="Courier New" color=#0000ff size=2>syslog snippet</FONT> 
  <BR><FONT face="Courier New" color=#0000ff size=2>*******************</FONT> 
  <BR><FONT face="Courier New" color=#0000ff size=2>May 23 16:51:49 lnx kernel: 
  sd 2:0:3:8: SCSI error: return code = 0x20000<BR>May 23 16:51:49 lnx kernel: 
  end_request: I/O error, dev sdfg, sector 4188002<BR>May 23 16:51:49 lnx 
  kernel: end_request: I/O error, dev sdfg, sector 4188008<BR>May 23 16:51:49 
  lnx kernel: device-mapper: dm-multipath: Failing path 130:32.<BR>May 23 
  16:51:49 lnx kernel: sd 2:0:3:8: SCSI error: return code = 0x20000<BR>May 23 
  16:51:49 lnx kernel: end_request: I/O error, dev sdfg, sector 4188302<BR>May 
  23 16:51:49 lnx kernel: end_request: I/O error, dev sdfg, sector 
  4188303<BR>May 23 16:52:00 lnx kernel: sd 1:0:2:12: SCSI error: return code = 
  0x20000</FONT> </P>
  <P><FONT face="Courier New" size=2>As an option we can have user configurable 
  BIO_RW_FAILFAST for enabling and disabling which allows scsi mid layer to 
  retry for I/0 .  Below is the patch for passing parameter at load time 
  with DM multipath module for enabling/disabling BIO_RW_FAILFAST flag. 
  </FONT></P>
  <P><FONT face="Courier New" size=2>* Flag can be set On/Off as follows</FONT> 
  </P>
  <P>        <FONT face="Courier New" 
  size=2>modprobe dm-multipath fastfailbit=0     
          //seting it off</FONT> 
  <BR>        <FONT face="Courier New" 
  size=2>modprobe dm-multipath fastfailbit=0     
          //seting it on</FONT> </P>
  <P><FONT face="Courier New" size=2>* By default the flag is kept on.</FONT> 
  </P>
  <P><FONT face="Courier New" size=2>It can also be set from modprobe.conf as 
  :</FONT> </P>
  <P>        <FONT face="Courier New" 
  size=2>options dm_multipath fastfailbit=0</FONT> </P><BR>
  <P><FONT face="Courier New" size=2>Please comment !!</FONT> </P>
  <P><FONT face="Courier New" 
  size=2>***************************************</FONT> <BR><FONT 
  face="Courier New" size=2>diff -Naur 
  linux-2.6.18.x86_64-orig/drivers/md/dm-mpath.c linux-</FONT> <BR><FONT 
  face="Courier New" size=2>2.6.18.x86_64/drivers/md/dm-mpath.c</FONT> <BR><FONT 
  face="Courier New" size=2>--- 
  linux-2.6.18.x86_64-orig/drivers/md/dm-mpath.c      
  2007-08-27 </FONT><BR><FONT face="Courier New" size=2>02:18:51.000000000 
  +0530</FONT> <BR><FONT face="Courier New" size=2>+++ 
  linux-2.6.18.x86_64/drivers/md/dm-mpath.c   2007-09-12 
  16:02:29.000000000 </FONT><BR><FONT face="Courier New" size=2>+0530</FONT> 
  <BR><FONT face="Courier New" size=2>@@ -19,6 +19,7 @@</FONT> <BR><FONT 
  face="Courier New" size=2> #include <linux/slab.h></FONT> <BR><FONT 
  face="Courier New" size=2> #include <linux/time.h></FONT> <BR><FONT 
  face="Courier New" size=2> #include <linux/workqueue.h></FONT> 
  <BR><FONT face="Courier New" size=2>+#include 
  <linux/moduleparam.h></FONT> <BR><FONT face="Courier New" 
  size=2> #include <asm/atomic.h></FONT> </P>
  <P><FONT face="Courier New" size=2> #define DM_MSG_PREFIX 
  "multipath"</FONT> <BR><FONT face="Courier New" size=2>@@ -107,6 +108,7 
  @@</FONT> <BR><FONT face="Courier New" size=2> static void 
  process_queued_ios(void *data);</FONT> <BR><FONT face="Courier New" 
  size=2> static void trigger_event(void *data);</FONT> </P>
  <P><FONT face="Courier New" size=2>+static int fastfailbit = 1;   
  /*fastfail bit set on by default*/</FONT> </P>
  <P><FONT face="Courier New" 
  size=2> /*-----------------------------------------------</FONT> 
  <BR><FONT face="Courier New" size=2>  * Allocation routines</FONT> 
  <BR><FONT face="Courier New" size=2>@@ -800,7 +802,7 @@</FONT> <BR><FONT 
  face="Courier New" size=2>        
  dm_bio_record(&mpio->details, bio);</FONT> </P>
  <P><FONT face="Courier New" size=2>        
  map_context->ptr = mpio;</FONT> <BR><FONT face="Courier New" 
  size=2>-       bio->bi_rw |= (1 << 
  BIO_RW_FAILFAST);</FONT> <BR><FONT face="Courier New" 
  size=2>+       bio->bi_rw |= (fastfailbit 
  << BIO_RW_FAILFAST);</FONT> <BR><FONT face="Courier New" 
  size=2>        r = map_io(m, bio, mpio, 
  0);</FONT> <BR><FONT face="Courier New" 
  size=2>        if (r < 0 || r == 
  DM_MAPIO_REQUEUE)</FONT> <BR><FONT face="Courier New" 
  size=2>                
  mempool_free(mpio, m->mpio_pool);</FONT> <BR><FONT face="Courier New" 
  size=2>@@ -1340,6 +1342,10 @@</FONT> <BR><FONT face="Courier New" 
  size=2> {</FONT> <BR><FONT face="Courier New" 
  size=2>        int r;</FONT> </P>
  <P><FONT face="Courier New" size=2>+       /* 
  validating fastfailbit */</FONT> <BR><FONT face="Courier New" 
  size=2>+        if(fastfailbit)</FONT> 
  <BR><FONT face="Courier New" 
  size=2>+                
  fastfailbit=1;</FONT> <BR><FONT face="Courier New" size=2>+</FONT> <BR><FONT 
  face="Courier New" size=2>        /* 
  allocate a slab for the dm_ios */</FONT> <BR><FONT face="Courier New" 
  size=2>        _mpio_cache = 
  kmem_cache_create("dm_mpath", sizeof(struct mpath_io),</FONT> <BR><FONT 
  face="Courier New" 
  size=2>                                        
  0, 0, NULL, NULL);</FONT> <BR><FONT face="Courier New" size=2>@@ -1387,6 
  +1393,8 @@</FONT> <BR><FONT face="Courier New" 
  size=2> module_init(dm_multipath_init);</FONT> <BR><FONT 
  face="Courier New" size=2> module_exit(dm_multipath_exit);</FONT> </P>
  <P><FONT face="Courier New" size=2>+module_param(fastfailbit, int, 0);</FONT> 
  <BR><FONT face="Courier New" size=2>+MODULE_PARM_DESC(fastfailbit, "FASTFAIL 
  bit flag ");</FONT> <BR><FONT face="Courier New" 
  size=2> MODULE_DESCRIPTION(DM_NAME " multipath target");</FONT> <BR><FONT 
  face="Courier New" size=2> MODULE_AUTHOR("Sistina Software <</FONT><A 
  href="mailto:dm-devel@redhat.com"><U><FONT face="Courier New" color=#0000ff 
  size=2>dm-devel@redhat.com</FONT></U></A><FONT face="Courier New" 
  size=2>>");</FONT> <BR><FONT face="Courier New" 
  size=2> MODULE_LICENSE("GPL");</FONT> </P>
  <P><FONT face="Courier New" size=2>******************************</FONT> 
  <BR><FONT face="Times New Roman"></FONT>  <BR><FONT face="Courier New" 
  color=#0000ff size=2>Thanks,</FONT> </P>
  <P><FONT face="Courier New" color=#0000ff size=2>Vijay Kumar</FONT> </P>
  <P><FONT face="Courier New" color=#0000ff size=2>[Kumar, Vijay (STSD)]</FONT> 
  <BR><FONT face="Courier New" color=#0000ff size=2>mailto: 
  vijay.kumar7@hp.com</FONT> </P></BLOCKQUOTE></BODY></HTML>