linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Benny Halevy <bhalevy@panasas.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v6 19/26] pnfs: support for non-rpc layout drivers
Date: Mon, 23 May 2011 21:10:18 +0300	[thread overview]
Message-ID: <4DDAA30A.8090806@panasas.com> (raw)
In-Reply-To: <1306168687-11649-1-git-send-email-bhalevy@panasas.com>

On 05/23/2011 07:38 PM, Benny Halevy wrote:
> Non-rpc layout driver such as for objects and blocks
> implement their own I/O path and error handling logic.
> Therefore bypass NFS-based error handling for these layout drivers.
> 
> [fix lseg ref-count bugs, and null de-refs]
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> [get rid of PNFS_USE_RPC_CODE]
> [get rid of __nfs4_write_done_cb]
> [revert useless change in nfs4_write_done_cb]
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> ---
>  fs/nfs/internal.h       |    1 +
>  fs/nfs/nfs4proc.c       |   13 +++++++++--
>  fs/nfs/pnfs.c           |   52 ++++++++++++++++++++++++++++++++++++++++++++++-
>  fs/nfs/pnfs.h           |    2 +
>  include/linux/nfs_xdr.h |    2 +
>  5 files changed, 66 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
> index ce118ce..bcf0f0f 100644
> --- a/fs/nfs/internal.h
> +++ b/fs/nfs/internal.h
> @@ -310,6 +310,7 @@ extern int nfs_migrate_page(struct address_space *,
>  #endif
>  
>  /* nfs4proc.c */
> +extern void __nfs4_read_done_cb(struct nfs_read_data *);
>  extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data);
>  extern int nfs4_init_client(struct nfs_client *clp,
>  			    const struct rpc_timeout *timeparms,
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index cf1b339..92c8bc4 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3175,6 +3175,11 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
>  	return err;
>  }
>  
> +void __nfs4_read_done_cb(struct nfs_read_data *data)
> +{
> +	nfs_invalidate_atime(data->inode);
> +}
> +
>  static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data)
>  {
>  	struct nfs_server *server = NFS_SERVER(data->inode);
> @@ -3184,7 +3189,7 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data)
>  		return -EAGAIN;
>  	}
>  
> -	nfs_invalidate_atime(data->inode);
> +	__nfs4_read_done_cb(data);
>  	if (task->tk_status > 0)
>  		renew_lease(server, data->timestamp);
>  	return 0;
> @@ -3198,7 +3203,8 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
>  	if (!nfs4_sequence_done(task, &data->res.seq_res))
>  		return -EAGAIN;
>  
> -	return data->read_done_cb(task, data);
> +	return data->read_done_cb ? data->read_done_cb(task, data) :
> +				    nfs4_read_done_cb(task, data);
>  }
>  
>  static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg)
> @@ -3243,7 +3249,8 @@ 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);
> +	return data->write_done_cb ? data->write_done_cb(task, data) :
> +		nfs4_write_done_cb(task, data);
>  }
>  
>  /* Reset the the nfs_write_data to send the write to the MDS. */
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index ef535f2..0f59802 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -243,7 +243,7 @@ put_lseg_common(struct pnfs_layout_segment *lseg)
>  {
>  	struct inode *inode = lseg->pls_layout->plh_inode;
>  
> -	BUG_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
> +	WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
>  	list_del_init(&lseg->pls_list);
>  	if (list_empty(&lseg->pls_layout->plh_segs)) {
>  		set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags);
> @@ -1054,6 +1054,31 @@ pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode)
>  	pgio->pg_test = (ld && ld->pg_test) ? pnfs_write_pg_test : NULL;
>  }
>  
> +/*
> + * Called by non rpc-based layout drivers
> + */
> +int
> +pnfs_ld_write_done(struct nfs_write_data *data)
> +{
> +	int status;
> +
> +	if (!data->pnfs_error) {
> +		pnfs_set_layoutcommit(data);
> +		data->mds_ops->rpc_call_done(&data->task, data);
> +		data->mds_ops->rpc_release(data);
> +		return 0;
> +	}
> +
> +	put_lseg(data->lseg);
> +	data->lseg = NULL;

These puts are not good as well. I tested. Do you want a SQUASHME or
a replacement patch?


> +	dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
> +		data->pnfs_error);
> +	status = nfs_initiate_write(data, NFS_CLIENT(data->inode),
> +				    data->mds_ops, NFS_FILE_SYNC);
> +	return status ? : -EAGAIN;
> +}
> +EXPORT_SYMBOL_GPL(pnfs_ld_write_done);
> +
>  enum pnfs_try_status
>  pnfs_try_to_write_data(struct nfs_write_data *wdata,
>  			const struct rpc_call_ops *call_ops, int how)
> @@ -1079,6 +1104,31 @@ pnfs_try_to_write_data(struct nfs_write_data *wdata,
>  }
>  
>  /*
> + * Called by non rpc-based layout drivers
> + */
> +int
> +pnfs_ld_read_done(struct nfs_read_data *data)
> +{
> +	int status;
> +
> +	if (!data->pnfs_error) {
> +		__nfs4_read_done_cb(data);
> +		data->mds_ops->rpc_call_done(&data->task, data);
> +		data->mds_ops->rpc_release(data);
> +		return 0;
> +	}
> +
> +	put_lseg(data->lseg);
> +	data->lseg = NULL;

Here to

Boaz
> +	dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
> +		data->pnfs_error);
> +	status = nfs_initiate_read(data, NFS_CLIENT(data->inode),
> +				   data->mds_ops);
> +	return status ? : -EAGAIN;
> +}
> +EXPORT_SYMBOL_GPL(pnfs_ld_read_done);
> +
> +/*
>   * Call the appropriate parallel I/O subsystem read function.
>   */
>  enum pnfs_try_status
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index ed167a7..8a6e1f1 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -165,6 +165,8 @@ void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);
>  bool pnfs_roc_drain(struct inode *ino, u32 *barrier);
>  void pnfs_set_layoutcommit(struct nfs_write_data *wdata);
>  int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
> +int pnfs_ld_write_done(struct nfs_write_data *);
> +int pnfs_ld_read_done(struct nfs_read_data *);
>  
>  /* pnfs_dev.c */
>  struct nfs4_deviceid_node {
> diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
> index 7e371f7..7c8ff09 100644
> --- a/include/linux/nfs_xdr.h
> +++ b/include/linux/nfs_xdr.h
> @@ -1087,6 +1087,7 @@ struct nfs_read_data {
>  	const struct rpc_call_ops *mds_ops;
>  	int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
>  	__u64			mds_offset;
> +	int			pnfs_error;
>  	struct page		*page_array[NFS_PAGEVEC_SIZE];
>  };
>  
> @@ -1112,6 +1113,7 @@ struct nfs_write_data {
>  	unsigned long		timestamp;	/* For lease renewal */
>  #endif
>  	__u64			mds_offset;	/* Filelayout dense stripe */
> +	int			pnfs_error;
>  	struct page		*page_array[NFS_PAGEVEC_SIZE];
>  };
>  


  reply	other threads:[~2011-05-23 18:10 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 16:33 [PATCHSET v6 0/26] pnfs for 2.6.40 Benny Halevy
2011-05-23 16:34 ` [PATCH v6 01/26] NFSv4.1: use struct nfs_client to qualify deviceid Benny Halevy
2011-05-23 17:33   ` Benny Halevy
2011-05-23 16:34 ` [PATCH v6 02/26] pnfs: resolve header dependency in pnfs.h Benny Halevy
2011-05-23 16:34 ` [PATCH v6 03/26] NFSv4.1: make deviceid cache global Benny Halevy
2011-05-23 16:34 ` [PATCH v6 04/26] NFSv4.1: purge deviceid cache on nfs_free_client Benny Halevy
2011-05-23 17:21   ` Benny Halevy
2011-05-23 16:35 ` [PATCH v6 05/26] pnfs: CB_NOTIFY_DEVICEID Benny Halevy
2011-05-23 16:35 ` [PATCH v6 06/26] SUNRPC: introduce xdr_init_decode_pages Benny Halevy
2011-05-23 16:35 ` [PATCH v6 07/26] pnfs: Use byte-range for layoutget Benny Halevy
2011-05-23 16:35 ` [PATCH v6 08/26] pnfs: align layoutget requests on page boundaries Benny Halevy
2011-05-23 16:35 ` [PATCH v6 09/26] pnfs: Use byte-range for cb_layoutrecall Benny Halevy
2011-05-23 16:36 ` [PATCH v6 10/26] pnfs: client stats Benny Halevy
2011-05-23 16:36 ` [PATCH v6 11/26] pnfs-obj: objlayoutdriver module skeleton Benny Halevy
2011-05-23 16:36 ` [PATCH v6 12/26] pnfs-obj: pnfs_osd XDR definitions Benny Halevy
2011-05-23 16:36 ` [PATCH v6 13/26] pnfs-obj: pnfs_osd XDR client implementation Benny Halevy
2011-05-23 19:46   ` [PATCH] SQUASHME: pnf-obj xdr_cli: Wrong type in comments Boaz Harrosh
2011-05-23 16:37 ` [PATCH v6 14/26] pnfs-obj: decode layout, alloc/free lseg Benny Halevy
2011-05-23 19:45   ` [PATCH] SQUASHME: objio read/write patch: Bugs fixes Boaz Harrosh
2011-05-24 13:10     ` Benny Halevy
2011-05-24 14:37       ` Boaz Harrosh
2011-05-24 15:57         ` Benny Halevy
2011-05-24 16:04           ` Boaz Harrosh
2011-05-23 16:37 ` [PATCH v6 15/26] pnfs-obj: objio_osd device information retrieval and caching Benny Halevy
2011-05-23 16:37 ` [PATCH v6 16/26] NFSv4.1: use layout driver in global device cache Benny Halevy
2011-05-23 16:37 ` [PATCH v6 17/26] pnfs: alloc and free layout_hdr layoutdriver methods Benny Halevy
2011-05-23 16:37 ` [PATCH v6 18/26] pnfs-obj: define per-inode private structure Benny Halevy
2011-05-23 16:38 ` [PATCH v6 19/26] pnfs: support for non-rpc layout drivers Benny Halevy
2011-05-23 18:10   ` Boaz Harrosh [this message]
2011-05-23 19:22     ` Benny Halevy
2011-05-23 19:43       ` [PATCH] SQUASHME: into pnfs: pnfs: support for non-rpc layout drivers: de-ref not needed Boaz Harrosh
2011-05-23 16:38 ` [PATCH v6 20/26] pnfs-obj: osd raid engine read/write implementation Benny Halevy
2011-05-25 13:39   ` Boaz Harrosh
2011-05-25 13:41     ` [PATCH] SQUASHME: pnfs-obj: pg_test check for max_io_size Boaz Harrosh
2011-05-25 16:57       ` Benny Halevy
2011-05-23 16:38 ` [PATCH v6 21/26] pnfs: layoutreturn Benny Halevy
2011-05-25 16:07   ` [PATCH] SQUASHME: pnfs: Fix NULL dereference in the -ENOMEM path Boaz Harrosh
2011-05-25 16:12     ` Boaz Harrosh
2011-05-25 16:19     ` [PATCH V2] SQUASHME: pnfs: Fix NULL dereference and leak " Boaz Harrosh
2011-05-25 16:37       ` Boaz Harrosh
2011-05-25 16:47         ` Benny Halevy
2011-05-25 16:40     ` [PATCH V3] " Boaz Harrosh
2011-05-25 16:55       ` Benny Halevy
2011-05-23 16:38 ` [PATCH v6 22/26] pnfs: layoutret_on_setattr Benny Halevy
2011-05-23 16:38 ` [PATCH v6 23/26] pnfs: encode_layoutreturn Benny Halevy
2011-05-23 16:39 ` [PATCH v6 24/26] pnfs-obj: report errors and .encode_layoutreturn Implementation Benny Halevy
2011-05-23 16:39 ` [PATCH v6 25/26] pnfs: encode_layoutcommit Benny Halevy
2011-05-23 16:39 ` [PATCH v6 26/26] pnfs-obj: objlayout_encode_layoutcommit implementation Benny Halevy
2011-05-23 18:20 ` [PATCHSET v6 0/26] pnfs for 2.6.40 Boaz Harrosh
2011-05-23 18:50 ` Boaz Harrosh
2011-05-24 15:16   ` Benny Halevy
     [not found]     ` <2E1EB2CF9ED1CB4AA966F0EB76EAB443080D6E54@SACMVEXC2-PRD.hq.netapp.com>
2011-05-24 15:49       ` Benny Halevy
2011-05-24 17:07         ` Fred Isaman
2011-05-24 15:56       ` Boaz Harrosh
2011-05-24 16:21         ` Trond Myklebust
2011-05-24 16:58           ` Boaz Harrosh
2011-05-24 17:05             ` Trond Myklebust
2011-05-24 17:07               ` Boaz Harrosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDAA30A.8090806@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bhalevy@panasas.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).