If state is NON_BLOCKING and mutex_trylock is succeed,
the control flow goes to mutex_lock_interruptible() that is a deadlock.
[jejb: fixed coding style problems]
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: "Sreekanth Reddy" <sreekanth.reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
                return -EAGAIN;
 
        state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING;
-       if (state == NON_BLOCKING && !mutex_trylock(&ioc->ctl_cmds.mutex))
-               return -EAGAIN;
-       else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex))
+       if (state == NON_BLOCKING) {
+               if (!mutex_trylock(&ioc->ctl_cmds.mutex))
+                       return -EAGAIN;
+       } else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex)) {
                return -ERESTARTSYS;
+       }
 
        switch (cmd) {
        case MPT2IOCINFO: