# FreeBSD 8.1: fsck_ufs runs in wdrain then reboots.



## ghostcorps (Sep 6, 2011)

Hi Guys,


 My server (FreeBSD 8.1 amd64) has been running smoothly for months, I have not made any changes recently. But today I came home to find it had rebooted. After rebooting I found that everything was running very slowly. top showed me that fsck_ufs is running in wdrain mode, that looked suspicious so I googled it and came up with the article below, am I on the right track?

http://www.freebsd.org/cgi/query-pr.cgi?pr=154228


This is a test to show how slowly it is writing:


```
$ dd if=/dev/zero of=/usr/test bs=1048576 count=100 
100+0 records in 
100+0 records out 
104857600 bytes transferred in 18.672175 secs (6578245 bytes/sec)
```


----------



## SirDice (Sep 6, 2011)

It's possible you're hitting the same bug. Looking at the date of the fix it doesn't look like it made it into 8.2-RELEASE so you would have to update to 8-STABLE or wait until 8.3 is released.

Or you could try the patch on your 8.1-RELEASE.


----------



## ghostcorps (Sep 6, 2011)

Thanks for the quick help 

 I've never patched before, but I'll give it a go, do you have any good links for a how to?

 If that doesn't work I'll update to 8-STABLE  

Thanks again


----------



## SirDice (Sep 6, 2011)

You can do this by hand, it's only one line :e

Keep in mind that the patch in the PR is for HEAD, the first bit of the path is a little different but the rest should be in the same place.


----------



## ghostcorps (Sep 6, 2011)

Oh wow.. ok it is that easy ?  

*fingers crossed*  I'll give it a go once I get to work.

Thanks again


----------



## ghostcorps (Sep 7, 2011)

Just to confirm, If I may

In /usr/src/sys/geom/journal/g_journal.c

I simply change this:


```
mp = arg;
        for (;;) {
                g_journal_switcher_wokenup = 0;
                error = tsleep(&g_journal_switcher_state, PRIBIO, "jsw:wait",
```

To this:


```
mp = arg;
                [b]curthread->td_pflags |= TDP_NORUNNINGBUF;[/b]
        for (;;) {
                g_journal_switcher_wokenup = 0;
                error = tsleep(&g_journal_switcher_state, PRIBIO, "jsw:wait",
```


----------



## ghostcorps (Sep 7, 2011)

My /usr/src is empty. If I try to install the tree through sysinstall the OS crashes before it can finish.

I am going to try copying /usr/src/ from another 8.1 installation, are there any tricks I should know about?


----------



## SirDice (Sep 7, 2011)

You can get the source with csup(1) too.

Just copy /usr/share/examples/cvsup/standard-supfile. Change the host and set the tag to *RELENG_8_1* to get the source for 8.1-RELEASE.

`# csup standard-supfile` will then get the sources.


----------



## ghostcorps (Sep 7, 2011)

I have copied the /usr/src from another installation and applied the patch but it doesn;t seem to have fixed it 

top shows fsck_ufs starts off switching between nanslp biord snaprd and drainv before settling on wdrain. Then it shuts down. 

I'll try csup now.

I'm trying to avoid updating if I can  lol


What would be the best log to look at?


----------



## SirDice (Sep 7, 2011)

ghostcorps said:
			
		

> I'll try csup now.


If you already have the source, there's no need for csup(1).



> What would be the best log to look at?


Tricky, as this stuff generally isn't logged.


----------



## ghostcorps (Sep 7, 2011)

SirDice said:
			
		

> If you already have the source, there's no need for csup(1).



... damm

Ok.

Thanks for your help.  


It looks like I have no choice but to update   It's very bad practice of me to be so behind I guess, but there are a few programs that I am loath to touch again lol


----------

