@@ -56,7 +56,6 @@ int service_operation(struct orangefs_kernel_op_s *op,
5656 int flags )
5757{
5858 long timeout = MAX_SCHEDULE_TIMEOUT ;
59- /* flags to modify behavior */
6059 int ret = 0 ;
6160
6261 DEFINE_WAIT (wait_entry );
@@ -74,14 +73,20 @@ int service_operation(struct orangefs_kernel_op_s *op,
7473 current -> comm ,
7574 current -> pid );
7675
77- if (!(flags & ORANGEFS_OP_NO_SEMAPHORE )) {
76+ /*
77+ * If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
78+ * aquiring the request_mutex because we're servicing a
79+ * high priority remount operation and the request_mutex is
80+ * already taken.
81+ */
82+ if (!(flags & ORANGEFS_OP_NO_MUTEX )) {
7883 if (flags & ORANGEFS_OP_INTERRUPTIBLE )
7984 ret = mutex_lock_interruptible (& request_mutex );
8085 else
8186 ret = mutex_lock_killable (& request_mutex );
8287 /*
8388 * check to see if we were interrupted while waiting for
84- * semaphore
89+ * mutex
8590 */
8691 if (ret < 0 ) {
8792 op -> downcall .status = ret ;
@@ -95,6 +100,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
95100 spin_lock (& orangefs_request_list_lock );
96101 spin_lock (& op -> lock );
97102 set_op_state_waiting (op );
103+ /* add high priority remount op to the front of the line. */
98104 if (flags & ORANGEFS_OP_PRIORITY )
99105 list_add (& op -> list , & orangefs_request_list );
100106 else
@@ -109,7 +115,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
109115 }
110116 spin_unlock (& orangefs_request_list_lock );
111117
112- if (!(flags & ORANGEFS_OP_NO_SEMAPHORE ))
118+ if (!(flags & ORANGEFS_OP_NO_MUTEX ))
113119 mutex_unlock (& request_mutex );
114120
115121 ret = wait_for_matching_downcall (op , timeout ,
@@ -132,10 +138,17 @@ int service_operation(struct orangefs_kernel_op_s *op,
132138
133139 /* failed to get matching downcall */
134140 if (ret == - ETIMEDOUT ) {
135- gossip_err ("orangefs: %s -- wait timed out; aborting attempt.\n" ,
141+ gossip_err ("%s: %s -- wait timed out; aborting attempt.\n" ,
142+ __func__ ,
136143 op_name );
137144 }
145+
146+ /*
147+ * remove waiting ops from the request list or
148+ * remove in-progress ops from the in-progress list.
149+ */
138150 orangefs_clean_up_interrupted_operation (op );
151+
139152 op -> downcall .status = ret ;
140153 /* retry if operation has not been serviced and if requested */
141154 if (ret == - EAGAIN ) {
@@ -148,11 +161,12 @@ int service_operation(struct orangefs_kernel_op_s *op,
148161 op_name ,
149162 op -> attempts );
150163
164+ /*
165+ * io ops (ops that use the shared memory buffer) have
166+ * to be returned to their caller for a retry. Other ops
167+ * can just be recycled here.
168+ */
151169 if (!op -> uses_shared_memory )
152- /*
153- * this operation doesn't use the shared memory
154- * system
155- */
156170 goto retry_servicing ;
157171 }
158172
@@ -268,7 +282,8 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
268282 long n ;
269283
270284 if (interruptible )
271- n = wait_for_completion_interruptible_timeout (& op -> waitq , timeout );
285+ n = wait_for_completion_interruptible_timeout (& op -> waitq ,
286+ timeout );
272287 else
273288 n = wait_for_completion_killable_timeout (& op -> waitq , timeout );
274289
0 commit comments