aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c101
1 files changed, 7 insertions, 94 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8118036cc449..b3fd29baadc3 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -636,7 +636,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
636 smp_wmb(); 636 smp_wmb();
637 } else 637 } else
638 status = data->rpc_status; 638 status = data->rpc_status;
639 rpc_release_task(task); 639 rpc_put_task(task);
640 return status; 640 return status;
641} 641}
642 642
@@ -742,7 +742,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
742 smp_wmb(); 742 smp_wmb();
743 } else 743 } else
744 status = data->rpc_status; 744 status = data->rpc_status;
745 rpc_release_task(task); 745 rpc_put_task(task);
746 if (status != 0) 746 if (status != 0)
747 return status; 747 return status;
748 748
@@ -1775,89 +1775,6 @@ static int nfs4_proc_read(struct nfs_read_data *rdata)
1775 return err; 1775 return err;
1776} 1776}
1777 1777
1778static int _nfs4_proc_write(struct nfs_write_data *wdata)
1779{
1780 int rpcflags = wdata->flags;
1781 struct inode *inode = wdata->inode;
1782 struct nfs_fattr *fattr = wdata->res.fattr;
1783 struct nfs_server *server = NFS_SERVER(inode);
1784 struct rpc_message msg = {
1785 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE],
1786 .rpc_argp = &wdata->args,
1787 .rpc_resp = &wdata->res,
1788 .rpc_cred = wdata->cred,
1789 };
1790 int status;
1791
1792 dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
1793 (long long) wdata->args.offset);
1794
1795 wdata->args.bitmask = server->attr_bitmask;
1796 wdata->res.server = server;
1797 wdata->timestamp = jiffies;
1798 nfs_fattr_init(fattr);
1799 status = rpc_call_sync(server->client, &msg, rpcflags);
1800 dprintk("NFS reply write: %d\n", status);
1801 if (status < 0)
1802 return status;
1803 renew_lease(server, wdata->timestamp);
1804 nfs_post_op_update_inode(inode, fattr);
1805 return wdata->res.count;
1806}
1807
1808static int nfs4_proc_write(struct nfs_write_data *wdata)
1809{
1810 struct nfs4_exception exception = { };
1811 int err;
1812 do {
1813 err = nfs4_handle_exception(NFS_SERVER(wdata->inode),
1814 _nfs4_proc_write(wdata),
1815 &exception);
1816 } while (exception.retry);
1817 return err;
1818}
1819
1820static int _nfs4_proc_commit(struct nfs_write_data *cdata)
1821{
1822 struct inode *inode = cdata->inode;
1823 struct nfs_fattr *fattr = cdata->res.fattr;
1824 struct nfs_server *server = NFS_SERVER(inode);
1825 struct rpc_message msg = {
1826 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT],
1827 .rpc_argp = &cdata->args,
1828 .rpc_resp = &cdata->res,
1829 .rpc_cred = cdata->cred,
1830 };
1831 int status;
1832
1833 dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
1834 (long long) cdata->args.offset);
1835
1836 cdata->args.bitmask = server->attr_bitmask;
1837 cdata->res.server = server;
1838 cdata->timestamp = jiffies;
1839 nfs_fattr_init(fattr);
1840 status = rpc_call_sync(server->client, &msg, 0);
1841 if (status >= 0)
1842 renew_lease(server, cdata->timestamp);
1843 dprintk("NFS reply commit: %d\n", status);
1844 if (status >= 0)
1845 nfs_post_op_update_inode(inode, fattr);
1846 return status;
1847}
1848
1849static int nfs4_proc_commit(struct nfs_write_data *cdata)
1850{
1851 struct nfs4_exception exception = { };
1852 int err;
1853 do {
1854 err = nfs4_handle_exception(NFS_SERVER(cdata->inode),
1855 _nfs4_proc_commit(cdata),
1856 &exception);
1857 } while (exception.retry);
1858 return err;
1859}
1860
1861/* 1778/*
1862 * Got race? 1779 * Got race?
1863 * We will need to arrange for the VFS layer to provide an atomic open. 1780 * We will need to arrange for the VFS layer to provide an atomic open.
@@ -1960,7 +1877,7 @@ static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
1960 struct nfs_server *server = NFS_SERVER(dir->d_inode); 1877 struct nfs_server *server = NFS_SERVER(dir->d_inode);
1961 struct unlink_desc *up; 1878 struct unlink_desc *up;
1962 1879
1963 up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL); 1880 up = kmalloc(sizeof(*up), GFP_KERNEL);
1964 if (!up) 1881 if (!up)
1965 return -ENOMEM; 1882 return -ENOMEM;
1966 1883
@@ -2223,13 +2140,11 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2223 dentry->d_parent->d_name.name, 2140 dentry->d_parent->d_name.name,
2224 dentry->d_name.name, 2141 dentry->d_name.name,
2225 (unsigned long long)cookie); 2142 (unsigned long long)cookie);
2226 lock_kernel();
2227 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 2143 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
2228 res.pgbase = args.pgbase; 2144 res.pgbase = args.pgbase;
2229 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 2145 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
2230 if (status == 0) 2146 if (status == 0)
2231 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 2147 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
2232 unlock_kernel();
2233 dprintk("%s: returns %d\n", __FUNCTION__, status); 2148 dprintk("%s: returns %d\n", __FUNCTION__, status);
2234 return status; 2149 return status;
2235} 2150}
@@ -3067,7 +2982,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
3067 if (status == 0) 2982 if (status == 0)
3068 nfs_post_op_update_inode(inode, &data->fattr); 2983 nfs_post_op_update_inode(inode, &data->fattr);
3069 } 2984 }
3070 rpc_release_task(task); 2985 rpc_put_task(task);
3071 return status; 2986 return status;
3072} 2987}
3073 2988
@@ -3314,7 +3229,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
3314 if (IS_ERR(task)) 3229 if (IS_ERR(task))
3315 goto out; 3230 goto out;
3316 status = nfs4_wait_for_completion_rpc_task(task); 3231 status = nfs4_wait_for_completion_rpc_task(task);
3317 rpc_release_task(task); 3232 rpc_put_task(task);
3318out: 3233out:
3319 return status; 3234 return status;
3320} 3235}
@@ -3430,7 +3345,7 @@ static void nfs4_lock_release(void *calldata)
3430 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, 3345 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
3431 data->arg.lock_seqid); 3346 data->arg.lock_seqid);
3432 if (!IS_ERR(task)) 3347 if (!IS_ERR(task))
3433 rpc_release_task(task); 3348 rpc_put_task(task);
3434 dprintk("%s: cancelling lock!\n", __FUNCTION__); 3349 dprintk("%s: cancelling lock!\n", __FUNCTION__);
3435 } else 3350 } else
3436 nfs_free_seqid(data->arg.lock_seqid); 3351 nfs_free_seqid(data->arg.lock_seqid);
@@ -3472,7 +3387,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3472 ret = -EAGAIN; 3387 ret = -EAGAIN;
3473 } else 3388 } else
3474 data->cancelled = 1; 3389 data->cancelled = 1;
3475 rpc_release_task(task); 3390 rpc_put_task(task);
3476 dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret); 3391 dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret);
3477 return ret; 3392 return ret;
3478} 3393}
@@ -3732,8 +3647,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
3732 .access = nfs4_proc_access, 3647 .access = nfs4_proc_access,
3733 .readlink = nfs4_proc_readlink, 3648 .readlink = nfs4_proc_readlink,
3734 .read = nfs4_proc_read, 3649 .read = nfs4_proc_read,
3735 .write = nfs4_proc_write,
3736 .commit = nfs4_proc_commit,
3737 .create = nfs4_proc_create, 3650 .create = nfs4_proc_create,
3738 .remove = nfs4_proc_remove, 3651 .remove = nfs4_proc_remove,
3739 .unlink_setup = nfs4_proc_unlink_setup, 3652 .unlink_setup = nfs4_proc_unlink_setup,