diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index df24f67bca69..6917311f201c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4093,15 +4093,23 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) | |||
4093 | if (request->fl_start < 0 || request->fl_end < 0) | 4093 | if (request->fl_start < 0 || request->fl_end < 0) |
4094 | return -EINVAL; | 4094 | return -EINVAL; |
4095 | 4095 | ||
4096 | if (IS_GETLK(cmd)) | 4096 | if (IS_GETLK(cmd)) { |
4097 | return nfs4_proc_getlk(state, F_GETLK, request); | 4097 | if (state != NULL) |
4098 | return nfs4_proc_getlk(state, F_GETLK, request); | ||
4099 | return 0; | ||
4100 | } | ||
4098 | 4101 | ||
4099 | if (!(IS_SETLK(cmd) || IS_SETLKW(cmd))) | 4102 | if (!(IS_SETLK(cmd) || IS_SETLKW(cmd))) |
4100 | return -EINVAL; | 4103 | return -EINVAL; |
4101 | 4104 | ||
4102 | if (request->fl_type == F_UNLCK) | 4105 | if (request->fl_type == F_UNLCK) { |
4103 | return nfs4_proc_unlck(state, cmd, request); | 4106 | if (state != NULL) |
4107 | return nfs4_proc_unlck(state, cmd, request); | ||
4108 | return 0; | ||
4109 | } | ||
4104 | 4110 | ||
4111 | if (state == NULL) | ||
4112 | return -ENOLCK; | ||
4105 | do { | 4113 | do { |
4106 | status = nfs4_proc_setlk(state, cmd, request); | 4114 | status = nfs4_proc_setlk(state, cmd, request); |
4107 | if ((status != -EAGAIN) || IS_SETLK(cmd)) | 4115 | if ((status != -EAGAIN) || IS_SETLK(cmd)) |