locks: fix fcntl_setlease/getlease return when !CONFIG_FILE_LOCKING
authorJeff Layton <jlayton@primarydata.com>
Wed, 24 Sep 2014 12:38:44 +0000 (08:38 -0400)
committerJeff Layton <jlayton@primarydata.com>
Tue, 7 Oct 2014 18:06:13 +0000 (14:06 -0400)
Currently they both just return 0. Fix them to return more appropriate
values instead.

For better or worse, most places in the kernel return -EINVAL when
leases aren't available. -ENOLCK would probably have been better, but
let's follow suit here in the case of F_SETLEASE.

In the F_GETLEASE case, just return F_UNLCK since we know that no
lease will have been set.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
include/linux/fs.h

index bb9484ae1eef3637f409cc37f9ed7406a43fe67b..2023306c620e69c99b7ad00d04349419668573d7 100644 (file)
@@ -1008,12 +1008,12 @@ static inline int fcntl_setlk64(unsigned int fd, struct file *file,
 #endif
 static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
 {
-       return 0;
+       return -EINVAL;
 }
 
 static inline int fcntl_getlease(struct file *filp)
 {
-       return 0;
+       return F_UNLCK;
 }
 
 static inline void locks_init_lock(struct file_lock *fl)