nfsd41: enforce NFS4ERR_SEQUENCE_POS operation order rules for minorversion != 0...
[safe/jmp/linux-2.6] / fs / nfsd / lockd.c
index 7b889ff..b2786a5 100644 (file)
 
 #define NFSDDBG_FACILITY               NFSDDBG_LOCKD
 
+#ifdef CONFIG_LOCKD_V4
+#define nlm_stale_fh   nlm4_stale_fh
+#define nlm_failed     nlm4_failed
+#else
+#define nlm_stale_fh   nlm_lck_denied_nolocks
+#define nlm_failed     nlm_lck_denied_nolocks
+#endif
 /*
  * Note: we hold the dentry use count while the file is open.
  */
-static u32
+static __be32
 nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
 {
-       u32             nfserr;
+       __be32          nfserr;
        struct svc_fh   fh;
 
        /* must initialize before using! but maxsize doesn't matter */
@@ -35,22 +42,22 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
        fh.fh_export = NULL;
 
        exp_readlock();
-       nfserr = nfsd_open(rqstp, &fh, S_IFREG, MAY_LOCK, filp);
+       nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp);
        fh_put(&fh);
        rqstp->rq_client = NULL;
        exp_readunlock();
-       /* nlm and nfsd don't share error codes.
-        * we invent: 0 = no error
-        *            1 = stale file handle
-        *            2 = other error
+       /* We return nlm error codes as nlm doesn't know
+        * about nfsd, but nfsd does know about nlm..
         */
        switch (nfserr) {
        case nfs_ok:
                return 0;
+       case nfserr_dropit:
+               return nlm_drop_reply;
        case nfserr_stale:
-               return 1;
+               return nlm_stale_fh;
        default:
-               return 2;
+               return nlm_failed;
        }
 }