]> err.no Git - linux-2.6/blobdiff - fs/nfs/write.c
eCryptfs: change the type of cipher_code from u16 to u8
[linux-2.6] / fs / nfs / write.c
index 8d90e90ccd477011932982690760e37747c57251..b144b1957dd99f7e011e7f635454f4d9215e4757 100644 (file)
@@ -488,7 +488,7 @@ int nfs_reschedule_unstable_write(struct nfs_page *req)
 /*
  * Wait for a request to complete.
  *
- * Interruptible by signals only if mounted with intr flag.
+ * Interruptible by fatal signals only.
  */
 static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, unsigned int npages)
 {
@@ -665,9 +665,7 @@ zero_page:
         * then we need to zero any uninitalised data. */
        if (req->wb_pgbase == 0 && req->wb_bytes != PAGE_CACHE_SIZE
                        && !PageUptodate(req->wb_page))
-               zero_user_page(req->wb_page, req->wb_bytes,
-                               PAGE_CACHE_SIZE - req->wb_bytes,
-                               KM_USER0);
+               zero_user_segment(req->wb_page, req->wb_bytes, PAGE_CACHE_SIZE);
        return req;
 }
 
@@ -776,8 +774,16 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
        struct inode *inode = req->wb_context->path.dentry->d_inode;
        int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
        int priority = flush_task_priority(how);
+       struct rpc_task *task;
+       struct rpc_message msg = {
+               .rpc_argp = &data->args,
+               .rpc_resp = &data->res,
+               .rpc_cred = req->wb_context->cred,
+       };
        struct rpc_task_setup task_setup_data = {
                .rpc_client = NFS_CLIENT(inode),
+               .task = &data->task,
+               .rpc_message = &msg,
                .callback_ops = call_ops,
                .callback_data = data,
                .flags = flags,
@@ -789,7 +795,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
 
        data->req = req;
        data->inode = inode = req->wb_context->path.dentry->d_inode;
-       data->cred = req->wb_context->cred;
+       data->cred = msg.rpc_cred;
 
        data->args.fh     = NFS_FH(inode);
        data->args.offset = req_offset(req) + offset;
@@ -797,6 +803,12 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
        data->args.pages  = data->pagevec;
        data->args.count  = count;
        data->args.context = req->wb_context;
+       data->args.stable  = NFS_UNSTABLE;
+       if (how & FLUSH_STABLE) {
+               data->args.stable = NFS_DATA_SYNC;
+               if (!NFS_I(inode)->ncommit)
+                       data->args.stable = NFS_FILE_SYNC;
+       }
 
        data->res.fattr   = &data->fattr;
        data->res.count   = count;
@@ -804,8 +816,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
        nfs_fattr_init(&data->fattr);
 
        /* Set up the initial task struct.  */
-       rpc_init_task(&data->task, &task_setup_data);
-       NFS_PROTO(inode)->write_setup(data, how);
+       NFS_PROTO(inode)->write_setup(data, &msg);
 
        dprintk("NFS: %5u initiated write call "
                "(req %s/%Ld, %u bytes @ offset %Lu)\n",
@@ -814,16 +825,10 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
                (long long)NFS_FILEID(inode),
                count,
                (unsigned long long)data->args.offset);
-}
 
-static void nfs_execute_write(struct nfs_write_data *data)
-{
-       struct rpc_clnt *clnt = NFS_CLIENT(data->inode);
-       sigset_t oldset;
-
-       rpc_clnt_sigmask(clnt, &oldset);
-       rpc_execute(&data->task);
-       rpc_clnt_sigunmask(clnt, &oldset);
+       task = rpc_run_task(&task_setup_data);
+       if (!IS_ERR(task))
+               rpc_put_task(task);
 }
 
 /*
@@ -870,7 +875,6 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, unsigned
                                   wsize, offset, how);
                offset += wsize;
                nbytes -= wsize;
-               nfs_execute_write(data);
        } while (nbytes != 0);
 
        return 0;
@@ -918,7 +922,6 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i
        /* Set up the argument struct */
        nfs_write_rpcsetup(req, data, &nfs_write_full_ops, count, 0, how);
 
-       nfs_execute_write(data);
        return 0;
  out_bad:
        while (!list_empty(head)) {
@@ -934,7 +937,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i
 static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
                                  struct inode *inode, int ioflags)
 {
-       int wsize = NFS_SERVER(inode)->wsize;
+       size_t wsize = NFS_SERVER(inode)->wsize;
 
        if (wsize < PAGE_CACHE_SIZE)
                nfs_pageio_init(pgio, inode, nfs_flush_multi, wsize, ioflags);
@@ -1152,8 +1155,16 @@ static void nfs_commit_rpcsetup(struct list_head *head,
        struct inode *inode = first->wb_context->path.dentry->d_inode;
        int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
        int priority = flush_task_priority(how);
+       struct rpc_task *task;
+       struct rpc_message msg = {
+               .rpc_argp = &data->args,
+               .rpc_resp = &data->res,
+               .rpc_cred = first->wb_context->cred,
+       };
        struct rpc_task_setup task_setup_data = {
+               .task = &data->task,
                .rpc_client = NFS_CLIENT(inode),
+               .rpc_message = &msg,
                .callback_ops = &nfs_commit_ops,
                .callback_data = data,
                .flags = flags,
@@ -1166,7 +1177,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
        list_splice_init(head, &data->pages);
 
        data->inode       = inode;
-       data->cred        = first->wb_context->cred;
+       data->cred        = msg.rpc_cred;
 
        data->args.fh     = NFS_FH(data->inode);
        /* Note: we always request a commit of the entire inode */
@@ -1178,10 +1189,13 @@ static void nfs_commit_rpcsetup(struct list_head *head,
        nfs_fattr_init(&data->fattr);
 
        /* Set up the initial task struct.  */
-       rpc_init_task(&data->task, &task_setup_data);
-       NFS_PROTO(inode)->commit_setup(data, how);
+       NFS_PROTO(inode)->commit_setup(data, &msg);
 
        dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
+
+       task = rpc_run_task(&task_setup_data);
+       if (!IS_ERR(task))
+               rpc_put_task(task);
 }
 
 /*
@@ -1201,7 +1215,6 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
        /* Set up the argument struct */
        nfs_commit_rpcsetup(head, data, how);
 
-       nfs_execute_write(data);
        return 0;
  out_bad:
        while (!list_empty(head)) {