Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad0fcd4e authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust
Browse files

nfs: explicitly reject LOCK_MAND flock() requests



We have no mechanism to emulate LOCK_MAND locks on NFSv4, so explicitly
return -EINVAL if someone requests it.

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b042414f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -834,6 +834,15 @@ int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
	if (!(fl->fl_flags & FL_FLOCK))
		return -ENOLCK;

	/*
	 * The NFSv4 protocol doesn't support LOCK_MAND, which is not part of
	 * any standard. In principle we might be able to support LOCK_MAND
	 * on NFSv2/3 since NLMv3/4 support DOS share modes, but for now the
	 * NFS code is not set up for it.
	 */
	if (fl->fl_type & LOCK_MAND)
		return -EINVAL;

	if (NFS_SERVER(inode)->flags & NFS_MOUNT_LOCAL_FLOCK)
		is_local = 1;