linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] locks: fix fcntl_setlease/getlease return when !CONFIG_FILE_LOCKING
@ 2014-09-24 13:23 Jeff Layton
  2014-09-24 16:41 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2014-09-24 13:23 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: hch, bfields

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>
---
 include/linux/fs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index bb9484ae1eef..2023306c620e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] locks: fix fcntl_setlease/getlease return when !CONFIG_FILE_LOCKING
  2014-09-24 13:23 [PATCH] locks: fix fcntl_setlease/getlease return when !CONFIG_FILE_LOCKING Jeff Layton
@ 2014-09-24 16:41 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2014-09-24 16:41 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-fsdevel, hch, bfields

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-24 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 13:23 [PATCH] locks: fix fcntl_setlease/getlease return when !CONFIG_FILE_LOCKING Jeff Layton
2014-09-24 16:41 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).