NFSv4.1: add callback to nfs4_write_done
authorFred Isaman <iisaman@netapp.com>
Thu, 3 Mar 2011 15:13:42 +0000 (15:13 +0000)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 11 Mar 2011 20:38:43 +0000 (15:38 -0500)
Add callback that pnfs layout driver can use to do its own handling
of data server WRITE response.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c
include/linux/nfs_xdr.h

index 1dc809039448b23167696ad8a2f82f136f74c01f..15248549c89f4fb9691b9aefe03c0d32c1485d00 100644 (file)
@@ -3123,13 +3123,10 @@ void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data)
 }
 EXPORT_SYMBOL_GPL(nfs4_reset_read);
 
-static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
+static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data)
 {
        struct inode *inode = data->inode;
        
-       if (!nfs4_sequence_done(task, &data->res.seq_res))
-               return -EAGAIN;
-
        if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) {
                nfs_restart_rpc(task, NFS_SERVER(inode)->nfs_client);
                return -EAGAIN;
@@ -3141,11 +3138,20 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
        return 0;
 }
 
+static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
+{
+       if (!nfs4_sequence_done(task, &data->res.seq_res))
+               return -EAGAIN;
+       return data->write_done_cb(task, data);
+}
+
 static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_message *msg)
 {
        struct nfs_server *server = NFS_SERVER(data->inode);
 
        data->args.bitmask = server->cache_consistency_bitmask;
+       if (!data->write_done_cb)
+               data->write_done_cb = nfs4_write_done_cb;
        data->res.server = server;
        data->timestamp   = jiffies;
 
index eb0e8708435322bbdf3506cce80343e7847bbbbf..21cd41ddbca62506efbf5f7c3749ea1b86ff4352 100644 (file)
@@ -1038,6 +1038,7 @@ struct nfs_write_data {
        unsigned int            npages;         /* Max length of pagevec */
        struct nfs_writeargs    args;           /* argument struct */
        struct nfs_writeres     res;            /* result struct */
+       int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
 #ifdef CONFIG_NFS_V4
        unsigned long           timestamp;      /* For lease renewal */
 #endif