patch-2.4.10 linux/fs/lockd/clntproc.c

Next file: linux/fs/lockd/svc.c
Previous file: linux/fs/lockd/clntlock.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/fs/lockd/clntproc.c linux/fs/lockd/clntproc.c
@@ -142,7 +142,7 @@
 
 	/* If we're cleaning up locks because the process is exiting,
 	 * perform the RPC call asynchronously. */
-	if ((cmd == F_SETLK || cmd == F_SETLKW)
+	if ((IS_SETLK(cmd) || IS_SETLKW(cmd))
 	    && fl->fl_type == F_UNLCK
 	    && (current->flags & PF_EXITING)) {
 		sigfillset(&current->blocked);	/* Mask all signals */
@@ -166,17 +166,16 @@
 	/* Set up the argument struct */
 	nlmclnt_setlockargs(call, fl);
 
-	if (cmd == F_GETLK) {
+	if (IS_SETLK(cmd) || IS_SETLKW(cmd)) {
+		if (fl->fl_type != F_UNLCK) {
+			call->a_args.block = IS_SETLKW(cmd) ? 1 : 0;
+			status = nlmclnt_lock(call, fl);
+		} else
+			status = nlmclnt_unlock(call, fl);
+	} else if (IS_GETLK(cmd))
 		status = nlmclnt_test(call, fl);
-	} else if ((cmd == F_SETLK || cmd == F_SETLKW)
-		   && fl->fl_type == F_UNLCK) {
-		status = nlmclnt_unlock(call, fl);
-	} else if (cmd == F_SETLK || cmd == F_SETLKW) {
-		call->a_args.block = (cmd == F_SETLKW)? 1 : 0;
-		status = nlmclnt_lock(call, fl);
-	} else {
+	else
 		status = -EINVAL;
-	}
 
 	if (status < 0 && (call->a_flags & RPC_TASK_ASYNC))
 		kfree(call);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)