Commit 02440806 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: handle lease F_UNLCK requests properly

Currently any F_UNLCK request for a lease just gets back -EAGAIN. Allow
them to go immediately to generic_setlease instead.
Signed-off-by: default avatarJeff Layton <jlayton@primarydata.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent d43cc793
...@@ -812,8 +812,9 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) ...@@ -812,8 +812,9 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
if (!(S_ISREG(inode->i_mode))) if (!(S_ISREG(inode->i_mode)))
return -EINVAL; return -EINVAL;
/* check if file is oplocked */ /* Check if file is oplocked if this is request for new lease */
if (((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) || if (arg == F_UNLCK ||
((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) ||
((arg == F_WRLCK) && CIFS_CACHE_WRITE(CIFS_I(inode)))) ((arg == F_WRLCK) && CIFS_CACHE_WRITE(CIFS_I(inode))))
return generic_setlease(file, arg, lease); return generic_setlease(file, arg, lease);
else if (tlink_tcon(cfile->tlink)->local_lease && else if (tlink_tcon(cfile->tlink)->local_lease &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment