]> err.no Git - linux-2.6/blobdiff - fs/nfsd/nfs4state.c
Pull delete-sigdelayed into release branch
[linux-2.6] / fs / nfsd / nfs4state.c
index 7167dcf8e1fe98a5d60e979542c55828487fbb52..1143cfb6454900e73bb65a29e315e7a5810b9114 100644 (file)
@@ -1088,7 +1088,7 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
        sop->so_seqid = open->op_seqid;
        sop->so_confirmed = 0;
        rp = &sop->so_replay;
-       rp->rp_status = NFSERR_SERVERFAULT;
+       rp->rp_status = nfserr_serverfault;
        rp->rp_buflen = 0;
        rp->rp_buf = rp->rp_ibuf;
        return sop;
@@ -1600,7 +1600,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
        if (!open->op_truncate)
                return 0;
        if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
-               return -EINVAL;
+               return nfserr_inval;
        return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0);
 }
 
@@ -1609,26 +1609,26 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_sta
 {
        struct file *filp = stp->st_vfs_file;
        struct inode *inode = filp->f_dentry->d_inode;
-       unsigned int share_access;
+       unsigned int share_access, new_writer;
        int status;
 
        set_access(&share_access, stp->st_access_bmap);
-       share_access = ~share_access;
-       share_access &= open->op_share_access;
+       new_writer = (~share_access) & open->op_share_access
+                       & NFS4_SHARE_ACCESS_WRITE;
 
-       if (!(share_access & NFS4_SHARE_ACCESS_WRITE))
-               return nfsd4_truncate(rqstp, cur_fh, open);
-
-       status = get_write_access(inode);
-       if (status)
-               return nfserrno(status);
+       if (new_writer) {
+               status = get_write_access(inode);
+               if (status)
+                       return nfserrno(status);
+       }
        status = nfsd4_truncate(rqstp, cur_fh, open);
        if (status) {
-               put_write_access(inode);
+               if (new_writer)
+                       put_write_access(inode);
                return status;
        }
        /* remember the open */
-       filp->f_mode = (filp->f_mode | FMODE_WRITE) & ~FMODE_READ;
+       filp->f_mode |= open->op_share_access;
        set_bit(open->op_share_access, &stp->st_access_bmap);
        set_bit(open->op_share_deny, &stp->st_deny_bmap);
 
@@ -2583,7 +2583,7 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
        sop->so_seqid = lock->lk_new_lock_seqid + 1;
        sop->so_confirmed = 1;
        rp = &sop->so_replay;
-       rp->rp_status = NFSERR_SERVERFAULT;
+       rp->rp_status = nfserr_serverfault;
        rp->rp_buflen = 0;
        rp->rp_buf = rp->rp_ibuf;
        return sop;
@@ -2761,7 +2761,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
                goto conflicting_lock;
        case (EDEADLK):
                status = nfserr_deadlock;
+               dprintk("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n",status);
+               goto out;
        default:        
+               status = nfserrno(status);
                dprintk("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n",status);
                goto out;
        }