Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Orangefs: code sanitation

Signed-off-by: Mike Marshall <hubcap@omnibond.com>

+29 -14
+1 -1
fs/orangefs/devorangefs-req.c
··· 590 590 * remount all mounted orangefs volumes to regain the lost 591 591 * dynamic mount tables (if any) -- NOTE: this is done 592 592 * without keeping the superblock list locked due to the 593 - * upcall/downcall waiting. also, the request semaphore is 593 + * upcall/downcall waiting. also, the request mutex is 594 594 * used to ensure that no operations will be serviced until 595 595 * all of the remounts are serviced (to avoid ops between 596 596 * mounts to fail)
+1 -1
fs/orangefs/orangefs-kernel.h
··· 603 603 #define ORANGEFS_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */ 604 604 #define ORANGEFS_OP_PRIORITY 2 /* service_operation() is high priority */ 605 605 #define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */ 606 - #define ORANGEFS_OP_NO_SEMAPHORE 8 /* don't acquire semaphore */ 606 + #define ORANGEFS_OP_NO_MUTEX 8 /* don't acquire request_mutex */ 607 607 #define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */ 608 608 609 609 int service_operation(struct orangefs_kernel_op_s *op,
+2 -2
fs/orangefs/super.c
··· 229 229 new_op->upcall.req.fs_mount.orangefs_config_server); 230 230 231 231 /* 232 - * we assume that the calling function has already acquire the 232 + * we assume that the calling function has already acquired the 233 233 * request_mutex to prevent other operations from bypassing 234 234 * this one 235 235 */ 236 236 ret = service_operation(new_op, "orangefs_remount", 237 - ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_SEMAPHORE); 237 + ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX); 238 238 gossip_debug(GOSSIP_SUPER_DEBUG, 239 239 "orangefs_remount: mount got return value of %d\n", 240 240 ret);
+25 -10
fs/orangefs/waitqueue.c
··· 56 56 int flags) 57 57 { 58 58 long timeout = MAX_SCHEDULE_TIMEOUT; 59 - /* flags to modify behavior */ 60 59 int ret = 0; 61 60 62 61 DEFINE_WAIT(wait_entry); ··· 73 74 current->comm, 74 75 current->pid); 75 76 76 - if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) { 77 + /* 78 + * If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid 79 + * aquiring the request_mutex because we're servicing a 80 + * high priority remount operation and the request_mutex is 81 + * already taken. 82 + */ 83 + if (!(flags & ORANGEFS_OP_NO_MUTEX)) { 77 84 if (flags & ORANGEFS_OP_INTERRUPTIBLE) 78 85 ret = mutex_lock_interruptible(&request_mutex); 79 86 else 80 87 ret = mutex_lock_killable(&request_mutex); 81 88 /* 82 89 * check to see if we were interrupted while waiting for 83 - * semaphore 90 + * mutex 84 91 */ 85 92 if (ret < 0) { 86 93 op->downcall.status = ret; ··· 100 95 spin_lock(&orangefs_request_list_lock); 101 96 spin_lock(&op->lock); 102 97 set_op_state_waiting(op); 98 + /* add high priority remount op to the front of the line. */ 103 99 if (flags & ORANGEFS_OP_PRIORITY) 104 100 list_add(&op->list, &orangefs_request_list); 105 101 else ··· 115 109 } 116 110 spin_unlock(&orangefs_request_list_lock); 117 111 118 - if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) 112 + if (!(flags & ORANGEFS_OP_NO_MUTEX)) 119 113 mutex_unlock(&request_mutex); 120 114 121 115 ret = wait_for_matching_downcall(op, timeout, ··· 138 132 139 133 /* failed to get matching downcall */ 140 134 if (ret == -ETIMEDOUT) { 141 - gossip_err("orangefs: %s -- wait timed out; aborting attempt.\n", 135 + gossip_err("%s: %s -- wait timed out; aborting attempt.\n", 136 + __func__, 142 137 op_name); 143 138 } 139 + 140 + /* 141 + * remove waiting ops from the request list or 142 + * remove in-progress ops from the in-progress list. 143 + */ 144 144 orangefs_clean_up_interrupted_operation(op); 145 + 145 146 op->downcall.status = ret; 146 147 /* retry if operation has not been serviced and if requested */ 147 148 if (ret == -EAGAIN) { ··· 161 148 op_name, 162 149 op->attempts); 163 150 151 + /* 152 + * io ops (ops that use the shared memory buffer) have 153 + * to be returned to their caller for a retry. Other ops 154 + * can just be recycled here. 155 + */ 164 156 if (!op->uses_shared_memory) 165 - /* 166 - * this operation doesn't use the shared memory 167 - * system 168 - */ 169 157 goto retry_servicing; 170 158 } 171 159 ··· 282 268 long n; 283 269 284 270 if (interruptible) 285 - n = wait_for_completion_interruptible_timeout(&op->waitq, timeout); 271 + n = wait_for_completion_interruptible_timeout(&op->waitq, 272 + timeout); 286 273 else 287 274 n = wait_for_completion_killable_timeout(&op->waitq, timeout); 288 275