]> Git Repo - linux.git/commitdiff
nfs: explicitly reject LOCK_MAND flock() requests
authorJeff Layton <[email protected]>
Mon, 23 Jul 2012 19:46:23 +0000 (15:46 -0400)
committerTrond Myklebust <[email protected]>
Tue, 31 Jul 2012 18:42:20 +0000 (14:42 -0400)
We have no mechanism to emulate LOCK_MAND locks on NFSv4, so explicitly
return -EINVAL if someone requests it.

Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
fs/nfs/file.c

index 1557978ca7b3f3a326e80b201fc0e9cd7e73bf56..b039a17ee941acfb2ad7ff3fd937d6c91119bfd2 100644 (file)
@@ -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;
 
This page took 0.057286 seconds and 4 git commands to generate.