@@ -376,79 +376,77 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
376376 }
377377 spin_unlock (& op -> lock );
378378
379- if (!signal_pending (current )) {
380- /*
381- * if this was our first attempt and client-core
382- * has not purged our operation, we are happy to
383- * simply wait
384- */
385- spin_lock (& op -> lock );
386- if (op -> attempts == 0 && !op_state_purged (op )) {
387- spin_unlock (& op -> lock );
388- schedule ();
389- } else {
390- spin_unlock (& op -> lock );
391- /*
392- * subsequent attempts, we retry exactly once
393- * with timeouts
394- */
395- if (!schedule_timeout (MSECS_TO_JIFFIES
396- (1000 * op_timeout_secs ))) {
397- gossip_debug (GOSSIP_WAIT_DEBUG ,
398- "*** %s:"
399- " operation timed out (tag"
400- " %llu, %p, att %d)\n" ,
401- __func__ ,
402- llu (op -> tag ),
403- op ,
404- op -> attempts );
405- ret = - ETIMEDOUT ;
406- orangefs_clean_up_interrupted_operation
407- (op );
408- break ;
409- }
410- }
411- spin_lock (& op -> lock );
412- op -> attempts ++ ;
379+ if (unlikely (signal_pending (current ))) {
380+ gossip_debug (GOSSIP_WAIT_DEBUG ,
381+ "*** %s:"
382+ " operation interrupted by a signal (tag "
383+ "%llu, op %p)\n" ,
384+ __func__ ,
385+ llu (op -> tag ),
386+ op );
387+ orangefs_clean_up_interrupted_operation (op );
388+ ret = - EINTR ;
389+ break ;
390+ }
391+
392+ /*
393+ * if this was our first attempt and client-core
394+ * has not purged our operation, we are happy to
395+ * simply wait
396+ */
397+ spin_lock (& op -> lock );
398+ if (op -> attempts == 0 && !op_state_purged (op )) {
399+ spin_unlock (& op -> lock );
400+ schedule ();
401+ } else {
402+ spin_unlock (& op -> lock );
413403 /*
414- * if the operation was purged in the meantime, it
415- * is better to requeue it afresh but ensure that
416- * we have not been purged repeatedly. This could
417- * happen if client-core crashes when an op
418- * is being serviced, so we requeue the op, client
419- * core crashes again so we requeue the op, client
420- * core starts, and so on...
404+ * subsequent attempts, we retry exactly once
405+ * with timeouts
421406 */
422- if (op_state_purged (op )) {
423- ret = (op -> attempts < ORANGEFS_PURGE_RETRY_COUNT ) ?
424- - EAGAIN :
425- - EIO ;
426- spin_unlock (& op -> lock );
407+ if (!schedule_timeout (MSECS_TO_JIFFIES
408+ (1000 * op_timeout_secs ))) {
427409 gossip_debug (GOSSIP_WAIT_DEBUG ,
428410 "*** %s:"
429- " operation purged (tag "
430- "%llu, %p, att %d)\n" ,
411+ " operation timed out (tag"
412+ " %llu, %p, att %d)\n" ,
431413 __func__ ,
432414 llu (op -> tag ),
433415 op ,
434416 op -> attempts );
417+ ret = - ETIMEDOUT ;
435418 orangefs_clean_up_interrupted_operation (op );
436419 break ;
437420 }
421+ }
422+ spin_lock (& op -> lock );
423+ op -> attempts ++ ;
424+ /*
425+ * if the operation was purged in the meantime, it
426+ * is better to requeue it afresh but ensure that
427+ * we have not been purged repeatedly. This could
428+ * happen if client-core crashes when an op
429+ * is being serviced, so we requeue the op, client
430+ * core crashes again so we requeue the op, client
431+ * core starts, and so on...
432+ */
433+ if (op_state_purged (op )) {
434+ ret = (op -> attempts < ORANGEFS_PURGE_RETRY_COUNT ) ?
435+ - EAGAIN :
436+ - EIO ;
438437 spin_unlock (& op -> lock );
439- continue ;
438+ gossip_debug (GOSSIP_WAIT_DEBUG ,
439+ "*** %s:"
440+ " operation purged (tag "
441+ "%llu, %p, att %d)\n" ,
442+ __func__ ,
443+ llu (op -> tag ),
444+ op ,
445+ op -> attempts );
446+ orangefs_clean_up_interrupted_operation (op );
447+ break ;
440448 }
441-
442- gossip_debug (GOSSIP_WAIT_DEBUG ,
443- "*** %s:"
444- " operation interrupted by a signal (tag "
445- "%llu, op %p)\n" ,
446- __func__ ,
447- llu (op -> tag ),
448- op );
449- orangefs_clean_up_interrupted_operation (op );
450- ret = - EINTR ;
451- break ;
449+ spin_unlock (& op -> lock );
452450 }
453451
454452 spin_lock (& op -> lock );
0 commit comments