hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/fs/orangefs/waitqueue.c
....@@ -19,7 +19,7 @@
1919
2020 static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
2121 long timeout,
22
- bool interruptible)
22
+ int flags)
2323 __acquires(op->lock);
2424 static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
2525 __releases(op->lock);
....@@ -143,9 +143,7 @@
143143 if (!(flags & ORANGEFS_OP_NO_MUTEX))
144144 mutex_unlock(&orangefs_request_mutex);
145145
146
- ret = wait_for_matching_downcall(op, timeout,
147
- flags & ORANGEFS_OP_INTERRUPTIBLE);
148
-
146
+ ret = wait_for_matching_downcall(op, timeout, flags);
149147 gossip_debug(GOSSIP_WAIT_DEBUG,
150148 "%s: wait_for_matching_downcall returned %d for %p\n",
151149 __func__,
....@@ -319,10 +317,12 @@
319317 */
320318 static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
321319 long timeout,
322
- bool interruptible)
320
+ int flags)
323321 __acquires(op->lock)
324322 {
325323 long n;
324
+ int writeback = flags & ORANGEFS_OP_WRITEBACK,
325
+ interruptible = flags & ORANGEFS_OP_INTERRUPTIBLE;
326326
327327 /*
328328 * There's a "schedule_timeout" inside of these wait
....@@ -330,10 +330,12 @@
330330 * user process that needs something done and is being
331331 * manipulated by the client-core process.
332332 */
333
- if (interruptible)
333
+ if (writeback)
334
+ n = wait_for_completion_io_timeout(&op->waitq, timeout);
335
+ else if (!writeback && interruptible)
334336 n = wait_for_completion_interruptible_timeout(&op->waitq,
335
- timeout);
336
- else
337
+ timeout);
338
+ else /* !writeback && !interruptible but compiler complains */
337339 n = wait_for_completion_killable_timeout(&op->waitq, timeout);
338340
339341 spin_lock(&op->lock);