<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div><span>Can anyone please let me know where can I get the staging area drivers code and their test cases?</span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><br><span></span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><span>I understand that I need to download the 
staging area device drivers code. In the source code tree there would be
 a TODO file. Accordingly we have to fix and propagate it identifying 
the owner also.</span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><br><span></span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><span>But how are we suppose to test out the same - where are the test cases and process to execute them?</span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><br><span></span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><span>Regards,</span></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman, new york, times,
 serif;background-color:transparent;font-style:normal;"><span>Prakash</span></div><div><span><br></span></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: times new roman, new york, times, serif; font-size: 14pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Monday, 21 October 2013 7:12 AM, Dave Chinner <david@fromorbit.com> wrote:<br> </font> </div>  <div class="y_msg_container">On Sat, Oct 19, 2013 at 07:59:55PM +0900, Akira Hayakawa wrote:<br>> Dave,<br>> <br>> # -EIO retuned corrupts XFS<br>> I turned up<br>> lockdep, frame pointer, xfs debug<br>> and also changed to 3.12.0-rc5 from rc1.<br>> <br>> What's changed is that<br>> the problem we discussed in previous mails<br>> *never* reproduce.<br>> <br>> However, if I turn off the lockdep only<br>> it hangs up by setting blockup
 to 1 and then to 0 after that.<br><br>Which indicates that the corruption is likely to be caused by a race<br>condition, and that adding lockdep slows things down enough to<br>change the timing and hence not hit the race condition...<br><br>e.g. the use after free that causes the memory corruption now occurs<br>after the critical point where XFS can get stuck on it.<br><br>> The underlying device once became dead revives<br>> may confuse the filesystem but<br>> this looks not related to locking things.<br>> This problem may be producible using dm-flakey.<br><br>I use dm-flakey quite a bit, and I haven't seen this....<br><br>> This behavior is not reproducible with ext4.<br>> <br>> --------------------------------------------<br>> <a ymailto="mailto:root@Lyle" href="mailto:root@Lyle">root@Lyle</a>:/home/akira# virsh console Hercules<br>> Connected to domain Hercules<br>> Escape character is ^]<br>> [  143.042980]
 device-mapper: writeboost: <a ymailto="mailto:info@modulator_proc" href="mailto:info@modulator_proc">info@modulator_proc</a>() reactivated after blockup<br>> [  143.042999] device-mapper: writeboost: <a ymailto="mailto:info@dm_safe_io_internal" href="mailto:info@dm_safe_io_internal">info@dm_safe_io_internal</a>() reactivated after blockup<br>> [  143.043006] device-mapper: writeboost: <a ymailto="mailto:info@migrate_proc" href="mailto:info@migrate_proc">info@migrate_proc</a>() reactivated after blockup<br>> [  143.045328] XFS: metadata I/O error: block 0x300d0f ("xlog_iodone") error 5 numblks 64<br>> [  143.045333] XFS: xfs_do_force_shutdown(0x2) called from line 1161 of file fs/xfs/xfs_log.c.  Return address = 0xffffffffa0430f9c<br>> [  143.045335] XFS: Log I/O Error Detected.  Shutting down filesystem<br>> [  143.045335] XFS: Please umount the filesystem and rectify the problem(s)<br>>
 [  143.045338] XFS: Assertion failed: atomic_read(&iclog->ic_refcnt) == 0, file: fs/xfs/xfs_log.c, line: 2751<br>.....<br>> [  143.045465] Workqueue: xfslogd xfs_buf_iodone_work [xfs]<br>.....<br>> [  143.045558]  [<ffffffffa0430ed1>] xlog_state_done_syncing+0x6d/0xe4 [xfs]<br>> [  143.045590]  [<ffffffffa0431018>] xlog_iodone+0xd0/0xd9 [xfs]<br>> [  143.045609]  [<ffffffffa03d834f>] xfs_buf_iodone_work+0x57/0xa2 [xfs]<br>> [  143.045627]  [<ffffffff8104f21a>] process_one_work+0x18b/0x297<br>> [  143.045631]  [<ffffffff8104f6e6>] worker_thread+0x12e/0x1fb<br>> [  143.045634]  [<ffffffff8104f5b8>] ? rescuer_thread+0x268/0x268<br>> [  143.045638]  [<ffffffff81054507>] kthread+0x88/0x90<br>> [  143.045641]  [<ffffffff8105447f>] ? __kthread_parkme+0x60/0x60<br><br>So that has got through
 xlog_iodone() and has found that the<br>reference count of the iclog was not zero when it went to run the<br>log IO completion callbacks.<br><br>We asserted that the reference count was zero before issuing the IO,<br>and we only ever increment the reference count when the iclog is in<br>an active state. We cannot increment the reference count while the<br>log is under IO because the state of the iclog is "syncing", not<br>"active".<br><br>Once the log is shut down, the iclog state goes to<br>XLOG_STATE_IOERROR and never goes out of that state. The assert just<br>prior to the one that tripped above indicates that we are either in<br>an ACTIVE state or IOERROR:<br><br>        ASSERT(iclog->ic_state == XLOG_STATE_SYNCING ||<br>               iclog->ic_state == XLOG_STATE_IOERROR);<br>>>>>>>  ASSERT(atomic_read(&iclog->ic_refcnt) == 0);<br><br>It was the second assert
 that failed, and hence it's clear that<br>in either state the reference count cannot be incremented until the<br>IO is fully completed and it transitioned back the active state.<br><br>> [  143.045333] XFS: xfs_do_force_shutdown(0x2) called from line 1161 of file fs/xfs/xfs_log.c.  Return address = 0xffffffffa0430f9c<br><br>This indicates that the shutdown was called from xlog_iodone() as a<br>result of an IO error on the iclog buffer, and the call to<br>xlog_state_done_syncing() happens 5 lines of code later, which<br>immediately assert fails with a corrupt iclog state.<br><br>Because we shutdown with SHUTDOWN_LOG_IO_ERROR set, we call into<br>xfs_log_force_umount() with logerror = true. This first call ends up<br>setting the log flag XLOG_IO_ERROR, then calling<br>xlog_state_ioerror() which sets ic_state on all iclogs to<br>XLOG_STATE_IOERROR.<br><br>The shutdown then runs xlog_state_do_callback() which aborts the<br>completions on all
 the iclogs that have callbacks attached, and<br>wakes anyone waiting on log space or log forces so they can get<br>errors returned to them.<br><br>We now return to xlog_iodone() in a shutdown state, with all the<br>iclog buffers in with ic_state = XLOG_STATE_IOERROR. So, there is<br>absolutely no opportunity for anyone to take a new reference to the<br>iclog in the 10 *microseconds* between the IO error being detected,<br>the shutdown being processed and the call to<br>xlog_state_done_syncing() where the assert fails. At this point, I<br>cannot see how this can occur in the XFS code.<br><br>Indeed, I can trigger this error path easily under heavy load just<br>using the godown utility in xfstests:<br><br>[1044535.986040] XFS (vdc): Mounting Filesystem<br>[1044536.040630] XFS (vdc): Ending clean mount<br>[1044536.059299] XFS: Clearing xfsstats<br># src/xfstests-dev/src/godown -v /mnt/scratch<br>Opening "/mnt/scratch"<br>Calling
 XFS_IOC_GOINGDOWN<br>[1044553.342767] XFS (vdc): metadata I/O error: block 0x19000c2e98 ("xlog_iodone") error 5 numblks 512<br>[1044553.345993] XFS (vdc): xfs_do_force_shutdown(0x2) called from line 1171 of file fs/xfs/xfs_log.c.  Return address = 0xffffffff814e61ad<br>#[1044554.136965] XFS (vdc): xfs_log_force: error 5 returned.<br>[1044554.154892] XFS: Clearing xfsstats<br>[1044566.108484] XFS (vdc): xfs_log_force: error 5 returned.<br>[1044596.188515] XFS (vdc): xfs_log_force: error 5 returned.<br>[1044626.268166] XFS (vdc): xfs_log_force: error 5 returned.<br>[1044656.348146] XFS (vdc): xfs_log_force: error 5 returned.<br><br>IOWs, this looks like something is corrupting the state of the log<br>*before* the xlog_iodone() callback is being run. i.e. it is in a<br>valid state before IO dispatch and it's in a corrupt state on IO<br>completion despite XFS having *never touched that state* during the<br>IO.<br><br>Indeed, this is a different issue
 to the one you posted<br>earlier, which was the AIL lock (which is in a different XFS<br>structure) had not been released. Again, I couldn't see how that<br>could occur, and we're now seeing a pattern of random structures<br>being corrupted. Hmmm, looking at pahole:<br><br>atomic_t                   ic_refcnt;            /*   192     4 */<br><br>spinlock_t                 xa_lock;              /*    64     2 */<br><br>Both the items that were corrupted are on the first word of a<br>cacheline. That further points to memory corruption of some kind...<br><br>IOWs, the more I look, the more this looks like memory corruption is<br>the cause of the problems. The only unusual thing that is happening<br>is an error handling path in a brand new block device driver is<br>being run
 immediately before the memory corruption causes problems,<br>and that tends to indicate that this corruption is not caused by<br>XFS...<br><br>> My Idea:<br>> - If something problematic happens in underlying devices<br>>   writeboost device returns -EIO on any requests and<br>>   stop all the daemons<br>....<br>> - I will not remove `blockup`.<br>>   Yes. If the problem is in hardware it is very difficult<br>>   to recover.<br>>   However, leaving a chance for recovering the device is<br>>   at least better than just shutdown the device<br>>   if it doesn't pollute the code so much.<br>>   So, I will leave this option.<br><br>It doesn't matter whether the underlying hardware might be able to<br>recover - once you've send EIOs during IO completion that<br>data/metadata is considered *unrecoverable* and so the filesystem<br>will end up inconsistent or the *user will lose data* as a
 result.<br><br>IOWs, your idea is flawed, will not work and will result in<br>data/filesystem loss when used. You cannot call this a "recovery<br>mechanism" because it simply isn't.<br><br>> BTW, what do you mean by the word "fatal"?<br><br>"He suffered a fatal gunshot wound to the head."<br><br>i.e. the person is *dead* and life is *unrecoverable*.<br><br>That's what you are doing here - returning EIOs to IOs in progress<br>is effectively shooting the fileystem (and user data) in the<br>head.....<br><br>Cheers,<br><br>Dave.<br><br>-- <br>Dave Chinner<br><a ymailto="mailto:david@fromorbit.com" href="mailto:david@fromorbit.com">david@fromorbit.com</a><br>_______________________________________________<br>devel mailing list<br><a ymailto="mailto:devel@linuxdriverproject.org" href="mailto:devel@linuxdriverproject.org">devel@linuxdriverproject.org</a><br><a href="http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel"
 target="_blank">http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel</a><br><br><br></div>  </div> </div>  </div> </div></body></html>