]> Pileus Git - ~andy/linux/blobdiff - fs/nfsd/nfs4proc.c
usb: phy: export ulpi_viewport_access_ops
[~andy/linux] / fs / nfsd / nfs4proc.c
index 5dee81141ab71983f0f8985d1969fc8ab738a967..27d74a2945151cfbdf76e41cd381b90a0efe4d09 100644 (file)
@@ -279,6 +279,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, str
 {
        struct svc_fh *current_fh = &cstate->current_fh;
        __be32 status;
+       int accmode = 0;
 
        /* We don't know the target directory, and therefore can not
        * set the change info
@@ -290,9 +291,19 @@ do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, str
 
        open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
                (open->op_iattr.ia_size == 0);
+       /*
+        * In the delegation case, the client is telling us about an
+        * open that it *already* performed locally, some time ago.  We
+        * should let it succeed now if possible.
+        *
+        * In the case of a CLAIM_FH open, on the other hand, the client
+        * may be counting on us to enforce permissions (the Linux 4.1
+        * client uses this for normal opens, for example).
+        */
+       if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)
+               accmode = NFSD_MAY_OWNER_OVERRIDE;
 
-       status = do_open_permission(rqstp, current_fh, open,
-                                   NFSD_MAY_OWNER_OVERRIDE);
+       status = do_open_permission(rqstp, current_fh, open, accmode);
 
        return status;
 }
@@ -813,21 +824,11 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        status = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,
                             rename->rn_snamelen, &cstate->current_fh,
                             rename->rn_tname, rename->rn_tnamelen);
-
-       /* the underlying filesystem returns different error's than required
-        * by NFSv4. both save_fh and current_fh have been verified.. */
-       if (status == nfserr_isdir)
-               status = nfserr_exist;
-       else if ((status == nfserr_notdir) &&
-                  (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mode) &&
-                   S_ISDIR(cstate->current_fh.fh_dentry->d_inode->i_mode)))
-               status = nfserr_exist;
-
-       if (!status) {
-               set_change_info(&rename->rn_sinfo, &cstate->current_fh);
-               set_change_info(&rename->rn_tinfo, &cstate->save_fh);
-       }
-       return status;
+       if (status)
+               return status;
+       set_change_info(&rename->rn_sinfo, &cstate->current_fh);
+       set_change_info(&rename->rn_tinfo, &cstate->save_fh);
+       return nfs_ok;
 }
 
 static __be32