Patch from Robert Love <rml@tech9.net>

This patch is by Inaky Perez-Gonzalez.

There are a couple uses of 'p->state=foo' in fs/ which are open coded. 
This patch converts them to the proper [__]set_current_state() function.

At least one of them (the one fs/locks.c usage) is probably unsafe on
out-of-order store processors.  This patch fixes it up.




 fs/exec.c   |    2 +-
 fs/inode.c  |    2 +-
 fs/locks.c  |    4 ++--
 fs/select.c |    4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff -puN fs/exec.c~set_current_state-fs fs/exec.c
--- 25/fs/exec.c~set_current_state-fs	2003-03-17 21:32:01.000000000 -0800
+++ 25-akpm/fs/exec.c	2003-03-17 21:32:01.000000000 -0800
@@ -633,7 +633,7 @@ static inline int de_thread(struct task_
 		count = 1;
 	while (atomic_read(&oldsig->count) > count) {
 		oldsig->group_exit_task = current;
-		current->state = TASK_UNINTERRUPTIBLE;
+		__set_current_state(TASK_UNINTERRUPTIBLE);
 		spin_unlock_irq(lock);
 		schedule();
 		spin_lock_irq(lock);
diff -puN fs/inode.c~set_current_state-fs fs/inode.c
--- 25/fs/inode.c~set_current_state-fs	2003-03-17 21:32:01.000000000 -0800
+++ 25-akpm/fs/inode.c	2003-03-17 21:32:01.000000000 -0800
@@ -1214,7 +1214,7 @@ repeat:
 		goto repeat;
 	}
 	remove_wait_queue(wq, &wait);
-	current->state = TASK_RUNNING;
+	__set_current_state(TASK_RUNNING);
 }
 
 void wake_up_inode(struct inode *inode)
diff -puN fs/locks.c~set_current_state-fs fs/locks.c
--- 25/fs/locks.c~set_current_state-fs	2003-03-17 21:32:01.000000000 -0800
+++ 25-akpm/fs/locks.c	2003-03-17 21:32:01.000000000 -0800
@@ -565,7 +565,7 @@ static int interruptible_sleep_on_locked
 	int result = 0;
 	DECLARE_WAITQUEUE(wait, current);
 
-	current->state = TASK_INTERRUPTIBLE;
+	__set_current_state(TASK_INTERRUPTIBLE);
 	add_wait_queue(fl_wait, &wait);
 	if (timeout == 0)
 		schedule();
@@ -574,7 +574,7 @@ static int interruptible_sleep_on_locked
 	if (signal_pending(current))
 		result = -ERESTARTSYS;
 	remove_wait_queue(fl_wait, &wait);
-	current->state = TASK_RUNNING;
+	__set_current_state(TASK_RUNNING);
 	return result;
 }
 
diff -puN fs/select.c~set_current_state-fs fs/select.c
--- 25/fs/select.c~set_current_state-fs	2003-03-17 21:32:01.000000000 -0800
+++ 25-akpm/fs/select.c	2003-03-17 21:32:01.000000000 -0800
@@ -235,7 +235,7 @@ int do_select(int n, fd_set_bits *fds, l
 		}
 		__timeout = schedule_timeout(__timeout);
 	}
-	current->state = TASK_RUNNING;
+	__set_current_state(TASK_RUNNING);
 
 	poll_freewait(&table);
 
@@ -425,7 +425,7 @@ static int do_poll(unsigned int nfds,  s
 			break;
 		timeout = schedule_timeout(timeout);
 	}
-	current->state = TASK_RUNNING;
+	__set_current_state(TASK_RUNNING);
 	return count;
 }
 

_