--- /dev/null
+From b04da8bfdfbbd79544cab2fadfdc12e87eb01600 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Date: Tue, 26 Jan 2010 15:04:02 -0800
+Subject: fnctl: f_modown should call write_lock_irqsave/restore
+
+From: Greg Kroah-Hartman <gregkh@suse.de>
+
+commit b04da8bfdfbbd79544cab2fadfdc12e87eb01600 upstream.
+
+Commit 703625118069f9f8960d356676662d3db5a9d116 exposed that f_modown()
+should call write_lock_irqsave instead of just write_lock_irq so that
+because a caller could have a spinlock held and it would not be good to
+renable interrupts.
+
+Cc: Eric W. Biederman <ebiederm@xmission.com>
+Cc: Al Viro <viro@ZenIV.linux.org.uk>
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
+Cc: Tavis Ormandy <taviso@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+
+---
+ fs/fcntl.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/fs/fcntl.c
++++ b/fs/fcntl.c
+@@ -199,7 +199,9 @@ static int setfl(int fd, struct file * f
+ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
+ int force)
+ {
+- write_lock_irq(&filp->f_owner.lock);
++ unsigned long flags;
++
++ write_lock_irqsave(&filp->f_owner.lock, flags);
+ if (force || !filp->f_owner.pid) {
+ put_pid(filp->f_owner.pid);
+ filp->f_owner.pid = get_pid(pid);
+@@ -211,7 +213,7 @@ static void f_modown(struct file *filp,
+ filp->f_owner.euid = cred->euid;
+ }
+ }
+- write_unlock_irq(&filp->f_owner.lock);
++ write_unlock_irqrestore(&filp->f_owner.lock, flags);
+ }
+
+ int __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
--- /dev/null
+From 5543c72e2bbb30e5ba5938b18ec26617b8b3fb04 Mon Sep 17 00:00:00 2001
+From: Abhijeet Joglekar <abjoglek@cisco.com>
+Date: Thu, 10 Dec 2009 09:59:20 -0800
+Subject: [SCSI] libfc: remote port gets stuck in restart state without really restarting
+
+From: Abhijeet Joglekar <abjoglek@cisco.com>
+
+commit 5543c72e2bbb30e5ba5938b18ec26617b8b3fb04 upstream.
+
+We ran into a scenario where a remote port goes into RESTART state, but
+never gets added to scsi transport. The running vmcore showed the following:
+a) Port was in RESTART state
+b) rdata->event was STOP
+c) no work gets scheduled for the remote work to fc_rport_work
+
+After this point, shut/no-shut of the remote port did not cause the port
+to get re-discovered. The port would move betwen DELETE and RESTART states,
+but the event would always be STOP, no work would get scheduled to
+fc_rport_work and the port would not get added to scsi_transport.
+
+The problem is that rdata->event is not set to NONE after a port is
+restarted. After this point, no more work gets scheduled for the remote port
+since new work is scheduled only if rdata->event is non-NONE. So, the event
+and state keep changing, but fc_rport_work does not get scheduled to actually
+handle the event.
+
+Here's a transition of states that explains the above observation:
+
+) Port is first in READY State, event is NONE
+
+2) RSCN on shut, port goes to DELETED, event is stop
+
+3) Before fc_rport_work runs, RSCN on no-shut, port goes to RESTART, event is
+still STOP
+
+4) fc_rport_work gets scheduled, removes the port from transport, sees state
+as RESTART, begins the PLOGI state machine, event remains as STOP (event NOT
+changed to NONE, this is the bug)
+
+5) Plogi state machine completes, port state goes to READY, event goes to
+READY, but no work is scheduled since event was STOP (non-NONE) before.
+Fc_rport_work is not scheduled, port remains in READY state, but is not added
+to transport.
+
+Things are broken at this point. Libfc rport is ready, but no transport rport
+created.
+
+6) now a shut causes port state to change to DELETE, event to change to STOP,
+no work gets scheduled
+
+7) no-shut causes port state to change to RESTART, event remains at STOP,
+no work gets scheduled
+
+(6) and (7) now get repeated everytime we do shut/no-shut. No way to get out
+of this state. Fcc reset does not help too.
+
+Only way to get out is to load/unload module.
+
+Fix is to set rdata->event to NONE while processing the STOP/LOGO/FAILED
+events, inside the discovery and rport locks.
+
+Signed-off-by: Abhijeet Joglekar <abjoglek@cisco.com>
+Signed-off-by: Robert Love <robert.w.love@intel.com>
+Signed-off-by: James Bottomley <James.Bottomley@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/libfc/fc_rport.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/scsi/libfc/fc_rport.c
++++ b/drivers/scsi/libfc/fc_rport.c
+@@ -300,6 +300,7 @@ static void fc_rport_work(struct work_st
+ restart = 1;
+ else
+ list_del(&rdata->peers);
++ rdata->event = RPORT_EV_NONE;
+ mutex_unlock(&rdata->rp_mutex);
+ mutex_unlock(&lport->disc.disc_mutex);
+ }